From 8a85cf4c001e5de227a53a274462ca6f0dfda5c4 Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:09:46 +0100 Subject: [PATCH] Regenerated API Client. --- src/Client/README.md | 34 +- src/Client/lib/Api/DefaultApi.php | 629 ++- src/Client/lib/Model/Capabilities.php | 850 ++-- src/Client/lib/Model/CapabilitiesFeatures.php | 975 ++-- src/Client/lib/Model/CustomProp.php | 701 ++- src/Client/lib/Model/CustomPropCustomProp.php | 693 ++- .../lib/Model/CustomPropDisableRequest.php | 791 ++-- .../CustomPropDisableRequestBulkDisable.php | 719 ++- .../lib/Model/CustomPropEnableRequest.php | 791 ++-- .../lib/Model/CustomPropListResponse.php | 701 ++- src/Client/lib/Model/Goal.php | 778 ++-- .../Model/GoalCreateRequestCustomEvent.php | 834 ++-- .../lib/Model/GoalCreateRequestRevenue.php | 834 ++-- src/Client/lib/Model/GoalCustomEvent.php | 772 ++-- .../lib/Model/GoalDeleteBulkRequest.php | 734 ++- src/Client/lib/Model/GoalListResponseMeta.php | 693 ++- src/Client/lib/Model/GoalPageview.php | 772 ++-- src/Client/lib/Model/GoalRevenueAllOfGoal.php | 904 ++-- src/Client/lib/Model/PaginationMetadata.php | 835 ++-- .../lib/Model/SharedLinkCreateRequest.php | 701 ++- .../SharedLinkCreateRequestSharedLink.php | 758 ++-- .../lib/Model/SharedLinkListResponse.php | 772 ++-- src/Client/lib/ObjectSerializer.php | 3 +- src/Client/src/Client/.gitignore | 15 - .../src/Client/.openapi-generator-ignore | 23 - .../src/Client/.openapi-generator/FILES | 56 - .../src/Client/.openapi-generator/VERSION | 1 - src/Client/src/Client/.php-cs-fixer.dist.php | 29 - src/Client/src/Client/.travis.yml | 8 - src/Client/src/Client/README.md | 162 - src/Client/src/Client/composer.json | 38 - src/Client/src/Client/git_push.sh | 57 - src/Client/src/Client/lib/Api/DefaultApi.php | 3955 ----------------- src/Client/src/Client/lib/ApiException.php | 119 - src/Client/src/Client/lib/Configuration.php | 531 --- src/Client/src/Client/lib/HeaderSelector.php | 245 - .../src/Client/lib/Model/Capabilities.php | 487 -- .../Client/lib/Model/CapabilitiesFeatures.php | 560 --- .../src/Client/lib/Model/CustomProp.php | 413 -- .../Client/lib/Model/CustomPropCustomProp.php | 412 -- .../lib/Model/CustomPropDisableRequest.php | 459 -- .../CustomPropDisableRequestBulkDisable.php | 422 -- .../lib/Model/CustomPropEnableRequest.php | 459 -- .../CustomPropEnableRequestBulkEnable.php | 422 -- .../lib/Model/CustomPropListResponse.php | 413 -- src/Client/src/Client/lib/Model/Error.php | 413 -- src/Client/src/Client/lib/Model/Goal.php | 453 -- .../Client/lib/Model/GoalCreateRequest.php | 534 --- .../GoalCreateRequestBulkGetOrCreate.php | 428 -- ...CreateRequestBulkGetOrCreateGoalsInner.php | 481 -- .../Model/GoalCreateRequestCustomEvent.php | 482 -- .../GoalCreateRequestCustomEventGoal.php | 412 -- .../lib/Model/GoalCreateRequestPageview.php | 482 -- .../Model/GoalCreateRequestPageviewGoal.php | 412 -- .../lib/Model/GoalCreateRequestRevenue.php | 482 -- .../Model/GoalCreateRequestRevenueGoal.php | 449 -- .../src/Client/lib/Model/GoalCustomEvent.php | 450 -- .../lib/Model/GoalCustomEventAllOfGoal.php | 486 -- .../lib/Model/GoalDeleteBulkRequest.php | 428 -- .../src/Client/lib/Model/GoalListResponse.php | 450 -- .../Client/lib/Model/GoalListResponseMeta.php | 412 -- .../src/Client/lib/Model/GoalPageview.php | 450 -- .../lib/Model/GoalPageviewAllOfGoal.php | 486 -- .../src/Client/lib/Model/GoalRevenue.php | 450 -- .../Client/lib/Model/GoalRevenueAllOfGoal.php | 523 --- src/Client/src/Client/lib/Model/GoalType.php | 413 -- src/Client/src/Client/lib/Model/Link.php | 412 -- .../src/Client/lib/Model/ModelInterface.php | 111 - .../src/Client/lib/Model/NotFoundError.php | 413 -- .../Client/lib/Model/PaginationMetadata.php | 484 -- .../lib/Model/PaginationMetadataLinks.php | 443 -- .../Client/lib/Model/PaymentRequiredError.php | 413 -- .../src/Client/lib/Model/SharedLink.php | 413 -- .../lib/Model/SharedLinkCreateRequest.php | 413 -- .../SharedLinkCreateRequestSharedLink.php | 446 -- .../lib/Model/SharedLinkListResponse.php | 450 -- .../Client/lib/Model/SharedLinkSharedLink.php | 523 --- .../Client/lib/Model/UnauthorizedError.php | 413 -- .../lib/Model/UnprocessableEntityError.php | 413 -- .../src/Client/lib/ObjectSerializer.php | 567 --- src/Client/src/Client/phpunit.xml.dist | 18 - 81 files changed, 7597 insertions(+), 33471 deletions(-) delete mode 100644 src/Client/src/Client/.gitignore delete mode 100644 src/Client/src/Client/.openapi-generator-ignore delete mode 100644 src/Client/src/Client/.openapi-generator/FILES delete mode 100644 src/Client/src/Client/.openapi-generator/VERSION delete mode 100644 src/Client/src/Client/.php-cs-fixer.dist.php delete mode 100644 src/Client/src/Client/.travis.yml delete mode 100644 src/Client/src/Client/README.md delete mode 100644 src/Client/src/Client/composer.json delete mode 100644 src/Client/src/Client/git_push.sh delete mode 100644 src/Client/src/Client/lib/Api/DefaultApi.php delete mode 100644 src/Client/src/Client/lib/ApiException.php delete mode 100644 src/Client/src/Client/lib/Configuration.php delete mode 100644 src/Client/src/Client/lib/HeaderSelector.php delete mode 100644 src/Client/src/Client/lib/Model/Capabilities.php delete mode 100644 src/Client/src/Client/lib/Model/CapabilitiesFeatures.php delete mode 100644 src/Client/src/Client/lib/Model/CustomProp.php delete mode 100644 src/Client/src/Client/lib/Model/CustomPropCustomProp.php delete mode 100644 src/Client/src/Client/lib/Model/CustomPropDisableRequest.php delete mode 100644 src/Client/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php delete mode 100644 src/Client/src/Client/lib/Model/CustomPropEnableRequest.php delete mode 100644 src/Client/src/Client/lib/Model/CustomPropEnableRequestBulkEnable.php delete mode 100644 src/Client/src/Client/lib/Model/CustomPropListResponse.php delete mode 100644 src/Client/src/Client/lib/Model/Error.php delete mode 100644 src/Client/src/Client/lib/Model/Goal.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequest.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreate.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequestCustomEvent.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequestCustomEventGoal.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequestPageview.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequestPageviewGoal.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequestRevenue.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCreateRequestRevenueGoal.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCustomEvent.php delete mode 100644 src/Client/src/Client/lib/Model/GoalCustomEventAllOfGoal.php delete mode 100644 src/Client/src/Client/lib/Model/GoalDeleteBulkRequest.php delete mode 100644 src/Client/src/Client/lib/Model/GoalListResponse.php delete mode 100644 src/Client/src/Client/lib/Model/GoalListResponseMeta.php delete mode 100644 src/Client/src/Client/lib/Model/GoalPageview.php delete mode 100644 src/Client/src/Client/lib/Model/GoalPageviewAllOfGoal.php delete mode 100644 src/Client/src/Client/lib/Model/GoalRevenue.php delete mode 100644 src/Client/src/Client/lib/Model/GoalRevenueAllOfGoal.php delete mode 100644 src/Client/src/Client/lib/Model/GoalType.php delete mode 100644 src/Client/src/Client/lib/Model/Link.php delete mode 100644 src/Client/src/Client/lib/Model/ModelInterface.php delete mode 100644 src/Client/src/Client/lib/Model/NotFoundError.php delete mode 100644 src/Client/src/Client/lib/Model/PaginationMetadata.php delete mode 100644 src/Client/src/Client/lib/Model/PaginationMetadataLinks.php delete mode 100644 src/Client/src/Client/lib/Model/PaymentRequiredError.php delete mode 100644 src/Client/src/Client/lib/Model/SharedLink.php delete mode 100644 src/Client/src/Client/lib/Model/SharedLinkCreateRequest.php delete mode 100644 src/Client/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php delete mode 100644 src/Client/src/Client/lib/Model/SharedLinkListResponse.php delete mode 100644 src/Client/src/Client/lib/Model/SharedLinkSharedLink.php delete mode 100644 src/Client/src/Client/lib/Model/UnauthorizedError.php delete mode 100644 src/Client/src/Client/lib/Model/UnprocessableEntityError.php delete mode 100644 src/Client/src/Client/lib/ObjectSerializer.php delete mode 100644 src/Client/src/Client/phpunit.xml.dist diff --git a/src/Client/README.md b/src/Client/README.md index 58b5350f..1bb96455 100644 --- a/src/Client/README.md +++ b/src/Client/README.md @@ -2,7 +2,6 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - ## Installation & Usage ### Requirements @@ -50,12 +49,12 @@ require_once(__DIR__ . '/vendor/autoload.php'); // Configure HTTP basic authorization: basic_auth -$config = PlausibleAnalyticsWPClient\Configuration::getDefaultConfiguration() +$config = Plausible\Analytics\WP\Client\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); -$apiInstance = new PlausibleAnalyticsWPClient\Api\DefaultApi( +$apiInstance = new Plausible\Analytics\WP\Client\Api\DefaultApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), @@ -75,19 +74,19 @@ try { All URIs are relative to *https://plausible.io* -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*DefaultApi* | [**plausibleWebPluginsAPIControllersCapabilitiesIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscapabilitiesindex) | **GET** /api/plugins/v1/capabilities | Retrieve Capabilities -*DefaultApi* | [**plausibleWebPluginsAPIControllersCustomPropsDisable**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscustompropsdisable) | **DELETE** /api/plugins/v1/custom_props | Disable CustomProp(s) -*DefaultApi* | [**plausibleWebPluginsAPIControllersCustomPropsEnable**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscustompropsenable) | **PUT** /api/plugins/v1/custom_props | Get or enable CustomProp(s) -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsCreate**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalscreate) | **PUT** /api/plugins/v1/goals | Get or create Goal -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsDelete**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsdelete) | **DELETE** /api/plugins/v1/goals/{id} | Delete Goal by ID -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsDeleteBulk**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsdeletebulk) | **DELETE** /api/plugins/v1/goals | Delete Goals in bulk -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsGet**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsget) | **GET** /api/plugins/v1/goals/{id} | Retrieve Goal by ID -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsindex) | **GET** /api/plugins/v1/goals | Retrieve Goals -*DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksCreate**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinkscreate) | **PUT** /api/plugins/v1/shared_links | Get or create Shared Link -*DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksGet**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinksget) | **GET** /api/plugins/v1/shared_links/{id} | Retrieve Shared Link by ID -*DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinksindex) | **GET** /api/plugins/v1/shared_links | Retrieve Shared Links + Class | Method | HTTP request | Description +--------------|---------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|----------------------------- + *DefaultApi* | [**plausibleWebPluginsAPIControllersCapabilitiesIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscapabilitiesindex) | **GET** /api/plugins/v1/capabilities | Retrieve Capabilities + *DefaultApi* | [**plausibleWebPluginsAPIControllersCustomPropsDisable**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscustompropsdisable) | **DELETE** /api/plugins/v1/custom_props | Disable CustomProp(s) + *DefaultApi* | [**plausibleWebPluginsAPIControllersCustomPropsEnable**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscustompropsenable) | **PUT** /api/plugins/v1/custom_props | Get or enable CustomProp(s) + *DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsCreate**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalscreate) | **PUT** /api/plugins/v1/goals | Get or create Goal + *DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsDelete**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsdelete) | **DELETE** /api/plugins/v1/goals/{id} | Delete Goal by ID + *DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsDeleteBulk**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsdeletebulk) | **DELETE** /api/plugins/v1/goals | Delete Goals in bulk + *DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsGet**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsget) | **GET** /api/plugins/v1/goals/{id} | Retrieve Goal by ID + *DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsindex) | **GET** /api/plugins/v1/goals | Retrieve Goals + *DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksCreate**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinkscreate) | **PUT** /api/plugins/v1/shared_links | Get or create Shared Link + *DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksGet**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinksget) | **GET** /api/plugins/v1/shared_links/{id} | Retrieve Shared Link by ID + *DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinksindex) | **GET** /api/plugins/v1/shared_links | Retrieve Shared Links ## Models @@ -137,6 +136,7 @@ Class | Method | HTTP request | Description ## Authorization Authentication schemes defined for the API: + ### basic_auth - **Type**: HTTP basic authentication @@ -152,8 +152,6 @@ vendor/bin/phpunit ## Author - - ## About this package This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: diff --git a/src/Client/lib/Api/DefaultApi.php b/src/Client/lib/Api/DefaultApi.php index 53caaece..29bc7b17 100644 --- a/src/Client/lib/Api/DefaultApi.php +++ b/src/Client/lib/Api/DefaultApi.php @@ -366,10 +366,10 @@ public function plausibleWebPluginsAPIControllersCapabilitiesIndexAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCapabilitiesIndex' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo( $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -390,34 +390,34 @@ public function plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpI $request = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( $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 ); - } + 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() - ); } - ); + + 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() + ); + } + ); } /** @@ -557,10 +557,9 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableRequest( if ( isset( $custom_prop_disable_request ) ) { if ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the body - $httpBody = - \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( - ObjectSerializer::sanitizeForSerialization( $custom_prop_disable_request ) - ); + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( + ObjectSerializer::sanitizeForSerialization( $custom_prop_disable_request ) + ); } else { $httpBody = $custom_prop_disable_request; } @@ -630,10 +629,10 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsDisable' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersCustomPropsDisableAsyncWithHttpInfo( $custom_prop_disable_request, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -657,21 +656,21 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableAsyncWithHttp $request = $this->plausibleWebPluginsAPIControllersCustomPropsDisableRequest( $custom_prop_disable_request, $contentType ); return $this->client->sendAsync( $request, $this->createHttpClientOption() )->then( - function ( $response ) use ( $returnType ) { - return [ null, $response->getStatusCode(), $response->getHeaders() ]; - }, - function ( $exception ) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), $statusCode, $response->getHeaders(), (string) $response->getBody() - ); - } - ); + function ( $response ) use ( $returnType ) { + return [ null, $response->getStatusCode(), $response->getHeaders() ]; + }, + function ( $exception ) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, $response->getHeaders(), (string) $response->getBody() + ); + } + ); } /** @@ -897,10 +896,9 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableRequest( if ( isset( $custom_prop_enable_request ) ) { if ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the body - $httpBody = - \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( - ObjectSerializer::sanitizeForSerialization( $custom_prop_enable_request ) - ); + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( + ObjectSerializer::sanitizeForSerialization( $custom_prop_enable_request ) + ); } else { $httpBody = $custom_prop_enable_request; } @@ -969,10 +967,10 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsEnable' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersCustomPropsEnableAsyncWithHttpInfo( $custom_prop_enable_request, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -995,34 +993,34 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableAsyncWithHttpI $request = $this->plausibleWebPluginsAPIControllersCustomPropsEnableRequest( $custom_prop_enable_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 ); - } + 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() - ); } - ); + + 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() + ); + } + ); } /** @@ -1248,10 +1246,9 @@ public function plausibleWebPluginsAPIControllersGoalsCreateRequest( if ( isset( $goal_create_request ) ) { if ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the body - $httpBody = - \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( - ObjectSerializer::sanitizeForSerialization( $goal_create_request ) - ); + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( + ObjectSerializer::sanitizeForSerialization( $goal_create_request ) + ); } else { $httpBody = $goal_create_request; } @@ -1320,10 +1317,10 @@ public function plausibleWebPluginsAPIControllersGoalsCreateAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsCreate' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersGoalsCreateAsyncWithHttpInfo( $goal_create_request, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -1346,34 +1343,34 @@ public function plausibleWebPluginsAPIControllersGoalsCreateAsyncWithHttpInfo( $request = $this->plausibleWebPluginsAPIControllersGoalsCreateRequest( $goal_create_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 ); - } + 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() - ); } - ); + + 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() + ); + } + ); } /** @@ -1568,10 +1565,10 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsDelete' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersGoalsDeleteAsyncWithHttpInfo( $id, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -1593,21 +1590,21 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteAsyncWithHttpInfo( $request = $this->plausibleWebPluginsAPIControllersGoalsDeleteRequest( $id, $contentType ); return $this->client->sendAsync( $request, $this->createHttpClientOption() )->then( - function ( $response ) use ( $returnType ) { - return [ null, $response->getStatusCode(), $response->getHeaders() ]; - }, - function ( $exception ) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), $statusCode, $response->getHeaders(), (string) $response->getBody() - ); - } - ); + function ( $response ) use ( $returnType ) { + return [ null, $response->getStatusCode(), $response->getHeaders() ]; + }, + function ( $exception ) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, $response->getHeaders(), (string) $response->getBody() + ); + } + ); } /** @@ -1728,10 +1725,9 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( if ( isset( $goal_delete_bulk_request ) ) { if ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the body - $httpBody = - \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( - ObjectSerializer::sanitizeForSerialization( $goal_delete_bulk_request ) - ); + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( + ObjectSerializer::sanitizeForSerialization( $goal_delete_bulk_request ) + ); } else { $httpBody = $goal_delete_bulk_request; } @@ -1800,10 +1796,10 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsDeleteBulk' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersGoalsDeleteBulkAsyncWithHttpInfo( $goal_delete_bulk_request, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -1826,21 +1822,21 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkAsyncWithHttpInf $request = $this->plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( $goal_delete_bulk_request, $contentType ); return $this->client->sendAsync( $request, $this->createHttpClientOption() )->then( - function ( $response ) use ( $returnType ) { - return [ null, $response->getStatusCode(), $response->getHeaders() ]; - }, - function ( $exception ) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), $statusCode, $response->getHeaders(), (string) $response->getBody() - ); - } - ); + function ( $response ) use ( $returnType ) { + return [ null, $response->getStatusCode(), $response->getHeaders() ]; + }, + function ( $exception ) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, $response->getHeaders(), (string) $response->getBody() + ); + } + ); } /** @@ -2140,10 +2136,10 @@ public function plausibleWebPluginsAPIControllersGoalsGetAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsGet' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersGoalsGetAsyncWithHttpInfo( $id, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -2165,34 +2161,34 @@ public function plausibleWebPluginsAPIControllersGoalsGetAsyncWithHttpInfo( $request = $this->plausibleWebPluginsAPIControllersGoalsGetRequest( $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 ); - } + 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() - ); } - ); + + 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() + ); + } + ); } /** @@ -2482,10 +2478,10 @@ public function plausibleWebPluginsAPIControllersGoalsIndexAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsIndex' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersGoalsIndexAsyncWithHttpInfo( $limit, $after, $before, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -2511,34 +2507,34 @@ public function plausibleWebPluginsAPIControllersGoalsIndexAsyncWithHttpInfo( $request = $this->plausibleWebPluginsAPIControllersGoalsIndexRequest( $limit, $after, $before, $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 ); - } + 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() - ); } - ); + + 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() + ); + } + ); } /** @@ -2741,10 +2737,9 @@ public function plausibleWebPluginsAPIControllersSharedLinksCreateRequest( if ( isset( $shared_link_create_request ) ) { if ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the body - $httpBody = - \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( - ObjectSerializer::sanitizeForSerialization( $shared_link_create_request ) - ); + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( + ObjectSerializer::sanitizeForSerialization( $shared_link_create_request ) + ); } else { $httpBody = $shared_link_create_request; } @@ -2813,10 +2808,10 @@ public function plausibleWebPluginsAPIControllersSharedLinksCreateAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksCreate' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo( $shared_link_create_request, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -2839,34 +2834,34 @@ public function plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpI $request = $this->plausibleWebPluginsAPIControllersSharedLinksCreateRequest( $shared_link_create_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 ); - } + 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() - ); } - ); + + 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() + ); + } + ); } /** @@ -3166,10 +3161,10 @@ public function plausibleWebPluginsAPIControllersSharedLinksGetAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksGet' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersSharedLinksGetAsyncWithHttpInfo( $id, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -3191,34 +3186,34 @@ public function plausibleWebPluginsAPIControllersSharedLinksGetAsyncWithHttpInfo $request = $this->plausibleWebPluginsAPIControllersSharedLinksGetRequest( $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 ); - } + 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() - ); } - ); + + 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() + ); + } + ); } /** @@ -3512,10 +3507,10 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexAsync( string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksIndex' ][ 0 ] ) { return $this->plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpInfo( $limit, $after, $before, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + function ( $response ) { + return $response[ 0 ]; + } + ); } /** @@ -3542,33 +3537,33 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpIn $request = $this->plausibleWebPluginsAPIControllersSharedLinksIndexRequest( $limit, $after, $before, $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 ); - } + 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() - ); } - ); + + 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() + ); + } + ); } } diff --git a/src/Client/lib/Model/Capabilities.php b/src/Client/lib/Model/Capabilities.php index 4e71ecad..3f4ed92a 100644 --- a/src/Client/lib/Model/Capabilities.php +++ b/src/Client/lib/Model/Capabilities.php @@ -1,9 +1,7 @@ */ -class Capabilities implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Capabilities'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'authorized' => 'bool', - 'data_domain' => 'string', - 'features' => '\Plausible\Analytics\WP\Client\Model\CapabilitiesFeatures' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'authorized' => null, - 'data_domain' => null, - 'features' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'authorized' => false, - 'data_domain' => false, - 'features' => 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 = [ - 'authorized' => 'authorized', - 'data_domain' => 'data_domain', - 'features' => 'features' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'authorized' => 'setAuthorized', - 'data_domain' => 'setDataDomain', - 'features' => 'setFeatures' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'authorized' => 'getAuthorized', - 'data_domain' => 'getDataDomain', - 'features' => 'getFeatures' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('authorized', $data ?? [], null); - $this->setIfExists('data_domain', $data ?? [], null); - $this->setIfExists('features', $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['authorized'] === null) { - $invalidProperties[] = "'authorized' can't be null"; - } - if ($this->container['data_domain'] === null) { - $invalidProperties[] = "'data_domain' can't be null"; - } - if ($this->container['features'] === null) { - $invalidProperties[] = "'features' 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 authorized - * - * @return bool - */ - public function getAuthorized() - { - return $this->container['authorized']; - } - - /** - * Sets authorized - * - * @param bool $authorized authorized - * - * @return self - */ - public function setAuthorized($authorized) - { - if (is_null($authorized)) { - throw new \InvalidArgumentException('non-nullable authorized cannot be null'); - } - $this->container['authorized'] = $authorized; - - return $this; - } - - /** - * Gets data_domain - * - * @return string - */ - public function getDataDomain() - { - return $this->container['data_domain']; - } - - /** - * Sets data_domain - * - * @param string $data_domain data_domain - * - * @return self - */ - public function setDataDomain($data_domain) - { - if (is_null($data_domain)) { - throw new \InvalidArgumentException('non-nullable data_domain cannot be null'); - } - $this->container['data_domain'] = $data_domain; - - return $this; - } - - /** - * Gets features - * - * @return \Plausible\Analytics\WP\Client\Model\CapabilitiesFeatures - */ - public function getFeatures() - { - return $this->container['features']; - } - - /** - * Sets features - * - * @param \Plausible\Analytics\WP\Client\Model\CapabilitiesFeatures $features features - * - * @return self - */ - public function setFeatures($features) - { - if (is_null($features)) { - throw new \InvalidArgumentException('non-nullable features cannot be null'); - } - $this->container['features'] = $features; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class Capabilities implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Capabilities'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'authorized' => 'bool', + 'data_domain' => 'string', + 'features' => '\Plausible\Analytics\WP\Client\Model\CapabilitiesFeatures', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'authorized' => null, + 'data_domain' => null, + 'features' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'authorized' => false, + 'data_domain' => true, + 'features' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'authorized' => 'authorized', + 'data_domain' => 'data_domain', + 'features' => 'features', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'authorized' => 'setAuthorized', + 'data_domain' => 'setDataDomain', + 'features' => 'setFeatures', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'authorized' => 'getAuthorized', + 'data_domain' => 'getDataDomain', + 'features' => 'getFeatures', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'authorized', $data ?? [], null ); + $this->setIfExists( 'data_domain', $data ?? [], null ); + $this->setIfExists( 'features', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'authorized' ] === null ) { + $invalidProperties[] = "'authorized' can't be null"; + } + if ( $this->container[ 'data_domain' ] === null ) { + $invalidProperties[] = "'data_domain' can't be null"; + } + if ( $this->container[ 'features' ] === null ) { + $invalidProperties[] = "'features' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets authorized + * @return bool + */ + public function getAuthorized() { + return $this->container[ 'authorized' ]; + } + + /** + * Sets authorized + * + * @param bool $authorized authorized + * + * @return self + */ + public function setAuthorized( $authorized ) { + if ( is_null( $authorized ) ) { + throw new \InvalidArgumentException( 'non-nullable authorized cannot be null' ); + } + $this->container[ 'authorized' ] = $authorized; + + return $this; + } + + /** + * Gets data_domain + * @return string + */ + public function getDataDomain() { + return $this->container[ 'data_domain' ]; + } + + /** + * Sets data_domain + * + * @param string $data_domain data_domain + * + * @return self + */ + public function setDataDomain( $data_domain ) { + if ( is_null( $data_domain ) ) { + array_push( $this->openAPINullablesSetToNull, 'data_domain' ); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search( 'data_domain', $nullablesSetToNull ); + if ( $index !== false ) { + unset( $nullablesSetToNull[ $index ] ); + $this->setOpenAPINullablesSetToNull( $nullablesSetToNull ); + } + } + $this->container[ 'data_domain' ] = $data_domain; + + return $this; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Gets features + * @return \Plausible\Analytics\WP\Client\Model\CapabilitiesFeatures + */ + public function getFeatures() { + return $this->container[ 'features' ]; + } + + /** + * Sets features + * + * @param \Plausible\Analytics\WP\Client\Model\CapabilitiesFeatures $features features + * + * @return self + */ + public function setFeatures( $features ) { + if ( is_null( $features ) ) { + throw new \InvalidArgumentException( 'non-nullable features cannot be null' ); + } + $this->container[ 'features' ] = $features; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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/lib/Model/CapabilitiesFeatures.php b/src/Client/lib/Model/CapabilitiesFeatures.php index 7738389f..7278f35a 100644 --- a/src/Client/lib/Model/CapabilitiesFeatures.php +++ b/src/Client/lib/Model/CapabilitiesFeatures.php @@ -1,9 +1,7 @@ */ -class CapabilitiesFeatures implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Capabilities_features'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'funnels' => 'bool', - 'goals' => 'bool', - 'props' => 'bool', - 'revenue_goals' => 'bool', - 'stats_api' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'funnels' => null, - 'goals' => null, - 'props' => null, - 'revenue_goals' => null, - 'stats_api' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'funnels' => false, - 'goals' => false, - 'props' => false, +class CapabilitiesFeatures implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Capabilities_features'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'funnels' => 'bool', + 'goals' => 'bool', + 'props' => 'bool', + 'revenue_goals' => 'bool', + 'stats_api' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'funnels' => null, + 'goals' => null, + 'props' => null, + 'revenue_goals' => null, + 'stats_api' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'funnels' => false, + 'goals' => false, + 'props' => false, 'revenue_goals' => false, - 'stats_api' => 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 = [ - 'funnels' => 'Funnels', - 'goals' => 'Goals', - 'props' => 'Props', - 'revenue_goals' => 'RevenueGoals', - 'stats_api' => 'StatsAPI' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'funnels' => 'setFunnels', - 'goals' => 'setGoals', - 'props' => 'setProps', - 'revenue_goals' => 'setRevenueGoals', - 'stats_api' => 'setStatsApi' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'funnels' => 'getFunnels', - 'goals' => 'getGoals', - 'props' => 'getProps', - 'revenue_goals' => 'getRevenueGoals', - 'stats_api' => 'getStatsApi' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('funnels', $data ?? [], null); - $this->setIfExists('goals', $data ?? [], null); - $this->setIfExists('props', $data ?? [], null); - $this->setIfExists('revenue_goals', $data ?? [], null); - $this->setIfExists('stats_api', $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['funnels'] === null) { - $invalidProperties[] = "'funnels' can't be null"; - } - if ($this->container['goals'] === null) { - $invalidProperties[] = "'goals' can't be null"; - } - if ($this->container['props'] === null) { - $invalidProperties[] = "'props' can't be null"; - } - if ($this->container['revenue_goals'] === null) { - $invalidProperties[] = "'revenue_goals' can't be null"; - } - if ($this->container['stats_api'] === null) { - $invalidProperties[] = "'stats_api' 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 funnels - * - * @return bool - */ - public function getFunnels() - { - return $this->container['funnels']; - } - - /** - * Sets funnels - * - * @param bool $funnels funnels - * - * @return self - */ - public function setFunnels($funnels) - { - if (is_null($funnels)) { - throw new \InvalidArgumentException('non-nullable funnels cannot be null'); - } - $this->container['funnels'] = $funnels; - - return $this; - } - - /** - * Gets goals - * - * @return bool - */ - public function getGoals() - { - return $this->container['goals']; - } - - /** - * Sets goals - * - * @param bool $goals goals - * - * @return self - */ - public function setGoals($goals) - { - if (is_null($goals)) { - throw new \InvalidArgumentException('non-nullable goals cannot be null'); - } - $this->container['goals'] = $goals; - - return $this; - } - - /** - * Gets props - * - * @return bool - */ - public function getProps() - { - return $this->container['props']; - } - - /** - * Sets props - * - * @param bool $props props - * - * @return self - */ - public function setProps($props) - { - if (is_null($props)) { - throw new \InvalidArgumentException('non-nullable props cannot be null'); - } - $this->container['props'] = $props; - - return $this; - } - - /** - * Gets revenue_goals - * - * @return bool - */ - public function getRevenueGoals() - { - return $this->container['revenue_goals']; - } - - /** - * Sets revenue_goals - * - * @param bool $revenue_goals revenue_goals - * - * @return self - */ - public function setRevenueGoals($revenue_goals) - { - if (is_null($revenue_goals)) { - throw new \InvalidArgumentException('non-nullable revenue_goals cannot be null'); - } - $this->container['revenue_goals'] = $revenue_goals; - - return $this; - } - - /** - * Gets stats_api - * - * @return bool - */ - public function getStatsApi() - { - return $this->container['stats_api']; - } - - /** - * Sets stats_api - * - * @param bool $stats_api stats_api - * - * @return self - */ - public function setStatsApi($stats_api) - { - if (is_null($stats_api)) { - throw new \InvalidArgumentException('non-nullable stats_api cannot be null'); - } - $this->container['stats_api'] = $stats_api; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } + 'stats_api' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'funnels' => 'Funnels', + 'goals' => 'Goals', + 'props' => 'Props', + 'revenue_goals' => 'RevenueGoals', + 'stats_api' => 'StatsAPI', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'funnels' => 'setFunnels', + 'goals' => 'setGoals', + 'props' => 'setProps', + 'revenue_goals' => 'setRevenueGoals', + 'stats_api' => 'setStatsApi', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'funnels' => 'getFunnels', + 'goals' => 'getGoals', + 'props' => 'getProps', + 'revenue_goals' => 'getRevenueGoals', + 'stats_api' => 'getStatsApi', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'funnels', $data ?? [], null ); + $this->setIfExists( 'goals', $data ?? [], null ); + $this->setIfExists( 'props', $data ?? [], null ); + $this->setIfExists( 'revenue_goals', $data ?? [], null ); + $this->setIfExists( 'stats_api', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'funnels' ] === null ) { + $invalidProperties[] = "'funnels' can't be null"; + } + if ( $this->container[ 'goals' ] === null ) { + $invalidProperties[] = "'goals' can't be null"; + } + if ( $this->container[ 'props' ] === null ) { + $invalidProperties[] = "'props' can't be null"; + } + if ( $this->container[ 'revenue_goals' ] === null ) { + $invalidProperties[] = "'revenue_goals' can't be null"; + } + if ( $this->container[ 'stats_api' ] === null ) { + $invalidProperties[] = "'stats_api' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets funnels + * @return bool + */ + public function getFunnels() { + return $this->container[ 'funnels' ]; + } + + /** + * Sets funnels + * + * @param bool $funnels funnels + * + * @return self + */ + public function setFunnels( $funnels ) { + if ( is_null( $funnels ) ) { + throw new \InvalidArgumentException( 'non-nullable funnels cannot be null' ); + } + $this->container[ 'funnels' ] = $funnels; + + return $this; + } + + /** + * Gets goals + * @return bool + */ + public function getGoals() { + return $this->container[ 'goals' ]; + } + + /** + * Sets goals + * + * @param bool $goals goals + * + * @return self + */ + public function setGoals( $goals ) { + if ( is_null( $goals ) ) { + throw new \InvalidArgumentException( 'non-nullable goals cannot be null' ); + } + $this->container[ 'goals' ] = $goals; + + return $this; + } + + /** + * Gets props + * @return bool + */ + public function getProps() { + return $this->container[ 'props' ]; + } + + /** + * Sets props + * + * @param bool $props props + * + * @return self + */ + public function setProps( $props ) { + if ( is_null( $props ) ) { + throw new \InvalidArgumentException( 'non-nullable props cannot be null' ); + } + $this->container[ 'props' ] = $props; + + return $this; + } + + /** + * Gets revenue_goals + * @return bool + */ + public function getRevenueGoals() { + return $this->container[ 'revenue_goals' ]; + } + + /** + * Sets revenue_goals + * + * @param bool $revenue_goals revenue_goals + * + * @return self + */ + public function setRevenueGoals( $revenue_goals ) { + if ( is_null( $revenue_goals ) ) { + throw new \InvalidArgumentException( 'non-nullable revenue_goals cannot be null' ); + } + $this->container[ 'revenue_goals' ] = $revenue_goals; + + return $this; + } + + /** + * Gets stats_api + * @return bool + */ + public function getStatsApi() { + return $this->container[ 'stats_api' ]; + } + + /** + * Sets stats_api + * + * @param bool $stats_api stats_api + * + * @return self + */ + public function setStatsApi( $stats_api ) { + if ( is_null( $stats_api ) ) { + throw new \InvalidArgumentException( 'non-nullable stats_api cannot be null' ); + } + $this->container[ 'stats_api' ] = $stats_api; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/CustomProp.php b/src/Client/lib/Model/CustomProp.php index 19f26c66..8c59b5fe 100644 --- a/src/Client/lib/Model/CustomProp.php +++ b/src/Client/lib/Model/CustomProp.php @@ -1,9 +1,7 @@ */ -class CustomProp implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_prop' => '\Plausible\Analytics\WP\Client\Model\CustomPropCustomProp' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_prop' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_prop' => 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_prop' => 'custom_prop' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_prop' => 'setCustomProp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_prop' => 'getCustomProp' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_prop', $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['custom_prop'] === null) { - $invalidProperties[] = "'custom_prop' 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 custom_prop - * - * @return \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp - */ - public function getCustomProp() - { - return $this->container['custom_prop']; - } - - /** - * Sets custom_prop - * - * @param \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp $custom_prop custom_prop - * - * @return self - */ - public function setCustomProp($custom_prop) - { - if (is_null($custom_prop)) { - throw new \InvalidArgumentException('non-nullable custom_prop cannot be null'); - } - $this->container['custom_prop'] = $custom_prop; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class CustomProp implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'CustomProp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_prop' => '\Plausible\Analytics\WP\Client\Model\CustomPropCustomProp', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_prop' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_prop' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'custom_prop' => 'custom_prop', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'custom_prop' => 'setCustomProp', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'custom_prop' => 'getCustomProp', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_prop', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'custom_prop' ] === null ) { + $invalidProperties[] = "'custom_prop' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets custom_prop + * @return \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp + */ + public function getCustomProp() { + return $this->container[ 'custom_prop' ]; + } + + /** + * Sets custom_prop + * + * @param \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp $custom_prop custom_prop + * + * @return self + */ + public function setCustomProp( $custom_prop ) { + if ( is_null( $custom_prop ) ) { + throw new \InvalidArgumentException( 'non-nullable custom_prop cannot be null' ); + } + $this->container[ 'custom_prop' ] = $custom_prop; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/CustomPropCustomProp.php b/src/Client/lib/Model/CustomPropCustomProp.php index db4a0cbe..fc5cd4c9 100644 --- a/src/Client/lib/Model/CustomPropCustomProp.php +++ b/src/Client/lib/Model/CustomPropCustomProp.php @@ -1,9 +1,7 @@ */ -class CustomPropCustomProp implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp_custom_prop'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'key' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'key' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - '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 = [ - 'key' => 'key' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'key' => 'setKey' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'key' => 'getKey' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('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 = []; - - if ($this->container['key'] === null) { - $invalidProperties[] = "'key' 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 key - * - * @return string - */ - public function getKey() - { - return $this->container['key']; - } - - /** - * Sets key - * - * @param string $key Custom Property 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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class CustomPropCustomProp implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'CustomProp_custom_prop'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'key' => 'key', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( '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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'key' ] === null ) { + $invalidProperties[] = "'key' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets key + * @return string + */ + public function getKey() { + return $this->container[ 'key' ]; + } + + /** + * Sets key + * + * @param string $key Custom Property 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; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/CustomPropDisableRequest.php b/src/Client/lib/Model/CustomPropDisableRequest.php index 0abf4b36..064955ca 100644 --- a/src/Client/lib/Model/CustomPropDisableRequest.php +++ b/src/Client/lib/Model/CustomPropDisableRequest.php @@ -1,9 +1,7 @@ */ -class CustomPropDisableRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp.DisableRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]', - 'custom_prop' => '\Plausible\Analytics\WP\Client\Model\CustomPropCustomProp' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null, - 'custom_prop' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => false, - 'custom_prop' => 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_props' => 'custom_props', - 'custom_prop' => 'custom_prop' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - 'custom_prop' => 'setCustomProp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - 'custom_prop' => 'getCustomProp' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $data ?? [], null); - $this->setIfExists('custom_prop', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' can't be null"; - } - if ((count($this->container['custom_props']) < 1)) { - $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; - } - - if ($this->container['custom_prop'] === null) { - $invalidProperties[] = "'custom_prop' 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 custom_props - * - * @return \Plausible\Analytics\WP\Client\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - - - if ((count($custom_props) < 1)) { - throw new \InvalidArgumentException('invalid length for $custom_props when calling CustomPropDisableRequest., number of items must be greater than or equal to 1.'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - - /** - * Gets custom_prop - * - * @return \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp - */ - public function getCustomProp() - { - return $this->container['custom_prop']; - } - - /** - * Sets custom_prop - * - * @param \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp $custom_prop custom_prop - * - * @return self - */ - public function setCustomProp($custom_prop) - { - if (is_null($custom_prop)) { - throw new \InvalidArgumentException('non-nullable custom_prop cannot be null'); - } - $this->container['custom_prop'] = $custom_prop; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class CustomPropDisableRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'CustomProp.DisableRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]', + 'custom_prop' => '\Plausible\Analytics\WP\Client\Model\CustomPropCustomProp', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_props' => null, + 'custom_prop' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_props' => false, + 'custom_prop' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + 'custom_prop' => 'custom_prop', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'custom_props' => 'setCustomProps', + 'custom_prop' => 'setCustomProp', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'custom_props' => 'getCustomProps', + 'custom_prop' => 'getCustomProp', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $data ?? [], null ); + $this->setIfExists( 'custom_prop', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'custom_props' ] === null ) { + $invalidProperties[] = "'custom_props' can't be null"; + } + if ( ( count( $this->container[ 'custom_props' ] ) < 1 ) ) { + $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; + } + + if ( $this->container[ 'custom_prop' ] === null ) { + $invalidProperties[] = "'custom_prop' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets custom_props + * @return \Plausible\Analytics\WP\Client\Model\CustomProp[] + */ + public function getCustomProps() { + return $this->container[ 'custom_props' ]; + } + + /** + * Sets custom_props + * + * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props + * + * @return self + */ + public function setCustomProps( $custom_props ) { + if ( is_null( $custom_props ) ) { + throw new \InvalidArgumentException( 'non-nullable custom_props cannot be null' ); + } + + if ( ( count( $custom_props ) < 1 ) ) { + throw new \InvalidArgumentException( + 'invalid length for $custom_props when calling CustomPropDisableRequest., number of items must be greater than or equal to 1.' + ); + } + $this->container[ 'custom_props' ] = $custom_props; + + return $this; + } + + /** + * Gets custom_prop + * @return \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp + */ + public function getCustomProp() { + return $this->container[ 'custom_prop' ]; + } + + /** + * Sets custom_prop + * + * @param \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp $custom_prop custom_prop + * + * @return self + */ + public function setCustomProp( $custom_prop ) { + if ( is_null( $custom_prop ) ) { + throw new \InvalidArgumentException( 'non-nullable custom_prop cannot be null' ); + } + $this->container[ 'custom_prop' ] = $custom_prop; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php b/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php index 32cdacc8..67806820 100644 --- a/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php +++ b/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php @@ -1,9 +1,7 @@ */ -class CustomPropDisableRequestBulkDisable implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp_DisableRequest_BulkDisable'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => 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_props' => 'custom_props' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' can't be null"; - } - if ((count($this->container['custom_props']) < 1)) { - $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; - } - - 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_props - * - * @return \Plausible\Analytics\WP\Client\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - - - if ((count($custom_props) < 1)) { - throw new \InvalidArgumentException('invalid length for $custom_props when calling CustomPropDisableRequestBulkDisable., number of items must be greater than or equal to 1.'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class CustomPropDisableRequestBulkDisable implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'CustomProp_DisableRequest_BulkDisable'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_props' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_props' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'custom_props' => 'setCustomProps', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'custom_props' => 'getCustomProps', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'custom_props' ] === null ) { + $invalidProperties[] = "'custom_props' can't be null"; + } + if ( ( count( $this->container[ 'custom_props' ] ) < 1 ) ) { + $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets custom_props + * @return \Plausible\Analytics\WP\Client\Model\CustomProp[] + */ + public function getCustomProps() { + return $this->container[ 'custom_props' ]; + } + + /** + * Sets custom_props + * + * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props + * + * @return self + */ + public function setCustomProps( $custom_props ) { + if ( is_null( $custom_props ) ) { + throw new \InvalidArgumentException( 'non-nullable custom_props cannot be null' ); + } + + if ( ( count( $custom_props ) < 1 ) ) { + throw new \InvalidArgumentException( + 'invalid length for $custom_props when calling CustomPropDisableRequestBulkDisable., number of items must be greater than or equal to 1.' + ); + } + $this->container[ 'custom_props' ] = $custom_props; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/CustomPropEnableRequest.php b/src/Client/lib/Model/CustomPropEnableRequest.php index 8b660dae..cff292c5 100644 --- a/src/Client/lib/Model/CustomPropEnableRequest.php +++ b/src/Client/lib/Model/CustomPropEnableRequest.php @@ -1,9 +1,7 @@ */ -class CustomPropEnableRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp.EnableRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]', - 'custom_prop' => '\Plausible\Analytics\WP\Client\Model\CustomPropCustomProp' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null, - 'custom_prop' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => false, - 'custom_prop' => 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_props' => 'custom_props', - 'custom_prop' => 'custom_prop' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - 'custom_prop' => 'setCustomProp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - 'custom_prop' => 'getCustomProp' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $data ?? [], null); - $this->setIfExists('custom_prop', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' can't be null"; - } - if ((count($this->container['custom_props']) < 1)) { - $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; - } - - if ($this->container['custom_prop'] === null) { - $invalidProperties[] = "'custom_prop' 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 custom_props - * - * @return \Plausible\Analytics\WP\Client\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - - - if ((count($custom_props) < 1)) { - throw new \InvalidArgumentException('invalid length for $custom_props when calling CustomPropEnableRequest., number of items must be greater than or equal to 1.'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - - /** - * Gets custom_prop - * - * @return \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp - */ - public function getCustomProp() - { - return $this->container['custom_prop']; - } - - /** - * Sets custom_prop - * - * @param \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp $custom_prop custom_prop - * - * @return self - */ - public function setCustomProp($custom_prop) - { - if (is_null($custom_prop)) { - throw new \InvalidArgumentException('non-nullable custom_prop cannot be null'); - } - $this->container['custom_prop'] = $custom_prop; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class CustomPropEnableRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'CustomProp.EnableRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]', + 'custom_prop' => '\Plausible\Analytics\WP\Client\Model\CustomPropCustomProp', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_props' => null, + 'custom_prop' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_props' => false, + 'custom_prop' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + 'custom_prop' => 'custom_prop', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'custom_props' => 'setCustomProps', + 'custom_prop' => 'setCustomProp', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'custom_props' => 'getCustomProps', + 'custom_prop' => 'getCustomProp', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $data ?? [], null ); + $this->setIfExists( 'custom_prop', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'custom_props' ] === null ) { + $invalidProperties[] = "'custom_props' can't be null"; + } + if ( ( count( $this->container[ 'custom_props' ] ) < 1 ) ) { + $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; + } + + if ( $this->container[ 'custom_prop' ] === null ) { + $invalidProperties[] = "'custom_prop' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets custom_props + * @return \Plausible\Analytics\WP\Client\Model\CustomProp[] + */ + public function getCustomProps() { + return $this->container[ 'custom_props' ]; + } + + /** + * Sets custom_props + * + * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props + * + * @return self + */ + public function setCustomProps( $custom_props ) { + if ( is_null( $custom_props ) ) { + throw new \InvalidArgumentException( 'non-nullable custom_props cannot be null' ); + } + + if ( ( count( $custom_props ) < 1 ) ) { + throw new \InvalidArgumentException( + 'invalid length for $custom_props when calling CustomPropEnableRequest., number of items must be greater than or equal to 1.' + ); + } + $this->container[ 'custom_props' ] = $custom_props; + + return $this; + } + + /** + * Gets custom_prop + * @return \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp + */ + public function getCustomProp() { + return $this->container[ 'custom_prop' ]; + } + + /** + * Sets custom_prop + * + * @param \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp $custom_prop custom_prop + * + * @return self + */ + public function setCustomProp( $custom_prop ) { + if ( is_null( $custom_prop ) ) { + throw new \InvalidArgumentException( 'non-nullable custom_prop cannot be null' ); + } + $this->container[ 'custom_prop' ] = $custom_prop; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/CustomPropListResponse.php b/src/Client/lib/Model/CustomPropListResponse.php index b9cd2502..ac044c78 100644 --- a/src/Client/lib/Model/CustomPropListResponse.php +++ b/src/Client/lib/Model/CustomPropListResponse.php @@ -1,9 +1,7 @@ */ -class CustomPropListResponse implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp.ListResponse'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => 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_props' => 'custom_props' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' 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 custom_props - * - * @return \Plausible\Analytics\WP\Client\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class CustomPropListResponse implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'CustomProp.ListResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_props' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_props' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'custom_props' => 'setCustomProps', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'custom_props' => 'getCustomProps', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'custom_props' ] === null ) { + $invalidProperties[] = "'custom_props' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets custom_props + * @return \Plausible\Analytics\WP\Client\Model\CustomProp[] + */ + public function getCustomProps() { + return $this->container[ 'custom_props' ]; + } + + /** + * Sets custom_props + * + * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props + * + * @return self + */ + public function setCustomProps( $custom_props ) { + if ( is_null( $custom_props ) ) { + throw new \InvalidArgumentException( 'non-nullable custom_props cannot be null' ); + } + $this->container[ 'custom_props' ] = $custom_props; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/Goal.php b/src/Client/lib/Model/Goal.php index 67cd61aa..accc7402 100644 --- a/src/Client/lib/Model/Goal.php +++ b/src/Client/lib/Model/Goal.php @@ -1,9 +1,7 @@ */ -class Goal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'goal_type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_type' => 'string', - 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_type' => null, - 'goal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_type' => false, - 'goal' => 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 = [ - 'goal_type' => 'goal_type', - 'goal' => 'goal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_type', $data ?? [], null); - $this->setIfExists('goal', $data ?? [], null); - - // Initialize discriminator property with the model name. - $this->container['goal_type'] = static::$openAPIModelName; - } - - /** - * 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['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - if ($this->container['goal'] === null) { - $invalidProperties[] = "'goal' 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 goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - - /** - * Gets goal - * - * @return \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class Goal implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = 'goal_type'; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Goal'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'goal_type' => 'string', + 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'goal_type' => null, + 'goal' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'goal_type' => false, + 'goal' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'goal_type' => 'goal_type', + 'goal' => 'goal', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'goal_type' => 'setGoalType', + 'goal' => 'setGoal', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'goal_type' => 'getGoalType', + 'goal' => 'getGoal', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_type', $data ?? [], null ); + $this->setIfExists( 'goal', $data ?? [], null ); + + // Initialize discriminator property with the model name. + $this->container[ 'goal_type' ] = static::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'goal_type' ] === null ) { + $invalidProperties[] = "'goal_type' can't be null"; + } + if ( $this->container[ 'goal' ] === null ) { + $invalidProperties[] = "'goal' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets goal_type + * @return string + */ + public function getGoalType() { + return $this->container[ 'goal_type' ]; + } + + /** + * Sets goal_type + * + * @param string $goal_type goal_type + * + * @return self + */ + public function setGoalType( $goal_type ) { + if ( is_null( $goal_type ) ) { + throw new \InvalidArgumentException( 'non-nullable goal_type cannot be null' ); + } + $this->container[ 'goal_type' ] = $goal_type; + + return $this; + } + + /** + * Gets goal + * @return \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal + */ + public function getGoal() { + return $this->container[ 'goal' ]; + } + + /** + * Sets goal + * + * @param \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal $goal goal + * + * @return self + */ + public function setGoal( $goal ) { + if ( is_null( $goal ) ) { + throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); + } + $this->container[ 'goal' ] = $goal; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/GoalCreateRequestCustomEvent.php b/src/Client/lib/Model/GoalCreateRequestCustomEvent.php index c80366c2..2b9134eb 100644 --- a/src/Client/lib/Model/GoalCreateRequestCustomEvent.php +++ b/src/Client/lib/Model/GoalCreateRequestCustomEvent.php @@ -1,9 +1,7 @@ */ -class GoalCreateRequestCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.CreateRequest.CustomEvent'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalCreateRequestCustomEventGoal', - 'goal_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal' => null, - 'goal_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal' => false, - 'goal_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 = [ - 'goal' => 'goal', - 'goal_type' => 'goal_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType' - ]; - - /** - * 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; - } - - public const GOAL_TYPE_GOAL_CUSTOM_EVENT = 'Goal.CustomEvent'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getGoalTypeAllowableValues() - { - return [ - self::GOAL_TYPE_GOAL_CUSTOM_EVENT, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal', $data ?? [], null); - $this->setIfExists('goal_type', $data ?? [], 'Goal.CustomEvent'); - } - - /** - * 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['goal'] === null) { - $invalidProperties[] = "'goal' can't be null"; - } - if ($this->container['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!is_null($this->container['goal_type']) && !in_array($this->container['goal_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'goal_type', must be one of '%s'", - $this->container['goal_type'], - implode("', '", $allowedValues) - ); - } - - 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 goal - * - * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestCustomEventGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequestCustomEventGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - - /** - * Gets goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!in_array($goal_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'goal_type', must be one of '%s'", - $goal_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class GoalCreateRequestCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + public const GOAL_TYPE_GOAL_CUSTOM_EVENT = 'Goal.CustomEvent'; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Goal.CreateRequest.CustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalCreateRequestCustomEventGoal', + 'goal_type' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'goal' => null, + 'goal_type' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'goal' => false, + 'goal_type' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'goal' => 'goal', + 'goal_type' => 'goal_type', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'goal' => 'setGoal', + 'goal_type' => 'setGoalType', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'goal' => 'getGoal', + 'goal_type' => 'getGoalType', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'goal', $data ?? [], null ); + $this->setIfExists( 'goal_type', $data ?? [], 'Goal.CustomEvent' ); + } + + /** + * 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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'goal' ] === null ) { + $invalidProperties[] = "'goal' can't be null"; + } + if ( $this->container[ 'goal_type' ] === null ) { + $invalidProperties[] = "'goal_type' can't be null"; + } + $allowedValues = $this->getGoalTypeAllowableValues(); + if ( ! is_null( $this->container[ 'goal_type' ] ) && ! in_array( $this->container[ 'goal_type' ], $allowedValues, true ) ) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'goal_type', must be one of '%s'", + $this->container[ 'goal_type' ], + implode( "', '", $allowedValues ) + ); + } + + return $invalidProperties; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getGoalTypeAllowableValues() { + return [ + self::GOAL_TYPE_GOAL_CUSTOM_EVENT, + ]; + } + + /** + * Gets goal + * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestCustomEventGoal + */ + public function getGoal() { + return $this->container[ 'goal' ]; + } + + /** + * Sets goal + * + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequestCustomEventGoal $goal goal + * + * @return self + */ + public function setGoal( $goal ) { + if ( is_null( $goal ) ) { + throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); + } + $this->container[ 'goal' ] = $goal; + + return $this; + } + + /** + * Gets goal_type + * @return string + */ + public function getGoalType() { + return $this->container[ 'goal_type' ]; + } + + /** + * Sets goal_type + * + * @param string $goal_type goal_type + * + * @return self + */ + public function setGoalType( $goal_type ) { + if ( is_null( $goal_type ) ) { + throw new \InvalidArgumentException( 'non-nullable goal_type cannot be null' ); + } + $allowedValues = $this->getGoalTypeAllowableValues(); + if ( ! in_array( $goal_type, $allowedValues, true ) ) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'goal_type', must be one of '%s'", + $goal_type, + implode( "', '", $allowedValues ) + ) + ); + } + $this->container[ 'goal_type' ] = $goal_type; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/GoalCreateRequestRevenue.php b/src/Client/lib/Model/GoalCreateRequestRevenue.php index 58940d70..c95f4a61 100644 --- a/src/Client/lib/Model/GoalCreateRequestRevenue.php +++ b/src/Client/lib/Model/GoalCreateRequestRevenue.php @@ -1,9 +1,7 @@ */ -class GoalCreateRequestRevenue implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.CreateRequest.Revenue'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalCreateRequestRevenueGoal', - 'goal_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal' => null, - 'goal_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal' => false, - 'goal_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 = [ - 'goal' => 'goal', - 'goal_type' => 'goal_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType' - ]; - - /** - * 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; - } - - public const GOAL_TYPE_GOAL_REVENUE = 'Goal.Revenue'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getGoalTypeAllowableValues() - { - return [ - self::GOAL_TYPE_GOAL_REVENUE, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal', $data ?? [], null); - $this->setIfExists('goal_type', $data ?? [], 'Goal.Revenue'); - } - - /** - * 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['goal'] === null) { - $invalidProperties[] = "'goal' can't be null"; - } - if ($this->container['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!is_null($this->container['goal_type']) && !in_array($this->container['goal_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'goal_type', must be one of '%s'", - $this->container['goal_type'], - implode("', '", $allowedValues) - ); - } - - 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 goal - * - * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestRevenueGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequestRevenueGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - - /** - * Gets goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!in_array($goal_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'goal_type', must be one of '%s'", - $goal_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class GoalCreateRequestRevenue implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + public const GOAL_TYPE_GOAL_REVENUE = 'Goal.Revenue'; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Goal.CreateRequest.Revenue'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalCreateRequestRevenueGoal', + 'goal_type' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'goal' => null, + 'goal_type' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'goal' => false, + 'goal_type' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'goal' => 'goal', + 'goal_type' => 'goal_type', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'goal' => 'setGoal', + 'goal_type' => 'setGoalType', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'goal' => 'getGoal', + 'goal_type' => 'getGoalType', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'goal', $data ?? [], null ); + $this->setIfExists( 'goal_type', $data ?? [], 'Goal.Revenue' ); + } + + /** + * 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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'goal' ] === null ) { + $invalidProperties[] = "'goal' can't be null"; + } + if ( $this->container[ 'goal_type' ] === null ) { + $invalidProperties[] = "'goal_type' can't be null"; + } + $allowedValues = $this->getGoalTypeAllowableValues(); + if ( ! is_null( $this->container[ 'goal_type' ] ) && ! in_array( $this->container[ 'goal_type' ], $allowedValues, true ) ) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'goal_type', must be one of '%s'", + $this->container[ 'goal_type' ], + implode( "', '", $allowedValues ) + ); + } + + return $invalidProperties; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getGoalTypeAllowableValues() { + return [ + self::GOAL_TYPE_GOAL_REVENUE, + ]; + } + + /** + * Gets goal + * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestRevenueGoal + */ + public function getGoal() { + return $this->container[ 'goal' ]; + } + + /** + * Sets goal + * + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequestRevenueGoal $goal goal + * + * @return self + */ + public function setGoal( $goal ) { + if ( is_null( $goal ) ) { + throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); + } + $this->container[ 'goal' ] = $goal; + + return $this; + } + + /** + * Gets goal_type + * @return string + */ + public function getGoalType() { + return $this->container[ 'goal_type' ]; + } + + /** + * Sets goal_type + * + * @param string $goal_type goal_type + * + * @return self + */ + public function setGoalType( $goal_type ) { + if ( is_null( $goal_type ) ) { + throw new \InvalidArgumentException( 'non-nullable goal_type cannot be null' ); + } + $allowedValues = $this->getGoalTypeAllowableValues(); + if ( ! in_array( $goal_type, $allowedValues, true ) ) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'goal_type', must be one of '%s'", + $goal_type, + implode( "', '", $allowedValues ) + ) + ); + } + $this->container[ 'goal_type' ] = $goal_type; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/GoalCustomEvent.php b/src/Client/lib/Model/GoalCustomEvent.php index f5bcf975..4fc6b275 100644 --- a/src/Client/lib/Model/GoalCustomEvent.php +++ b/src/Client/lib/Model/GoalCustomEvent.php @@ -1,9 +1,7 @@ */ -class GoalCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.CustomEvent'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_type' => 'string', - 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalCustomEventAllOfGoal' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_type' => null, - 'goal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_type' => false, - 'goal' => 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 = [ - 'goal_type' => 'goal_type', - 'goal' => 'goal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_type', $data ?? [], null); - $this->setIfExists('goal', $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['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - if ($this->container['goal'] === null) { - $invalidProperties[] = "'goal' 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 goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - - /** - * Gets goal - * - * @return \Plausible\Analytics\WP\Client\Model\GoalCustomEventAllOfGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \Plausible\Analytics\WP\Client\Model\GoalCustomEventAllOfGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class GoalCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Goal.CustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'goal_type' => 'string', + 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalCustomEventAllOfGoal', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'goal_type' => null, + 'goal' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'goal_type' => false, + 'goal' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'goal_type' => 'goal_type', + 'goal' => 'goal', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'goal_type' => 'setGoalType', + 'goal' => 'setGoal', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'goal_type' => 'getGoalType', + 'goal' => 'getGoal', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_type', $data ?? [], null ); + $this->setIfExists( 'goal', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'goal_type' ] === null ) { + $invalidProperties[] = "'goal_type' can't be null"; + } + if ( $this->container[ 'goal' ] === null ) { + $invalidProperties[] = "'goal' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets goal_type + * @return string + */ + public function getGoalType() { + return $this->container[ 'goal_type' ]; + } + + /** + * Sets goal_type + * + * @param string $goal_type goal_type + * + * @return self + */ + public function setGoalType( $goal_type ) { + if ( is_null( $goal_type ) ) { + throw new \InvalidArgumentException( 'non-nullable goal_type cannot be null' ); + } + $this->container[ 'goal_type' ] = $goal_type; + + return $this; + } + + /** + * Gets goal + * @return \Plausible\Analytics\WP\Client\Model\GoalCustomEventAllOfGoal + */ + public function getGoal() { + return $this->container[ 'goal' ]; + } + + /** + * Sets goal + * + * @param \Plausible\Analytics\WP\Client\Model\GoalCustomEventAllOfGoal $goal goal + * + * @return self + */ + public function setGoal( $goal ) { + if ( is_null( $goal ) ) { + throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); + } + $this->container[ 'goal' ] = $goal; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/GoalDeleteBulkRequest.php b/src/Client/lib/Model/GoalDeleteBulkRequest.php index dedff091..7e861462 100644 --- a/src/Client/lib/Model/GoalDeleteBulkRequest.php +++ b/src/Client/lib/Model/GoalDeleteBulkRequest.php @@ -1,9 +1,7 @@ */ -class GoalDeleteBulkRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.DeleteBulkRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_ids' => 'int[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_ids' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_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 = [ - 'goal_ids' => 'goal_ids' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_ids' => 'setGoalIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_ids' => 'getGoalIds' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_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 = []; - - if ($this->container['goal_ids'] === null) { - $invalidProperties[] = "'goal_ids' can't be null"; - } - if ((count($this->container['goal_ids']) > 8)) { - $invalidProperties[] = "invalid value for 'goal_ids', number of items must be less than or equal to 8."; - } - - if ((count($this->container['goal_ids']) < 1)) { - $invalidProperties[] = "invalid value for 'goal_ids', number of items must be greater than or equal to 1."; - } - - 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 goal_ids - * - * @return int[] - */ - public function getGoalIds() - { - return $this->container['goal_ids']; - } - - /** - * Sets goal_ids - * - * @param int[] $goal_ids goal_ids - * - * @return self - */ - public function setGoalIds($goal_ids) - { - if (is_null($goal_ids)) { - throw new \InvalidArgumentException('non-nullable goal_ids cannot be null'); - } - - if ((count($goal_ids) > 8)) { - throw new \InvalidArgumentException('invalid value for $goal_ids when calling GoalDeleteBulkRequest., number of items must be less than or equal to 8.'); - } - if ((count($goal_ids) < 1)) { - throw new \InvalidArgumentException('invalid length for $goal_ids when calling GoalDeleteBulkRequest., number of items must be greater than or equal to 1.'); - } - $this->container['goal_ids'] = $goal_ids; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class GoalDeleteBulkRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Goal.DeleteBulkRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'goal_ids' => 'int[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'goal_ids' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'goal_ids' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'goal_ids' => 'goal_ids', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'goal_ids' => 'setGoalIds', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'goal_ids' => 'getGoalIds', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'goal_ids' ] === null ) { + $invalidProperties[] = "'goal_ids' can't be null"; + } + if ( ( count( $this->container[ 'goal_ids' ] ) > 8 ) ) { + $invalidProperties[] = "invalid value for 'goal_ids', number of items must be less than or equal to 8."; + } + + if ( ( count( $this->container[ 'goal_ids' ] ) < 1 ) ) { + $invalidProperties[] = "invalid value for 'goal_ids', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Gets goal_ids + * @return int[] + */ + public function getGoalIds() { + return $this->container[ 'goal_ids' ]; + } + + /** + * Sets goal_ids + * + * @param int[] $goal_ids goal_ids + * + * @return self + */ + public function setGoalIds( $goal_ids ) { + if ( is_null( $goal_ids ) ) { + throw new \InvalidArgumentException( 'non-nullable goal_ids cannot be null' ); + } + + if ( ( count( $goal_ids ) > 8 ) ) { + throw new \InvalidArgumentException( + 'invalid value for $goal_ids when calling GoalDeleteBulkRequest., number of items must be less than or equal to 8.' + ); + } + if ( ( count( $goal_ids ) < 1 ) ) { + throw new \InvalidArgumentException( + 'invalid length for $goal_ids when calling GoalDeleteBulkRequest., number of items must be greater than or equal to 1.' + ); + } + $this->container[ 'goal_ids' ] = $goal_ids; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/GoalListResponseMeta.php b/src/Client/lib/Model/GoalListResponseMeta.php index 8cef2102..67cda5ec 100644 --- a/src/Client/lib/Model/GoalListResponseMeta.php +++ b/src/Client/lib/Model/GoalListResponseMeta.php @@ -1,9 +1,7 @@ */ -class GoalListResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_ListResponse_meta'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'pagination' => '\Plausible\Analytics\WP\Client\Model\PaginationMetadata' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'pagination' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'pagination' => 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 = [ - 'pagination' => 'pagination' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'pagination' => 'setPagination' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - '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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $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 = []; - - if ($this->container['pagination'] === null) { - $invalidProperties[] = "'pagination' 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 pagination - * - * @return \Plausible\Analytics\WP\Client\Model\PaginationMetadata - */ - public function getPagination() - { - return $this->container['pagination']; - } - - /** - * Sets pagination - * - * @param \Plausible\Analytics\WP\Client\Model\PaginationMetadata $pagination pagination - * - * @return self - */ - public function setPagination($pagination) - { - if (is_null($pagination)) { - throw new \InvalidArgumentException('non-nullable pagination cannot be null'); - } - $this->container['pagination'] = $pagination; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class GoalListResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Goal_ListResponse_meta'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'pagination' => '\Plausible\Analytics\WP\Client\Model\PaginationMetadata', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'pagination' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pagination' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'pagination' => 'pagination', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'pagination' => 'setPagination', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'pagination' => 'getPagination', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'pagination' ] === null ) { + $invalidProperties[] = "'pagination' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets pagination + * @return \Plausible\Analytics\WP\Client\Model\PaginationMetadata + */ + public function getPagination() { + return $this->container[ 'pagination' ]; + } + + /** + * Sets pagination + * + * @param \Plausible\Analytics\WP\Client\Model\PaginationMetadata $pagination pagination + * + * @return self + */ + public function setPagination( $pagination ) { + if ( is_null( $pagination ) ) { + throw new \InvalidArgumentException( 'non-nullable pagination cannot be null' ); + } + $this->container[ 'pagination' ] = $pagination; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/GoalPageview.php b/src/Client/lib/Model/GoalPageview.php index 043a388c..d4f2e9b3 100644 --- a/src/Client/lib/Model/GoalPageview.php +++ b/src/Client/lib/Model/GoalPageview.php @@ -1,9 +1,7 @@ */ -class GoalPageview implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.Pageview'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_type' => 'string', - 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_type' => null, - 'goal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_type' => false, - 'goal' => 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 = [ - 'goal_type' => 'goal_type', - 'goal' => 'goal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_type', $data ?? [], null); - $this->setIfExists('goal', $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['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - if ($this->container['goal'] === null) { - $invalidProperties[] = "'goal' 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 goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - - /** - * Gets goal - * - * @return \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class GoalPageview implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Goal.Pageview'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'goal_type' => 'string', + 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'goal_type' => null, + 'goal' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'goal_type' => false, + 'goal' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'goal_type' => 'goal_type', + 'goal' => 'goal', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'goal_type' => 'setGoalType', + 'goal' => 'setGoal', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'goal_type' => 'getGoalType', + 'goal' => 'getGoal', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_type', $data ?? [], null ); + $this->setIfExists( 'goal', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'goal_type' ] === null ) { + $invalidProperties[] = "'goal_type' can't be null"; + } + if ( $this->container[ 'goal' ] === null ) { + $invalidProperties[] = "'goal' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets goal_type + * @return string + */ + public function getGoalType() { + return $this->container[ 'goal_type' ]; + } + + /** + * Sets goal_type + * + * @param string $goal_type goal_type + * + * @return self + */ + public function setGoalType( $goal_type ) { + if ( is_null( $goal_type ) ) { + throw new \InvalidArgumentException( 'non-nullable goal_type cannot be null' ); + } + $this->container[ 'goal_type' ] = $goal_type; + + return $this; + } + + /** + * Gets goal + * @return \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal + */ + public function getGoal() { + return $this->container[ 'goal' ]; + } + + /** + * Sets goal + * + * @param \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal $goal goal + * + * @return self + */ + public function setGoal( $goal ) { + if ( is_null( $goal ) ) { + throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); + } + $this->container[ 'goal' ] = $goal; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/GoalRevenueAllOfGoal.php b/src/Client/lib/Model/GoalRevenueAllOfGoal.php index 7412fb95..8ba482f8 100644 --- a/src/Client/lib/Model/GoalRevenueAllOfGoal.php +++ b/src/Client/lib/Model/GoalRevenueAllOfGoal.php @@ -1,9 +1,7 @@ */ -class GoalRevenueAllOfGoal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_Revenue_allOf_goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'currency' => 'string', - 'display_name' => 'string', - 'event_name' => 'string', - 'id' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'currency' => null, - 'display_name' => null, - 'event_name' => null, - 'id' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'currency' => false, +class GoalRevenueAllOfGoal implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'Goal_Revenue_allOf_goal'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'currency' => 'string', + 'display_name' => 'string', + 'event_name' => 'string', + 'id' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'display_name' => null, + 'event_name' => null, + 'id' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'currency' => false, 'display_name' => false, - 'event_name' => false, - '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 = [ - 'currency' => 'currency', - 'display_name' => 'display_name', - 'event_name' => 'event_name', - 'id' => 'id' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'currency' => 'setCurrency', - 'display_name' => 'setDisplayName', - 'event_name' => 'setEventName', - 'id' => 'setId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'currency' => 'getCurrency', - 'display_name' => 'getDisplayName', - 'event_name' => 'getEventName', - 'id' => 'getId' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('currency', $data ?? [], null); - $this->setIfExists('display_name', $data ?? [], null); - $this->setIfExists('event_name', $data ?? [], null); - $this->setIfExists('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 = []; - - if ($this->container['currency'] === null) { - $invalidProperties[] = "'currency' can't be null"; - } - if ($this->container['display_name'] === null) { - $invalidProperties[] = "'display_name' can't be null"; - } - if ($this->container['event_name'] === null) { - $invalidProperties[] = "'event_name' can't be null"; - } - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' 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 currency - * - * @return string - */ - public function getCurrency() - { - return $this->container['currency']; - } - - /** - * Sets currency - * - * @param string $currency Currency - * - * @return self - */ - public function setCurrency($currency) - { - if (is_null($currency)) { - throw new \InvalidArgumentException('non-nullable currency cannot be null'); - } - $this->container['currency'] = $currency; - - return $this; - } - - /** - * Gets display_name - * - * @return string - */ - public function getDisplayName() - { - return $this->container['display_name']; - } - - /** - * Sets display_name - * - * @param string $display_name Display name - * - * @return self - */ - public function setDisplayName($display_name) - { - if (is_null($display_name)) { - throw new \InvalidArgumentException('non-nullable display_name cannot be null'); - } - $this->container['display_name'] = $display_name; - - return $this; - } - - /** - * Gets event_name - * - * @return string - */ - public function getEventName() - { - return $this->container['event_name']; - } - - /** - * Sets event_name - * - * @param string $event_name Event Name - * - * @return self - */ - public function setEventName($event_name) - { - if (is_null($event_name)) { - throw new \InvalidArgumentException('non-nullable event_name cannot be null'); - } - $this->container['event_name'] = $event_name; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Goal ID - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } + 'event_name' => false, + 'id' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'display_name' => 'display_name', + 'event_name' => 'event_name', + 'id' => 'id', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'display_name' => 'setDisplayName', + 'event_name' => 'setEventName', + 'id' => 'setId', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'display_name' => 'getDisplayName', + 'event_name' => 'getEventName', + 'id' => 'getId', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'currency', $data ?? [], null ); + $this->setIfExists( 'display_name', $data ?? [], null ); + $this->setIfExists( 'event_name', $data ?? [], null ); + $this->setIfExists( '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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'currency' ] === null ) { + $invalidProperties[] = "'currency' can't be null"; + } + if ( $this->container[ 'display_name' ] === null ) { + $invalidProperties[] = "'display_name' can't be null"; + } + if ( $this->container[ 'event_name' ] === null ) { + $invalidProperties[] = "'event_name' can't be null"; + } + if ( $this->container[ 'id' ] === null ) { + $invalidProperties[] = "'id' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets currency + * @return string + */ + public function getCurrency() { + return $this->container[ 'currency' ]; + } + + /** + * Sets currency + * + * @param string $currency Currency + * + * @return self + */ + public function setCurrency( $currency ) { + if ( is_null( $currency ) ) { + throw new \InvalidArgumentException( 'non-nullable currency cannot be null' ); + } + $this->container[ 'currency' ] = $currency; + + return $this; + } + + /** + * Gets display_name + * @return string + */ + public function getDisplayName() { + return $this->container[ 'display_name' ]; + } + + /** + * Sets display_name + * + * @param string $display_name Display name + * + * @return self + */ + public function setDisplayName( $display_name ) { + if ( is_null( $display_name ) ) { + throw new \InvalidArgumentException( 'non-nullable display_name cannot be null' ); + } + $this->container[ 'display_name' ] = $display_name; + + return $this; + } + + /** + * Gets event_name + * @return string + */ + public function getEventName() { + return $this->container[ 'event_name' ]; + } + + /** + * Sets event_name + * + * @param string $event_name Event Name + * + * @return self + */ + public function setEventName( $event_name ) { + if ( is_null( $event_name ) ) { + throw new \InvalidArgumentException( 'non-nullable event_name cannot be null' ); + } + $this->container[ 'event_name' ] = $event_name; + + return $this; + } + + /** + * Gets id + * @return int + */ + public function getId() { + return $this->container[ 'id' ]; + } + + /** + * Sets id + * + * @param int $id Goal ID + * + * @return self + */ + public function setId( $id ) { + if ( is_null( $id ) ) { + throw new \InvalidArgumentException( 'non-nullable id cannot be null' ); + } + $this->container[ 'id' ] = $id; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/PaginationMetadata.php b/src/Client/lib/Model/PaginationMetadata.php index 3c9bbfd5..4a027aab 100644 --- a/src/Client/lib/Model/PaginationMetadata.php +++ b/src/Client/lib/Model/PaginationMetadata.php @@ -1,9 +1,7 @@ */ -class PaginationMetadata implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PaginationMetadata'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'has_next_page' => 'bool', - 'has_prev_page' => 'bool', - 'links' => '\Plausible\Analytics\WP\Client\Model\PaginationMetadataLinks' - ]; - - /** - * 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, - 'links' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'has_next_page' => false, +class PaginationMetadata implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'PaginationMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'has_next_page' => 'bool', + 'has_prev_page' => 'bool', + 'links' => '\Plausible\Analytics\WP\Client\Model\PaginationMetadataLinks', + ]; + + /** + * 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, + 'links' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'has_next_page' => false, 'has_prev_page' => false, - 'links' => 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', - 'links' => 'links' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'has_next_page' => 'setHasNextPage', - 'has_prev_page' => 'setHasPrevPage', - 'links' => 'setLinks' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'has_next_page' => 'getHasNextPage', - 'has_prev_page' => 'getHasPrevPage', - 'links' => 'getLinks' - ]; - - /** - * 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[] $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('links', $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['has_next_page'] === null) { - $invalidProperties[] = "'has_next_page' can't be null"; - } - if ($this->container['has_prev_page'] === null) { - $invalidProperties[] = "'has_prev_page' 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 has_next_page - * - * @return bool - */ - public function getHasNextPage() - { - return $this->container['has_next_page']; - } - - /** - * Sets has_next_page - * - * @param bool $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 - */ - public function getHasPrevPage() - { - return $this->container['has_prev_page']; - } - - /** - * Sets has_prev_page - * - * @param bool $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 links - * - * @return \Plausible\Analytics\WP\Client\Model\PaginationMetadataLinks|null - */ - public function getLinks() - { - return $this->container['links']; - } - - /** - * Sets links - * - * @param \Plausible\Analytics\WP\Client\Model\PaginationMetadataLinks|null $links links - * - * @return self - */ - public function setLinks($links) - { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); - } - $this->container['links'] = $links; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } + 'links' => false, + ]; + + /** + * 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', + 'links' => 'links', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'has_next_page' => 'setHasNextPage', + 'has_prev_page' => 'setHasPrevPage', + 'links' => 'setLinks', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'has_next_page' => 'getHasNextPage', + 'has_prev_page' => 'getHasPrevPage', + 'links' => 'getLinks', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $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( 'links', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'has_next_page' ] === null ) { + $invalidProperties[] = "'has_next_page' can't be null"; + } + if ( $this->container[ 'has_prev_page' ] === null ) { + $invalidProperties[] = "'has_prev_page' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets has_next_page + * @return bool + */ + public function getHasNextPage() { + return $this->container[ 'has_next_page' ]; + } + + /** + * Sets has_next_page + * + * @param bool $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 + */ + public function getHasPrevPage() { + return $this->container[ 'has_prev_page' ]; + } + + /** + * Sets has_prev_page + * + * @param bool $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 links + * @return \Plausible\Analytics\WP\Client\Model\PaginationMetadataLinks|null + */ + public function getLinks() { + return $this->container[ 'links' ]; + } + + /** + * Sets links + * + * @param \Plausible\Analytics\WP\Client\Model\PaginationMetadataLinks|null $links links + * + * @return self + */ + public function setLinks( $links ) { + if ( is_null( $links ) ) { + throw new \InvalidArgumentException( 'non-nullable links cannot be null' ); + } + $this->container[ 'links' ] = $links; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/SharedLinkCreateRequest.php b/src/Client/lib/Model/SharedLinkCreateRequest.php index 7746c13f..dbc80042 100644 --- a/src/Client/lib/Model/SharedLinkCreateRequest.php +++ b/src/Client/lib/Model/SharedLinkCreateRequest.php @@ -1,9 +1,7 @@ */ -class SharedLinkCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SharedLink.CreateRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'shared_link' => '\Plausible\Analytics\WP\Client\Model\SharedLinkCreateRequestSharedLink' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'shared_link' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'shared_link' => 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 = [ - 'shared_link' => 'shared_link' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'shared_link' => 'setSharedLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'shared_link' => 'getSharedLink' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('shared_link', $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['shared_link'] === null) { - $invalidProperties[] = "'shared_link' 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 shared_link - * - * @return \Plausible\Analytics\WP\Client\Model\SharedLinkCreateRequestSharedLink - */ - public function getSharedLink() - { - return $this->container['shared_link']; - } - - /** - * Sets shared_link - * - * @param \Plausible\Analytics\WP\Client\Model\SharedLinkCreateRequestSharedLink $shared_link shared_link - * - * @return self - */ - public function setSharedLink($shared_link) - { - if (is_null($shared_link)) { - throw new \InvalidArgumentException('non-nullable shared_link cannot be null'); - } - $this->container['shared_link'] = $shared_link; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class SharedLinkCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'SharedLink.CreateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'shared_link' => '\Plausible\Analytics\WP\Client\Model\SharedLinkCreateRequestSharedLink', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'shared_link' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shared_link' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'shared_link' => 'shared_link', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'shared_link' => 'setSharedLink', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'shared_link' => 'getSharedLink', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'shared_link', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'shared_link' ] === null ) { + $invalidProperties[] = "'shared_link' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets shared_link + * @return \Plausible\Analytics\WP\Client\Model\SharedLinkCreateRequestSharedLink + */ + public function getSharedLink() { + return $this->container[ 'shared_link' ]; + } + + /** + * Sets shared_link + * + * @param \Plausible\Analytics\WP\Client\Model\SharedLinkCreateRequestSharedLink $shared_link shared_link + * + * @return self + */ + public function setSharedLink( $shared_link ) { + if ( is_null( $shared_link ) ) { + throw new \InvalidArgumentException( 'non-nullable shared_link cannot be null' ); + } + $this->container[ 'shared_link' ] = $shared_link; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php b/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php index 5611fd14..0d99f04d 100644 --- a/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php +++ b/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php @@ -1,9 +1,7 @@ */ -class SharedLinkCreateRequestSharedLink implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SharedLink_CreateRequest_shared_link'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'name' => 'string', - 'password' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'name' => null, - 'password' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'name' => false, - 'password' => 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 = [ - 'name' => 'name', - 'password' => 'password' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'password' => 'setPassword' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'password' => 'getPassword' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('password', $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['name'] === null) { - $invalidProperties[] = "'name' 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 name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Shared 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 password - * - * @return string|null - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string|null $password Shared Link 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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class SharedLinkCreateRequestSharedLink implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'SharedLink_CreateRequest_shared_link'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'password' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'password' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'password' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'password' => 'password', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'password' => 'setPassword', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'password' => 'getPassword', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'name', $data ?? [], null ); + $this->setIfExists( 'password', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'name' ] === null ) { + $invalidProperties[] = "'name' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets name + * @return string + */ + public function getName() { + return $this->container[ 'name' ]; + } + + /** + * Sets name + * + * @param string $name Shared 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 password + * @return string|null + */ + public function getPassword() { + return $this->container[ 'password' ]; + } + + /** + * Sets password + * + * @param string|null $password Shared Link 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; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/Model/SharedLinkListResponse.php b/src/Client/lib/Model/SharedLinkListResponse.php index 17bd469e..f736e91e 100644 --- a/src/Client/lib/Model/SharedLinkListResponse.php +++ b/src/Client/lib/Model/SharedLinkListResponse.php @@ -1,9 +1,7 @@ */ -class SharedLinkListResponse implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SharedLink.ListResponse'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'meta' => '\Plausible\Analytics\WP\Client\Model\GoalListResponseMeta', - 'shared_links' => '\Plausible\Analytics\WP\Client\Model\SharedLink[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'meta' => null, - 'shared_links' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'meta' => false, - 'shared_links' => 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 = [ - 'meta' => 'meta', - 'shared_links' => 'shared_links' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'meta' => 'setMeta', - 'shared_links' => 'setSharedLinks' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'meta' => 'getMeta', - 'shared_links' => 'getSharedLinks' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('meta', $data ?? [], null); - $this->setIfExists('shared_links', $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['meta'] === null) { - $invalidProperties[] = "'meta' can't be null"; - } - if ($this->container['shared_links'] === null) { - $invalidProperties[] = "'shared_links' 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 meta - * - * @return \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta - */ - public function getMeta() - { - return $this->container['meta']; - } - - /** - * Sets meta - * - * @param \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta $meta meta - * - * @return self - */ - public function setMeta($meta) - { - if (is_null($meta)) { - throw new \InvalidArgumentException('non-nullable meta cannot be null'); - } - $this->container['meta'] = $meta; - - return $this; - } - - /** - * Gets shared_links - * - * @return \Plausible\Analytics\WP\Client\Model\SharedLink[] - */ - public function getSharedLinks() - { - return $this->container['shared_links']; - } - - /** - * Sets shared_links - * - * @param \Plausible\Analytics\WP\Client\Model\SharedLink[] $shared_links shared_links - * - * @return self - */ - public function setSharedLinks($shared_links) - { - if (is_null($shared_links)) { - throw new \InvalidArgumentException('non-nullable shared_links cannot be null'); - } - $this->container['shared_links'] = $shared_links; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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)); - } +class SharedLinkListResponse implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * @var string + */ + protected static $openAPIModelName = 'SharedLink.ListResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + protected static $openAPITypes = [ + 'meta' => '\Plausible\Analytics\WP\Client\Model\GoalListResponseMeta', + 'shared_links' => '\Plausible\Analytics\WP\Client\Model\SharedLink[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'meta' => null, + 'shared_links' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'meta' => false, + 'shared_links' => false, + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'meta' => 'meta', + 'shared_links' => 'shared_links', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'meta' => 'setMeta', + 'shared_links' => 'setSharedLinks', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'meta' => 'getMeta', + 'shared_links' => 'getSharedLinks', + ]; + + /** + * If a nullable field gets set to null, insert it here + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct( array $data = null ) { + $this->setIfExists( 'meta', $data ?? [], null ); + $this->setIfExists( 'shared_links', $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; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable( string $property ): bool { + return self::openAPINullables()[ $property ] ?? false; + } + + /** + * Array of nullable properties + * @return array + */ + protected static function openAPINullables(): array { + return self::$openAPINullables; + } + + /** + * 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 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; + } + + /** + * 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 nullable field names deliberately set to null + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * @return string + */ + public function getModelName() { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { + $invalidProperties = []; + + if ( $this->container[ 'meta' ] === null ) { + $invalidProperties[] = "'meta' can't be null"; + } + if ( $this->container[ 'shared_links' ] === null ) { + $invalidProperties[] = "'shared_links' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets meta + * @return \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta + */ + public function getMeta() { + return $this->container[ 'meta' ]; + } + + /** + * Sets meta + * + * @param \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta $meta meta + * + * @return self + */ + public function setMeta( $meta ) { + if ( is_null( $meta ) ) { + throw new \InvalidArgumentException( 'non-nullable meta cannot be null' ); + } + $this->container[ 'meta' ] = $meta; + + return $this; + } + + /** + * Gets shared_links + * @return \Plausible\Analytics\WP\Client\Model\SharedLink[] + */ + public function getSharedLinks() { + return $this->container[ 'shared_links' ]; + } + + /** + * Sets shared_links + * + * @param \Plausible\Analytics\WP\Client\Model\SharedLink[] $shared_links shared_links + * + * @return self + */ + public function setSharedLinks( $shared_links ) { + if ( is_null( $shared_links ) ) { + throw new \InvalidArgumentException( 'non-nullable shared_links cannot be null' ); + } + $this->container[ 'shared_links' ] = $shared_links; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists( $offset ): bool { + return isset( $this->container[ $offset ] ); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet( $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 $offset Offset + * + * @return void + */ + public function offsetUnset( $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 ) ); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } } diff --git a/src/Client/lib/ObjectSerializer.php b/src/Client/lib/ObjectSerializer.php index 0769dc33..83680f67 100644 --- a/src/Client/lib/ObjectSerializer.php +++ b/src/Client/lib/ObjectSerializer.php @@ -80,8 +80,7 @@ public static function sanitizeForSerialization( $data, $type = null, $format = foreach ( $data::openAPITypes() as $property => $openAPIType ) { $getter = $data::getters()[ $property ]; $value = $data->$getter(); - if ( $value !== null && - ! in_array( + if ( $value !== null && ! in_array( $openAPIType, [ '\DateTime', diff --git a/src/Client/src/Client/.gitignore b/src/Client/src/Client/.gitignore deleted file mode 100644 index 9f1681c2..00000000 --- a/src/Client/src/Client/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore - -composer.phar -/vendor/ - -# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control -# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -# composer.lock - -# php-cs-fixer cache -.php_cs.cache -.php-cs-fixer.cache - -# PHPUnit cache -.phpunit.result.cache diff --git a/src/Client/src/Client/.openapi-generator-ignore b/src/Client/src/Client/.openapi-generator-ignore deleted file mode 100644 index 7484ee59..00000000 --- a/src/Client/src/Client/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/src/Client/src/Client/.openapi-generator/FILES b/src/Client/src/Client/.openapi-generator/FILES deleted file mode 100644 index b0fc3a16..00000000 --- a/src/Client/src/Client/.openapi-generator/FILES +++ /dev/null @@ -1,56 +0,0 @@ -.gitignore -.openapi-generator-ignore -.php-cs-fixer.dist.php -.travis.yml -README.md -composer.json -git_push.sh -lib/Api/DefaultApi.php -lib/ApiException.php -lib/Configuration.php -lib/HeaderSelector.php -lib/Model/Capabilities.php -lib/Model/CapabilitiesFeatures.php -lib/Model/CustomProp.php -lib/Model/CustomPropCustomProp.php -lib/Model/CustomPropDisableRequest.php -lib/Model/CustomPropDisableRequestBulkDisable.php -lib/Model/CustomPropEnableRequest.php -lib/Model/CustomPropEnableRequestBulkEnable.php -lib/Model/CustomPropListResponse.php -lib/Model/Error.php -lib/Model/Goal.php -lib/Model/GoalCreateRequest.php -lib/Model/GoalCreateRequestBulkGetOrCreate.php -lib/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.php -lib/Model/GoalCreateRequestCustomEvent.php -lib/Model/GoalCreateRequestCustomEventGoal.php -lib/Model/GoalCreateRequestPageview.php -lib/Model/GoalCreateRequestPageviewGoal.php -lib/Model/GoalCreateRequestRevenue.php -lib/Model/GoalCreateRequestRevenueGoal.php -lib/Model/GoalCustomEvent.php -lib/Model/GoalCustomEventAllOfGoal.php -lib/Model/GoalDeleteBulkRequest.php -lib/Model/GoalListResponse.php -lib/Model/GoalListResponseMeta.php -lib/Model/GoalPageview.php -lib/Model/GoalPageviewAllOfGoal.php -lib/Model/GoalRevenue.php -lib/Model/GoalRevenueAllOfGoal.php -lib/Model/GoalType.php -lib/Model/Link.php -lib/Model/ModelInterface.php -lib/Model/NotFoundError.php -lib/Model/PaginationMetadata.php -lib/Model/PaginationMetadataLinks.php -lib/Model/PaymentRequiredError.php -lib/Model/SharedLink.php -lib/Model/SharedLinkCreateRequest.php -lib/Model/SharedLinkCreateRequestSharedLink.php -lib/Model/SharedLinkListResponse.php -lib/Model/SharedLinkSharedLink.php -lib/Model/UnauthorizedError.php -lib/Model/UnprocessableEntityError.php -lib/ObjectSerializer.php -phpunit.xml.dist diff --git a/src/Client/src/Client/.openapi-generator/VERSION b/src/Client/src/Client/.openapi-generator/VERSION deleted file mode 100644 index 8b23b8d4..00000000 --- a/src/Client/src/Client/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.3.0 \ No newline at end of file diff --git a/src/Client/src/Client/.php-cs-fixer.dist.php b/src/Client/src/Client/.php-cs-fixer.dist.php deleted file mode 100644 index af9cf39f..00000000 --- a/src/Client/src/Client/.php-cs-fixer.dist.php +++ /dev/null @@ -1,29 +0,0 @@ -in(__DIR__) - ->exclude('vendor') - ->exclude('test') - ->exclude('tests') -; - -$config = new PhpCsFixer\Config(); -return $config->setRules([ - '@PSR12' => true, - 'phpdoc_order' => true, - 'array_syntax' => [ 'syntax' => 'short' ], - 'strict_comparison' => true, - 'strict_param' => true, - 'no_trailing_whitespace' => false, - 'no_trailing_whitespace_in_comment' => false, - 'braces' => false, - 'single_blank_line_at_eof' => false, - 'blank_line_after_namespace' => false, - 'no_leading_import_slash' => false, - ]) - ->setFinder($finder) -; diff --git a/src/Client/src/Client/.travis.yml b/src/Client/src/Client/.travis.yml deleted file mode 100644 index 667b8156..00000000 --- a/src/Client/src/Client/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: php -# Bionic environment has preinstalled PHP from 7.1 to 7.4 -# https://docs.travis-ci.com/user/reference/bionic/#php-support -dist: bionic -php: - - 7.4 -before_install: "composer install" -script: "vendor/bin/phpunit" diff --git a/src/Client/src/Client/README.md b/src/Client/src/Client/README.md deleted file mode 100644 index 58b5350f..00000000 --- a/src/Client/src/Client/README.md +++ /dev/null @@ -1,162 +0,0 @@ -# OpenAPIClient-php - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - -## Installation & Usage - -### Requirements - -PHP 7.4 and later. -Should also work with PHP 8.0. - -### Composer - -To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: - -```json -{ - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" - } - ], - "require": { - "GIT_USER_ID/GIT_REPO_ID": "*@dev" - } -} -``` - -Then run `composer install` - -### Manual Installation - -Download the files and include `autoload.php`: - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new PlausibleAnalyticsWPClient\Api\DefaultApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->plausibleWebPluginsAPIControllersCapabilitiesIndex(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DefaultApi->plausibleWebPluginsAPIControllersCapabilitiesIndex: ', $e->getMessage(), PHP_EOL; -} - -``` - -## API Endpoints - -All URIs are relative to *https://plausible.io* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*DefaultApi* | [**plausibleWebPluginsAPIControllersCapabilitiesIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscapabilitiesindex) | **GET** /api/plugins/v1/capabilities | Retrieve Capabilities -*DefaultApi* | [**plausibleWebPluginsAPIControllersCustomPropsDisable**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscustompropsdisable) | **DELETE** /api/plugins/v1/custom_props | Disable CustomProp(s) -*DefaultApi* | [**plausibleWebPluginsAPIControllersCustomPropsEnable**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerscustompropsenable) | **PUT** /api/plugins/v1/custom_props | Get or enable CustomProp(s) -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsCreate**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalscreate) | **PUT** /api/plugins/v1/goals | Get or create Goal -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsDelete**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsdelete) | **DELETE** /api/plugins/v1/goals/{id} | Delete Goal by ID -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsDeleteBulk**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsdeletebulk) | **DELETE** /api/plugins/v1/goals | Delete Goals in bulk -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsGet**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsget) | **GET** /api/plugins/v1/goals/{id} | Retrieve Goal by ID -*DefaultApi* | [**plausibleWebPluginsAPIControllersGoalsIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersgoalsindex) | **GET** /api/plugins/v1/goals | Retrieve Goals -*DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksCreate**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinkscreate) | **PUT** /api/plugins/v1/shared_links | Get or create Shared Link -*DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksGet**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinksget) | **GET** /api/plugins/v1/shared_links/{id} | Retrieve Shared Link by ID -*DefaultApi* | [**plausibleWebPluginsAPIControllersSharedLinksIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerssharedlinksindex) | **GET** /api/plugins/v1/shared_links | Retrieve Shared Links - -## Models - -- [Capabilities](docs/Model/Capabilities.md) -- [CapabilitiesFeatures](docs/Model/CapabilitiesFeatures.md) -- [CustomProp](docs/Model/CustomProp.md) -- [CustomPropCustomProp](docs/Model/CustomPropCustomProp.md) -- [CustomPropDisableRequest](docs/Model/CustomPropDisableRequest.md) -- [CustomPropDisableRequestBulkDisable](docs/Model/CustomPropDisableRequestBulkDisable.md) -- [CustomPropEnableRequest](docs/Model/CustomPropEnableRequest.md) -- [CustomPropEnableRequestBulkEnable](docs/Model/CustomPropEnableRequestBulkEnable.md) -- [CustomPropListResponse](docs/Model/CustomPropListResponse.md) -- [Error](docs/Model/Error.md) -- [Goal](docs/Model/Goal.md) -- [GoalCreateRequest](docs/Model/GoalCreateRequest.md) -- [GoalCreateRequestBulkGetOrCreate](docs/Model/GoalCreateRequestBulkGetOrCreate.md) -- [GoalCreateRequestBulkGetOrCreateGoalsInner](docs/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.md) -- [GoalCreateRequestCustomEvent](docs/Model/GoalCreateRequestCustomEvent.md) -- [GoalCreateRequestCustomEventGoal](docs/Model/GoalCreateRequestCustomEventGoal.md) -- [GoalCreateRequestPageview](docs/Model/GoalCreateRequestPageview.md) -- [GoalCreateRequestPageviewGoal](docs/Model/GoalCreateRequestPageviewGoal.md) -- [GoalCreateRequestRevenue](docs/Model/GoalCreateRequestRevenue.md) -- [GoalCreateRequestRevenueGoal](docs/Model/GoalCreateRequestRevenueGoal.md) -- [GoalCustomEvent](docs/Model/GoalCustomEvent.md) -- [GoalCustomEventAllOfGoal](docs/Model/GoalCustomEventAllOfGoal.md) -- [GoalDeleteBulkRequest](docs/Model/GoalDeleteBulkRequest.md) -- [GoalListResponse](docs/Model/GoalListResponse.md) -- [GoalListResponseMeta](docs/Model/GoalListResponseMeta.md) -- [GoalPageview](docs/Model/GoalPageview.md) -- [GoalPageviewAllOfGoal](docs/Model/GoalPageviewAllOfGoal.md) -- [GoalRevenue](docs/Model/GoalRevenue.md) -- [GoalRevenueAllOfGoal](docs/Model/GoalRevenueAllOfGoal.md) -- [GoalType](docs/Model/GoalType.md) -- [Link](docs/Model/Link.md) -- [NotFoundError](docs/Model/NotFoundError.md) -- [PaginationMetadata](docs/Model/PaginationMetadata.md) -- [PaginationMetadataLinks](docs/Model/PaginationMetadataLinks.md) -- [PaymentRequiredError](docs/Model/PaymentRequiredError.md) -- [SharedLink](docs/Model/SharedLink.md) -- [SharedLinkCreateRequest](docs/Model/SharedLinkCreateRequest.md) -- [SharedLinkCreateRequestSharedLink](docs/Model/SharedLinkCreateRequestSharedLink.md) -- [SharedLinkListResponse](docs/Model/SharedLinkListResponse.md) -- [SharedLinkSharedLink](docs/Model/SharedLinkSharedLink.md) -- [UnauthorizedError](docs/Model/UnauthorizedError.md) -- [UnprocessableEntityError](docs/Model/UnprocessableEntityError.md) - -## Authorization - -Authentication schemes defined for the API: -### basic_auth - -- **Type**: HTTP basic authentication - -## Tests - -To run the tests, use: - -```bash -composer install -vendor/bin/phpunit -``` - -## Author - - - -## About this package - -This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: `1.0-rc` -- Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/src/Client/src/Client/composer.json b/src/Client/src/Client/composer.json deleted file mode 100644 index a75127c9..00000000 --- a/src/Client/src/Client/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "description": "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)", - "keywords": [ - "openapitools", - "openapi-generator", - "openapi", - "php", - "sdk", - "rest", - "api" - ], - "homepage": "https://openapi-generator.tech", - "license": "unlicense", - "authors": [ - { - "name": "OpenAPI", - "homepage": "https://openapi-generator.tech" - } - ], - "require": { - "php": "^7.4 || ^8.0", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "guzzlehttp/guzzle": "^7.3", - "guzzlehttp/psr7": "^1.7 || ^2.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.0 || ^9.0", - "friendsofphp/php-cs-fixer": "^3.5" - }, - "autoload": { - "psr-4": { "PlausibleAnalyticsWPClient\\" : "lib/" } - }, - "autoload-dev": { - "psr-4": { "PlausibleAnalyticsWPClient\\Test\\" : "test/" } - } -} diff --git a/src/Client/src/Client/git_push.sh b/src/Client/src/Client/git_push.sh deleted file mode 100644 index f53a75d4..00000000 --- a/src/Client/src/Client/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/src/Client/src/Client/lib/Api/DefaultApi.php b/src/Client/src/Client/lib/Api/DefaultApi.php deleted file mode 100644 index 88a5176a..00000000 --- a/src/Client/src/Client/lib/Api/DefaultApi.php +++ /dev/null @@ -1,3955 +0,0 @@ - [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersCustomPropsDisable' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersCustomPropsEnable' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersGoalsCreate' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersGoalsDelete' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersGoalsDeleteBulk' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersGoalsGet' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersGoalsIndex' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersSharedLinksCreate' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersSharedLinksGet' => [ - 'application/json', - ], - 'plausibleWebPluginsAPIControllersSharedLinksIndex' => [ - '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, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $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 plausibleWebPluginsAPIControllersCapabilitiesIndex - * - * Retrieve Capabilities - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \PlausibleAnalyticsWPClient\Model\Capabilities - */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndex(string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0]) - { - list($response) = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo($contentType); - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo - * - * Retrieve Capabilities - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \PlausibleAnalyticsWPClient\Model\Capabilities, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo(string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexRequest($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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\PlausibleAnalyticsWPClient\Model\Capabilities' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\Capabilities' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\Capabilities', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\PlausibleAnalyticsWPClient\Model\Capabilities'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\Capabilities', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersCapabilitiesIndexAsync - * - * Retrieve Capabilities - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndexAsync(string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0]) - { - return $this->plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo - * - * Retrieve Capabilities - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo(string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0]) - { - $returnType = '\PlausibleAnalyticsWPClient\Model\Capabilities'; - $request = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexRequest($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 'plausibleWebPluginsAPIControllersCapabilitiesIndex' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndexRequest(string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0]) - { - - - $resourcePath = '/api/plugins/v1/capabilities'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersCustomPropsDisable - * - * Disable CustomProp(s) - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function plausibleWebPluginsAPIControllersCustomPropsDisable($custom_prop_disable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'][0]) - { - $this->plausibleWebPluginsAPIControllersCustomPropsDisableWithHttpInfo($custom_prop_disable_request, $contentType); - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsDisableWithHttpInfo - * - * Disable CustomProp(s) - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersCustomPropsDisableWithHttpInfo($custom_prop_disable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersCustomPropsDisableRequest($custom_prop_disable_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(); - - 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 [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\PaymentRequiredError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsDisableAsync - * - * Disable CustomProp(s) - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersCustomPropsDisableAsync($custom_prop_disable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'][0]) - { - return $this->plausibleWebPluginsAPIControllersCustomPropsDisableAsyncWithHttpInfo($custom_prop_disable_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsDisableAsyncWithHttpInfo - * - * Disable CustomProp(s) - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersCustomPropsDisableAsyncWithHttpInfo($custom_prop_disable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'][0]) - { - $returnType = ''; - $request = $this->plausibleWebPluginsAPIControllersCustomPropsDisableRequest($custom_prop_disable_request, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'plausibleWebPluginsAPIControllersCustomPropsDisable' - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersCustomPropsDisableRequest($custom_prop_disable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsDisable'][0]) - { - - - - $resourcePath = '/api/plugins/v1/custom_props'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($custom_prop_disable_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($custom_prop_disable_request)); - } else { - $httpBody = $custom_prop_disable_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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersCustomPropsEnable - * - * Get or enable CustomProp(s) - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \PlausibleAnalyticsWPClient\Model\CustomPropListResponse|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\PaymentRequiredError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError - */ - public function plausibleWebPluginsAPIControllersCustomPropsEnable($custom_prop_enable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'][0]) - { - list($response) = $this->plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo($custom_prop_enable_request, $contentType); - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo - * - * Get or enable CustomProp(s) - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \PlausibleAnalyticsWPClient\Model\CustomPropListResponse|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\PaymentRequiredError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo($custom_prop_enable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersCustomPropsEnableRequest($custom_prop_enable_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(); - - 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() - ); - } - - switch($statusCode) { - case 201: - if ('\PlausibleAnalyticsWPClient\Model\CustomPropListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\CustomPropListResponse' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\CustomPropListResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 402: - if ('\PlausibleAnalyticsWPClient\Model\PaymentRequiredError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\PaymentRequiredError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\PaymentRequiredError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 422: - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\PlausibleAnalyticsWPClient\Model\CustomPropListResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\CustomPropListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\PaymentRequiredError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsEnableAsync - * - * Get or enable CustomProp(s) - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersCustomPropsEnableAsync($custom_prop_enable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'][0]) - { - return $this->plausibleWebPluginsAPIControllersCustomPropsEnableAsyncWithHttpInfo($custom_prop_enable_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsEnableAsyncWithHttpInfo - * - * Get or enable CustomProp(s) - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersCustomPropsEnableAsyncWithHttpInfo($custom_prop_enable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'][0]) - { - $returnType = '\PlausibleAnalyticsWPClient\Model\CustomPropListResponse'; - $request = $this->plausibleWebPluginsAPIControllersCustomPropsEnableRequest($custom_prop_enable_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 'plausibleWebPluginsAPIControllersCustomPropsEnable' - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersCustomPropsEnableRequest($custom_prop_enable_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCustomPropsEnable'][0]) - { - - - - $resourcePath = '/api/plugins/v1/custom_props'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($custom_prop_enable_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($custom_prop_enable_request)); - } else { - $httpBody = $custom_prop_enable_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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersGoalsCreate - * - * Get or create Goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequest $goal_create_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \PlausibleAnalyticsWPClient\Model\GoalListResponse|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\PaymentRequiredError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError - */ - public function plausibleWebPluginsAPIControllersGoalsCreate($goal_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'][0]) - { - list($response) = $this->plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo($goal_create_request, $contentType); - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo - * - * Get or create Goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequest $goal_create_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \PlausibleAnalyticsWPClient\Model\GoalListResponse|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\PaymentRequiredError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo($goal_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersGoalsCreateRequest($goal_create_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(); - - 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() - ); - } - - switch($statusCode) { - case 201: - if ('\PlausibleAnalyticsWPClient\Model\GoalListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\GoalListResponse' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\GoalListResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 402: - if ('\PlausibleAnalyticsWPClient\Model\PaymentRequiredError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\PaymentRequiredError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\PaymentRequiredError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 422: - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\PlausibleAnalyticsWPClient\Model\GoalListResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\GoalListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\PaymentRequiredError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsCreateAsync - * - * Get or create Goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequest $goal_create_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsCreateAsync($goal_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'][0]) - { - return $this->plausibleWebPluginsAPIControllersGoalsCreateAsyncWithHttpInfo($goal_create_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsCreateAsyncWithHttpInfo - * - * Get or create Goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequest $goal_create_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsCreateAsyncWithHttpInfo($goal_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'][0]) - { - $returnType = '\PlausibleAnalyticsWPClient\Model\GoalListResponse'; - $request = $this->plausibleWebPluginsAPIControllersGoalsCreateRequest($goal_create_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 'plausibleWebPluginsAPIControllersGoalsCreate' - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequest $goal_create_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersGoalsCreateRequest($goal_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsCreate'][0]) - { - - - - $resourcePath = '/api/plugins/v1/goals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($goal_create_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($goal_create_request)); - } else { - $httpBody = $goal_create_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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersGoalsDelete - * - * Delete Goal by ID - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function plausibleWebPluginsAPIControllersGoalsDelete($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'][0]) - { - $this->plausibleWebPluginsAPIControllersGoalsDeleteWithHttpInfo($id, $contentType); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteWithHttpInfo - * - * Delete Goal by ID - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteWithHttpInfo($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersGoalsDeleteRequest($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(); - - 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 [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteAsync - * - * Delete Goal by ID - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteAsync($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'][0]) - { - return $this->plausibleWebPluginsAPIControllersGoalsDeleteAsyncWithHttpInfo($id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteAsyncWithHttpInfo - * - * Delete Goal by ID - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteAsyncWithHttpInfo($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'][0]) - { - $returnType = ''; - $request = $this->plausibleWebPluginsAPIControllersGoalsDeleteRequest($id, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'plausibleWebPluginsAPIControllersGoalsDelete' - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteRequest($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDelete'][0]) - { - - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling plausibleWebPluginsAPIControllersGoalsDelete' - ); - } - - - $resourcePath = '/api/plugins/v1/goals/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersGoalsDeleteBulk - * - * Delete Goals in bulk - * - * @param \PlausibleAnalyticsWPClient\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteBulk($goal_delete_bulk_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'][0]) - { - $this->plausibleWebPluginsAPIControllersGoalsDeleteBulkWithHttpInfo($goal_delete_bulk_request, $contentType); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteBulkWithHttpInfo - * - * Delete Goals in bulk - * - * @param \PlausibleAnalyticsWPClient\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteBulkWithHttpInfo($goal_delete_bulk_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest($goal_delete_bulk_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(); - - 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 [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteBulkAsync - * - * Delete Goals in bulk - * - * @param \PlausibleAnalyticsWPClient\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteBulkAsync($goal_delete_bulk_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'][0]) - { - return $this->plausibleWebPluginsAPIControllersGoalsDeleteBulkAsyncWithHttpInfo($goal_delete_bulk_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteBulkAsyncWithHttpInfo - * - * Delete Goals in bulk - * - * @param \PlausibleAnalyticsWPClient\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteBulkAsyncWithHttpInfo($goal_delete_bulk_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'][0]) - { - $returnType = ''; - $request = $this->plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest($goal_delete_bulk_request, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'plausibleWebPluginsAPIControllersGoalsDeleteBulk' - * - * @param \PlausibleAnalyticsWPClient\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest($goal_delete_bulk_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsDeleteBulk'][0]) - { - - - - $resourcePath = '/api/plugins/v1/goals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($goal_delete_bulk_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($goal_delete_bulk_request)); - } else { - $httpBody = $goal_delete_bulk_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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersGoalsGet - * - * Retrieve Goal by ID - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \PlausibleAnalyticsWPClient\Model\Goal|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\NotFoundError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError - */ - public function plausibleWebPluginsAPIControllersGoalsGet($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'][0]) - { - list($response) = $this->plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo($id, $contentType); - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo - * - * Retrieve Goal by ID - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \PlausibleAnalyticsWPClient\Model\Goal|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\NotFoundError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersGoalsGetRequest($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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\PlausibleAnalyticsWPClient\Model\Goal' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\Goal' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\Goal', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\PlausibleAnalyticsWPClient\Model\NotFoundError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\NotFoundError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\NotFoundError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 422: - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\PlausibleAnalyticsWPClient\Model\Goal'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\Goal', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\NotFoundError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsGetAsync - * - * Retrieve Goal by ID - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsGetAsync($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'][0]) - { - return $this->plausibleWebPluginsAPIControllersGoalsGetAsyncWithHttpInfo($id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsGetAsyncWithHttpInfo - * - * Retrieve Goal by ID - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'][0]) - { - $returnType = '\PlausibleAnalyticsWPClient\Model\Goal'; - $request = $this->plausibleWebPluginsAPIControllersGoalsGetRequest($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 'plausibleWebPluginsAPIControllersGoalsGet' - * - * @param int $id Goal ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersGoalsGetRequest($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'][0]) - { - - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling plausibleWebPluginsAPIControllersGoalsGet' - ); - } - - - $resourcePath = '/api/plugins/v1/goals/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersGoalsIndex - * - * Retrieve Goals - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \PlausibleAnalyticsWPClient\Model\GoalListResponse|\PlausibleAnalyticsWPClient\Model\UnauthorizedError - */ - public function plausibleWebPluginsAPIControllersGoalsIndex($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'][0]) - { - list($response) = $this->plausibleWebPluginsAPIControllersGoalsIndexWithHttpInfo($limit, $after, $before, $contentType); - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsIndexWithHttpInfo - * - * Retrieve Goals - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \PlausibleAnalyticsWPClient\Model\GoalListResponse|\PlausibleAnalyticsWPClient\Model\UnauthorizedError, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersGoalsIndexWithHttpInfo($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersGoalsIndexRequest($limit, $after, $before, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\PlausibleAnalyticsWPClient\Model\GoalListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\GoalListResponse' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\GoalListResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\PlausibleAnalyticsWPClient\Model\GoalListResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\GoalListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsIndexAsync - * - * Retrieve Goals - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsIndexAsync($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'][0]) - { - return $this->plausibleWebPluginsAPIControllersGoalsIndexAsyncWithHttpInfo($limit, $after, $before, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsIndexAsyncWithHttpInfo - * - * Retrieve Goals - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersGoalsIndexAsyncWithHttpInfo($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'][0]) - { - $returnType = '\PlausibleAnalyticsWPClient\Model\GoalListResponse'; - $request = $this->plausibleWebPluginsAPIControllersGoalsIndexRequest($limit, $after, $before, $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 'plausibleWebPluginsAPIControllersGoalsIndex' - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersGoalsIndexRequest($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'][0]) - { - - - - - - $resourcePath = '/api/plugins/v1/goals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $limit, - 'limit', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $after, - 'after', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $before, - 'before', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // 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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersSharedLinksCreate - * - * Get or create Shared Link - * - * @param \PlausibleAnalyticsWPClient\Model\SharedLinkCreateRequest $shared_link_create_request Shared Link params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \PlausibleAnalyticsWPClient\Model\SharedLink|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError - */ - public function plausibleWebPluginsAPIControllersSharedLinksCreate($shared_link_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'][0]) - { - list($response) = $this->plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo($shared_link_create_request, $contentType); - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo - * - * Get or create Shared Link - * - * @param \PlausibleAnalyticsWPClient\Model\SharedLinkCreateRequest $shared_link_create_request Shared Link params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \PlausibleAnalyticsWPClient\Model\SharedLink|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo($shared_link_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersSharedLinksCreateRequest($shared_link_create_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(); - - 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() - ); - } - - switch($statusCode) { - case 201: - if ('\PlausibleAnalyticsWPClient\Model\SharedLink' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\SharedLink' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\SharedLink', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 422: - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\PlausibleAnalyticsWPClient\Model\SharedLink'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\SharedLink', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksCreateAsync - * - * Get or create Shared Link - * - * @param \PlausibleAnalyticsWPClient\Model\SharedLinkCreateRequest $shared_link_create_request Shared Link params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersSharedLinksCreateAsync($shared_link_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'][0]) - { - return $this->plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo($shared_link_create_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo - * - * Get or create Shared Link - * - * @param \PlausibleAnalyticsWPClient\Model\SharedLinkCreateRequest $shared_link_create_request Shared Link params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo($shared_link_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'][0]) - { - $returnType = '\PlausibleAnalyticsWPClient\Model\SharedLink'; - $request = $this->plausibleWebPluginsAPIControllersSharedLinksCreateRequest($shared_link_create_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 'plausibleWebPluginsAPIControllersSharedLinksCreate' - * - * @param \PlausibleAnalyticsWPClient\Model\SharedLinkCreateRequest $shared_link_create_request Shared Link params (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersSharedLinksCreateRequest($shared_link_create_request = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'][0]) - { - - - - $resourcePath = '/api/plugins/v1/shared_links'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($shared_link_create_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($shared_link_create_request)); - } else { - $httpBody = $shared_link_create_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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersSharedLinksGet - * - * Retrieve Shared Link by ID - * - * @param int $id Shared Link ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \PlausibleAnalyticsWPClient\Model\SharedLink|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\NotFoundError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError - */ - public function plausibleWebPluginsAPIControllersSharedLinksGet($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0]) - { - list($response) = $this->plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo($id, $contentType); - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo - * - * Retrieve Shared Link by ID - * - * @param int $id Shared Link ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \PlausibleAnalyticsWPClient\Model\SharedLink|\PlausibleAnalyticsWPClient\Model\UnauthorizedError|\PlausibleAnalyticsWPClient\Model\NotFoundError|\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersSharedLinksGetRequest($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(); - - 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() - ); - } - - switch($statusCode) { - case 201: - if ('\PlausibleAnalyticsWPClient\Model\SharedLink' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\SharedLink' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\SharedLink', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\PlausibleAnalyticsWPClient\Model\NotFoundError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\NotFoundError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\NotFoundError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 422: - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\PlausibleAnalyticsWPClient\Model\SharedLink'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\SharedLink', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\NotFoundError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksGetAsync - * - * Retrieve Shared Link by ID - * - * @param int $id Shared Link ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersSharedLinksGetAsync($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0]) - { - return $this->plausibleWebPluginsAPIControllersSharedLinksGetAsyncWithHttpInfo($id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksGetAsyncWithHttpInfo - * - * Retrieve Shared Link by ID - * - * @param int $id Shared Link ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersSharedLinksGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0]) - { - $returnType = '\PlausibleAnalyticsWPClient\Model\SharedLink'; - $request = $this->plausibleWebPluginsAPIControllersSharedLinksGetRequest($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 'plausibleWebPluginsAPIControllersSharedLinksGet' - * - * @param int $id Shared Link ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersSharedLinksGetRequest($id, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0]) - { - - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling plausibleWebPluginsAPIControllersSharedLinksGet' - ); - } - - - $resourcePath = '/api/plugins/v1/shared_links/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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 plausibleWebPluginsAPIControllersSharedLinksIndex - * - * Retrieve Shared Links - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \PlausibleAnalyticsWPClient\Model\SharedLinkListResponse|\PlausibleAnalyticsWPClient\Model\UnauthorizedError - */ - public function plausibleWebPluginsAPIControllersSharedLinksIndex($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0]) - { - list($response) = $this->plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo($limit, $after, $before, $contentType); - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo - * - * Retrieve Shared Links - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'] to see the possible values for this operation - * - * @throws \PlausibleAnalyticsWPClient\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \PlausibleAnalyticsWPClient\Model\SharedLinkListResponse|\PlausibleAnalyticsWPClient\Model\UnauthorizedError, HTTP status code, HTTP response headers (array of strings) - */ - public function plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0]) - { - $request = $this->plausibleWebPluginsAPIControllersSharedLinksIndexRequest($limit, $after, $before, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\PlausibleAnalyticsWPClient\Model\SharedLinkListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\SharedLinkListResponse' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\SharedLinkListResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\PlausibleAnalyticsWPClient\Model\UnauthorizedError' !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\PlausibleAnalyticsWPClient\Model\SharedLinkListResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== '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() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\SharedLinkListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\PlausibleAnalyticsWPClient\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksIndexAsync - * - * Retrieve Shared Links - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersSharedLinksIndexAsync($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0]) - { - return $this->plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpInfo($limit, $after, $before, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpInfo - * - * Retrieve Shared Links - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpInfo($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0]) - { - $returnType = '\PlausibleAnalyticsWPClient\Model\SharedLinkListResponse'; - $request = $this->plausibleWebPluginsAPIControllersSharedLinksIndexRequest($limit, $after, $before, $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 'plausibleWebPluginsAPIControllersSharedLinksIndex' - * - * @param int $limit Maximum entries per page (optional) - * @param string $after Cursor value to seek after - generated internally (optional) - * @param string $before Cursor value to seek before - generated internally (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function plausibleWebPluginsAPIControllersSharedLinksIndexRequest($limit = null, $after = null, $before = null, string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0]) - { - - - - - - $resourcePath = '/api/plugins/v1/shared_links'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $limit, - 'limit', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $after, - 'after', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $before, - 'before', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // 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 HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $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()); - } - } - - return $options; - } -} diff --git a/src/Client/src/Client/lib/ApiException.php b/src/Client/src/Client/lib/ApiException.php deleted file mode 100644 index 6eb53435..00000000 --- a/src/Client/src/Client/lib/ApiException.php +++ /dev/null @@ -1,119 +0,0 @@ -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/src/Client/lib/Configuration.php b/src/Client/src/Client/lib/Configuration.php deleted file mode 100644 index 14d32c0a..00000000 --- a/src/Client/src/Client/lib/Configuration.php +++ /dev/null @@ -1,531 +0,0 @@ -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; - } - - /** - * 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 (PlausibleAnalyticsWPClient) Debug Report:' . PHP_EOL; - $report .= ' OS: ' . php_uname() . PHP_EOL; - $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' The version of the OpenAPI document: 1.0-rc' . 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://plausible.io", - "description" => "This server", - ] - ]; - } - - /** - * 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/src/Client/lib/HeaderSelector.php b/src/Client/src/Client/lib/HeaderSelector.php deleted file mode 100644 index 9464e665..00000000 --- a/src/Client/src/Client/lib/HeaderSelector.php +++ /dev/null @@ -1,245 +0,0 @@ -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 = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $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); - } - - /** - * 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/src/Client/lib/Model/Capabilities.php b/src/Client/src/Client/lib/Model/Capabilities.php deleted file mode 100644 index ecb0cb4b..00000000 --- a/src/Client/src/Client/lib/Model/Capabilities.php +++ /dev/null @@ -1,487 +0,0 @@ - - */ -class Capabilities implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Capabilities'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'authorized' => 'bool', - 'data_domain' => 'string', - 'features' => '\PlausibleAnalyticsWPClient\Model\CapabilitiesFeatures' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'authorized' => null, - 'data_domain' => null, - 'features' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'authorized' => false, - 'data_domain' => false, - 'features' => 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 = [ - 'authorized' => 'authorized', - 'data_domain' => 'data_domain', - 'features' => 'features' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'authorized' => 'setAuthorized', - 'data_domain' => 'setDataDomain', - 'features' => 'setFeatures' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'authorized' => 'getAuthorized', - 'data_domain' => 'getDataDomain', - 'features' => 'getFeatures' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('authorized', $data ?? [], null); - $this->setIfExists('data_domain', $data ?? [], null); - $this->setIfExists('features', $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['authorized'] === null) { - $invalidProperties[] = "'authorized' can't be null"; - } - if ($this->container['data_domain'] === null) { - $invalidProperties[] = "'data_domain' can't be null"; - } - if ($this->container['features'] === null) { - $invalidProperties[] = "'features' 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 authorized - * - * @return bool - */ - public function getAuthorized() - { - return $this->container['authorized']; - } - - /** - * Sets authorized - * - * @param bool $authorized authorized - * - * @return self - */ - public function setAuthorized($authorized) - { - if (is_null($authorized)) { - throw new \InvalidArgumentException('non-nullable authorized cannot be null'); - } - $this->container['authorized'] = $authorized; - - return $this; - } - - /** - * Gets data_domain - * - * @return string - */ - public function getDataDomain() - { - return $this->container['data_domain']; - } - - /** - * Sets data_domain - * - * @param string $data_domain data_domain - * - * @return self - */ - public function setDataDomain($data_domain) - { - if (is_null($data_domain)) { - throw new \InvalidArgumentException('non-nullable data_domain cannot be null'); - } - $this->container['data_domain'] = $data_domain; - - return $this; - } - - /** - * Gets features - * - * @return \PlausibleAnalyticsWPClient\Model\CapabilitiesFeatures - */ - public function getFeatures() - { - return $this->container['features']; - } - - /** - * Sets features - * - * @param \PlausibleAnalyticsWPClient\Model\CapabilitiesFeatures $features features - * - * @return self - */ - public function setFeatures($features) - { - if (is_null($features)) { - throw new \InvalidArgumentException('non-nullable features cannot be null'); - } - $this->container['features'] = $features; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/CapabilitiesFeatures.php b/src/Client/src/Client/lib/Model/CapabilitiesFeatures.php deleted file mode 100644 index 28523d6b..00000000 --- a/src/Client/src/Client/lib/Model/CapabilitiesFeatures.php +++ /dev/null @@ -1,560 +0,0 @@ - - */ -class CapabilitiesFeatures implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Capabilities_features'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'funnels' => 'bool', - 'goals' => 'bool', - 'props' => 'bool', - 'revenue_goals' => 'bool', - 'stats_api' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'funnels' => null, - 'goals' => null, - 'props' => null, - 'revenue_goals' => null, - 'stats_api' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'funnels' => false, - 'goals' => false, - 'props' => false, - 'revenue_goals' => false, - 'stats_api' => 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 = [ - 'funnels' => 'Funnels', - 'goals' => 'Goals', - 'props' => 'Props', - 'revenue_goals' => 'RevenueGoals', - 'stats_api' => 'StatsAPI' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'funnels' => 'setFunnels', - 'goals' => 'setGoals', - 'props' => 'setProps', - 'revenue_goals' => 'setRevenueGoals', - 'stats_api' => 'setStatsApi' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'funnels' => 'getFunnels', - 'goals' => 'getGoals', - 'props' => 'getProps', - 'revenue_goals' => 'getRevenueGoals', - 'stats_api' => 'getStatsApi' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('funnels', $data ?? [], null); - $this->setIfExists('goals', $data ?? [], null); - $this->setIfExists('props', $data ?? [], null); - $this->setIfExists('revenue_goals', $data ?? [], null); - $this->setIfExists('stats_api', $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['funnels'] === null) { - $invalidProperties[] = "'funnels' can't be null"; - } - if ($this->container['goals'] === null) { - $invalidProperties[] = "'goals' can't be null"; - } - if ($this->container['props'] === null) { - $invalidProperties[] = "'props' can't be null"; - } - if ($this->container['revenue_goals'] === null) { - $invalidProperties[] = "'revenue_goals' can't be null"; - } - if ($this->container['stats_api'] === null) { - $invalidProperties[] = "'stats_api' 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 funnels - * - * @return bool - */ - public function getFunnels() - { - return $this->container['funnels']; - } - - /** - * Sets funnels - * - * @param bool $funnels funnels - * - * @return self - */ - public function setFunnels($funnels) - { - if (is_null($funnels)) { - throw new \InvalidArgumentException('non-nullable funnels cannot be null'); - } - $this->container['funnels'] = $funnels; - - return $this; - } - - /** - * Gets goals - * - * @return bool - */ - public function getGoals() - { - return $this->container['goals']; - } - - /** - * Sets goals - * - * @param bool $goals goals - * - * @return self - */ - public function setGoals($goals) - { - if (is_null($goals)) { - throw new \InvalidArgumentException('non-nullable goals cannot be null'); - } - $this->container['goals'] = $goals; - - return $this; - } - - /** - * Gets props - * - * @return bool - */ - public function getProps() - { - return $this->container['props']; - } - - /** - * Sets props - * - * @param bool $props props - * - * @return self - */ - public function setProps($props) - { - if (is_null($props)) { - throw new \InvalidArgumentException('non-nullable props cannot be null'); - } - $this->container['props'] = $props; - - return $this; - } - - /** - * Gets revenue_goals - * - * @return bool - */ - public function getRevenueGoals() - { - return $this->container['revenue_goals']; - } - - /** - * Sets revenue_goals - * - * @param bool $revenue_goals revenue_goals - * - * @return self - */ - public function setRevenueGoals($revenue_goals) - { - if (is_null($revenue_goals)) { - throw new \InvalidArgumentException('non-nullable revenue_goals cannot be null'); - } - $this->container['revenue_goals'] = $revenue_goals; - - return $this; - } - - /** - * Gets stats_api - * - * @return bool - */ - public function getStatsApi() - { - return $this->container['stats_api']; - } - - /** - * Sets stats_api - * - * @param bool $stats_api stats_api - * - * @return self - */ - public function setStatsApi($stats_api) - { - if (is_null($stats_api)) { - throw new \InvalidArgumentException('non-nullable stats_api cannot be null'); - } - $this->container['stats_api'] = $stats_api; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/CustomProp.php b/src/Client/src/Client/lib/Model/CustomProp.php deleted file mode 100644 index a29dac94..00000000 --- a/src/Client/src/Client/lib/Model/CustomProp.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class CustomProp implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_prop' => '\PlausibleAnalyticsWPClient\Model\CustomPropCustomProp' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_prop' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_prop' => 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_prop' => 'custom_prop' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_prop' => 'setCustomProp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_prop' => 'getCustomProp' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_prop', $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['custom_prop'] === null) { - $invalidProperties[] = "'custom_prop' 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 custom_prop - * - * @return \PlausibleAnalyticsWPClient\Model\CustomPropCustomProp - */ - public function getCustomProp() - { - return $this->container['custom_prop']; - } - - /** - * Sets custom_prop - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropCustomProp $custom_prop custom_prop - * - * @return self - */ - public function setCustomProp($custom_prop) - { - if (is_null($custom_prop)) { - throw new \InvalidArgumentException('non-nullable custom_prop cannot be null'); - } - $this->container['custom_prop'] = $custom_prop; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/CustomPropCustomProp.php b/src/Client/src/Client/lib/Model/CustomPropCustomProp.php deleted file mode 100644 index ba4fbe5e..00000000 --- a/src/Client/src/Client/lib/Model/CustomPropCustomProp.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class CustomPropCustomProp implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp_custom_prop'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'key' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'key' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - '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 = [ - 'key' => 'key' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'key' => 'setKey' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'key' => 'getKey' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('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 = []; - - if ($this->container['key'] === null) { - $invalidProperties[] = "'key' 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 key - * - * @return string - */ - public function getKey() - { - return $this->container['key']; - } - - /** - * Sets key - * - * @param string $key Custom Property 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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/CustomPropDisableRequest.php b/src/Client/src/Client/lib/Model/CustomPropDisableRequest.php deleted file mode 100644 index 85605c42..00000000 --- a/src/Client/src/Client/lib/Model/CustomPropDisableRequest.php +++ /dev/null @@ -1,459 +0,0 @@ - - */ -class CustomPropDisableRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp.DisableRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\PlausibleAnalyticsWPClient\Model\CustomProp[]', - 'custom_prop' => '\PlausibleAnalyticsWPClient\Model\CustomPropCustomProp' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null, - 'custom_prop' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => false, - 'custom_prop' => 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_props' => 'custom_props', - 'custom_prop' => 'custom_prop' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - 'custom_prop' => 'setCustomProp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - 'custom_prop' => 'getCustomProp' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $data ?? [], null); - $this->setIfExists('custom_prop', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' can't be null"; - } - if ((count($this->container['custom_props']) < 1)) { - $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; - } - - if ($this->container['custom_prop'] === null) { - $invalidProperties[] = "'custom_prop' 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 custom_props - * - * @return \PlausibleAnalyticsWPClient\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \PlausibleAnalyticsWPClient\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - - - if ((count($custom_props) < 1)) { - throw new \InvalidArgumentException('invalid length for $custom_props when calling CustomPropDisableRequest., number of items must be greater than or equal to 1.'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - - /** - * Gets custom_prop - * - * @return \PlausibleAnalyticsWPClient\Model\CustomPropCustomProp - */ - public function getCustomProp() - { - return $this->container['custom_prop']; - } - - /** - * Sets custom_prop - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropCustomProp $custom_prop custom_prop - * - * @return self - */ - public function setCustomProp($custom_prop) - { - if (is_null($custom_prop)) { - throw new \InvalidArgumentException('non-nullable custom_prop cannot be null'); - } - $this->container['custom_prop'] = $custom_prop; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php b/src/Client/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php deleted file mode 100644 index 6b29aed9..00000000 --- a/src/Client/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php +++ /dev/null @@ -1,422 +0,0 @@ - - */ -class CustomPropDisableRequestBulkDisable implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp_DisableRequest_BulkDisable'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\PlausibleAnalyticsWPClient\Model\CustomProp[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => 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_props' => 'custom_props' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' can't be null"; - } - if ((count($this->container['custom_props']) < 1)) { - $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; - } - - 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_props - * - * @return \PlausibleAnalyticsWPClient\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \PlausibleAnalyticsWPClient\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - - - if ((count($custom_props) < 1)) { - throw new \InvalidArgumentException('invalid length for $custom_props when calling CustomPropDisableRequestBulkDisable., number of items must be greater than or equal to 1.'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/CustomPropEnableRequest.php b/src/Client/src/Client/lib/Model/CustomPropEnableRequest.php deleted file mode 100644 index 23bf005d..00000000 --- a/src/Client/src/Client/lib/Model/CustomPropEnableRequest.php +++ /dev/null @@ -1,459 +0,0 @@ - - */ -class CustomPropEnableRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp.EnableRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\PlausibleAnalyticsWPClient\Model\CustomProp[]', - 'custom_prop' => '\PlausibleAnalyticsWPClient\Model\CustomPropCustomProp' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null, - 'custom_prop' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => false, - 'custom_prop' => 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_props' => 'custom_props', - 'custom_prop' => 'custom_prop' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - 'custom_prop' => 'setCustomProp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - 'custom_prop' => 'getCustomProp' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $data ?? [], null); - $this->setIfExists('custom_prop', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' can't be null"; - } - if ((count($this->container['custom_props']) < 1)) { - $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; - } - - if ($this->container['custom_prop'] === null) { - $invalidProperties[] = "'custom_prop' 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 custom_props - * - * @return \PlausibleAnalyticsWPClient\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \PlausibleAnalyticsWPClient\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - - - if ((count($custom_props) < 1)) { - throw new \InvalidArgumentException('invalid length for $custom_props when calling CustomPropEnableRequest., number of items must be greater than or equal to 1.'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - - /** - * Gets custom_prop - * - * @return \PlausibleAnalyticsWPClient\Model\CustomPropCustomProp - */ - public function getCustomProp() - { - return $this->container['custom_prop']; - } - - /** - * Sets custom_prop - * - * @param \PlausibleAnalyticsWPClient\Model\CustomPropCustomProp $custom_prop custom_prop - * - * @return self - */ - public function setCustomProp($custom_prop) - { - if (is_null($custom_prop)) { - throw new \InvalidArgumentException('non-nullable custom_prop cannot be null'); - } - $this->container['custom_prop'] = $custom_prop; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/CustomPropEnableRequestBulkEnable.php b/src/Client/src/Client/lib/Model/CustomPropEnableRequestBulkEnable.php deleted file mode 100644 index 7d9339be..00000000 --- a/src/Client/src/Client/lib/Model/CustomPropEnableRequestBulkEnable.php +++ /dev/null @@ -1,422 +0,0 @@ - - */ -class CustomPropEnableRequestBulkEnable implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp_EnableRequest_BulkEnable'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\PlausibleAnalyticsWPClient\Model\CustomProp[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => 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_props' => 'custom_props' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' can't be null"; - } - if ((count($this->container['custom_props']) < 1)) { - $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1."; - } - - 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_props - * - * @return \PlausibleAnalyticsWPClient\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \PlausibleAnalyticsWPClient\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - - - if ((count($custom_props) < 1)) { - throw new \InvalidArgumentException('invalid length for $custom_props when calling CustomPropEnableRequestBulkEnable., number of items must be greater than or equal to 1.'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/CustomPropListResponse.php b/src/Client/src/Client/lib/Model/CustomPropListResponse.php deleted file mode 100644 index d71fa3dd..00000000 --- a/src/Client/src/Client/lib/Model/CustomPropListResponse.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class CustomPropListResponse implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomProp.ListResponse'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'custom_props' => '\PlausibleAnalyticsWPClient\Model\CustomProp[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'custom_props' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'custom_props' => 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_props' => 'custom_props' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'custom_props' => 'setCustomProps' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'custom_props' => 'getCustomProps' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('custom_props', $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['custom_props'] === null) { - $invalidProperties[] = "'custom_props' 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 custom_props - * - * @return \PlausibleAnalyticsWPClient\Model\CustomProp[] - */ - public function getCustomProps() - { - return $this->container['custom_props']; - } - - /** - * Sets custom_props - * - * @param \PlausibleAnalyticsWPClient\Model\CustomProp[] $custom_props custom_props - * - * @return self - */ - public function setCustomProps($custom_props) - { - if (is_null($custom_props)) { - throw new \InvalidArgumentException('non-nullable custom_props cannot be null'); - } - $this->container['custom_props'] = $custom_props; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/Error.php b/src/Client/src/Client/lib/Model/Error.php deleted file mode 100644 index f52c2cc5..00000000 --- a/src/Client/src/Client/lib/Model/Error.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class Error implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Error'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'detail' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'detail' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'detail' => 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 = [ - 'detail' => 'detail' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'detail' => 'setDetail' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'detail' => 'getDetail' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('detail', $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['detail'] === null) { - $invalidProperties[] = "'detail' 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 detail - * - * @return string - */ - public function getDetail() - { - return $this->container['detail']; - } - - /** - * Sets detail - * - * @param string $detail detail - * - * @return self - */ - public function setDetail($detail) - { - if (is_null($detail)) { - throw new \InvalidArgumentException('non-nullable detail cannot be null'); - } - $this->container['detail'] = $detail; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/Goal.php b/src/Client/src/Client/lib/Model/Goal.php deleted file mode 100644 index 97a71256..00000000 --- a/src/Client/src/Client/lib/Model/Goal.php +++ /dev/null @@ -1,453 +0,0 @@ - - */ -class Goal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'goal_type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_type' => 'string', - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalPageviewAllOfGoal' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_type' => null, - 'goal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_type' => false, - 'goal' => 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 = [ - 'goal_type' => 'goal_type', - 'goal' => 'goal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_type', $data ?? [], null); - $this->setIfExists('goal', $data ?? [], null); - - // Initialize discriminator property with the model name. - $this->container['goal_type'] = static::$openAPIModelName; - } - - /** - * 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['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - if ($this->container['goal'] === null) { - $invalidProperties[] = "'goal' 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 goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - - /** - * Gets goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalPageviewAllOfGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalPageviewAllOfGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequest.php b/src/Client/src/Client/lib/Model/GoalCreateRequest.php deleted file mode 100644 index d1132985..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequest.php +++ /dev/null @@ -1,534 +0,0 @@ - - */ -class GoalCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.CreateRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goals' => '\PlausibleAnalyticsWPClient\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[]', - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal', - 'goal_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goals' => null, - 'goal' => null, - 'goal_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goals' => false, - 'goal' => false, - 'goal_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 = [ - 'goals' => 'goals', - 'goal' => 'goal', - 'goal_type' => 'goal_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goals' => 'setGoals', - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goals' => 'getGoals', - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType' - ]; - - /** - * 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; - } - - public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getGoalTypeAllowableValues() - { - return [ - self::GOAL_TYPE_GOAL_PAGEVIEW, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goals', $data ?? [], null); - $this->setIfExists('goal', $data ?? [], null); - $this->setIfExists('goal_type', $data ?? [], 'Goal.Pageview'); - } - - /** - * 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['goals'] === null) { - $invalidProperties[] = "'goals' can't be null"; - } - if ((count($this->container['goals']) > 8)) { - $invalidProperties[] = "invalid value for 'goals', number of items must be less than or equal to 8."; - } - - if ((count($this->container['goals']) < 1)) { - $invalidProperties[] = "invalid value for 'goals', number of items must be greater than or equal to 1."; - } - - if ($this->container['goal'] === null) { - $invalidProperties[] = "'goal' can't be null"; - } - if ($this->container['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!is_null($this->container['goal_type']) && !in_array($this->container['goal_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'goal_type', must be one of '%s'", - $this->container['goal_type'], - implode("', '", $allowedValues) - ); - } - - 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 goals - * - * @return \PlausibleAnalyticsWPClient\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] - */ - public function getGoals() - { - return $this->container['goals']; - } - - /** - * Sets goals - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] $goals goals - * - * @return self - */ - public function setGoals($goals) - { - if (is_null($goals)) { - throw new \InvalidArgumentException('non-nullable goals cannot be null'); - } - - if ((count($goals) > 8)) { - throw new \InvalidArgumentException('invalid value for $goals when calling GoalCreateRequest., number of items must be less than or equal to 8.'); - } - if ((count($goals) < 1)) { - throw new \InvalidArgumentException('invalid length for $goals when calling GoalCreateRequest., number of items must be greater than or equal to 1.'); - } - $this->container['goals'] = $goals; - - return $this; - } - - /** - * Gets goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - - /** - * Gets goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!in_array($goal_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'goal_type', must be one of '%s'", - $goal_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreate.php b/src/Client/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreate.php deleted file mode 100644 index 5cb487fc..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreate.php +++ /dev/null @@ -1,428 +0,0 @@ - - */ -class GoalCreateRequestBulkGetOrCreate implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_CreateRequest_BulkGetOrCreate'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goals' => '\PlausibleAnalyticsWPClient\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goals' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goals' => 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 = [ - 'goals' => 'goals' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goals' => 'setGoals' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goals' => 'getGoals' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goals', $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['goals'] === null) { - $invalidProperties[] = "'goals' can't be null"; - } - if ((count($this->container['goals']) > 8)) { - $invalidProperties[] = "invalid value for 'goals', number of items must be less than or equal to 8."; - } - - if ((count($this->container['goals']) < 1)) { - $invalidProperties[] = "invalid value for 'goals', number of items must be greater than or equal to 1."; - } - - 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 goals - * - * @return \PlausibleAnalyticsWPClient\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] - */ - public function getGoals() - { - return $this->container['goals']; - } - - /** - * Sets goals - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] $goals goals - * - * @return self - */ - public function setGoals($goals) - { - if (is_null($goals)) { - throw new \InvalidArgumentException('non-nullable goals cannot be null'); - } - - if ((count($goals) > 8)) { - throw new \InvalidArgumentException('invalid value for $goals when calling GoalCreateRequestBulkGetOrCreate., number of items must be less than or equal to 8.'); - } - if ((count($goals) < 1)) { - throw new \InvalidArgumentException('invalid length for $goals when calling GoalCreateRequestBulkGetOrCreate., number of items must be greater than or equal to 1.'); - } - $this->container['goals'] = $goals; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.php b/src/Client/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.php deleted file mode 100644 index 08dff242..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.php +++ /dev/null @@ -1,481 +0,0 @@ - - */ -class GoalCreateRequestBulkGetOrCreateGoalsInner implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_CreateRequest_BulkGetOrCreate_goals_inner'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal', - 'goal_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal' => null, - 'goal_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal' => false, - 'goal_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 = [ - 'goal' => 'goal', - 'goal_type' => 'goal_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType' - ]; - - /** - * 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; - } - - public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getGoalTypeAllowableValues() - { - return [ - self::GOAL_TYPE_GOAL_PAGEVIEW, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal', $data ?? [], null); - $this->setIfExists('goal_type', $data ?? [], 'Goal.Pageview'); - } - - /** - * 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['goal'] === null) { - $invalidProperties[] = "'goal' can't be null"; - } - if ($this->container['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!is_null($this->container['goal_type']) && !in_array($this->container['goal_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'goal_type', must be one of '%s'", - $this->container['goal_type'], - implode("', '", $allowedValues) - ); - } - - 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 goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - - /** - * Gets goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!in_array($goal_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'goal_type', must be one of '%s'", - $goal_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequestCustomEvent.php b/src/Client/src/Client/lib/Model/GoalCreateRequestCustomEvent.php deleted file mode 100644 index adc9fe7d..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequestCustomEvent.php +++ /dev/null @@ -1,482 +0,0 @@ - - */ -class GoalCreateRequestCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.CreateRequest.CustomEvent'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalCreateRequestCustomEventGoal', - 'goal_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal' => null, - 'goal_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal' => false, - 'goal_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 = [ - 'goal' => 'goal', - 'goal_type' => 'goal_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType' - ]; - - /** - * 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; - } - - public const GOAL_TYPE_GOAL_CUSTOM_EVENT = 'Goal.CustomEvent'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getGoalTypeAllowableValues() - { - return [ - self::GOAL_TYPE_GOAL_CUSTOM_EVENT, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal', $data ?? [], null); - $this->setIfExists('goal_type', $data ?? [], 'Goal.CustomEvent'); - } - - /** - * 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['goal'] === null) { - $invalidProperties[] = "'goal' can't be null"; - } - if ($this->container['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!is_null($this->container['goal_type']) && !in_array($this->container['goal_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'goal_type', must be one of '%s'", - $this->container['goal_type'], - implode("', '", $allowedValues) - ); - } - - 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 goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalCreateRequestCustomEventGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequestCustomEventGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - - /** - * Gets goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!in_array($goal_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'goal_type', must be one of '%s'", - $goal_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequestCustomEventGoal.php b/src/Client/src/Client/lib/Model/GoalCreateRequestCustomEventGoal.php deleted file mode 100644 index 170ae777..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequestCustomEventGoal.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class GoalCreateRequestCustomEventGoal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_CreateRequest_CustomEvent_goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'event_name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'event_name' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'event_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 = [ - 'event_name' => 'event_name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'event_name' => 'setEventName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'event_name' => 'getEventName' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('event_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 = []; - - if ($this->container['event_name'] === null) { - $invalidProperties[] = "'event_name' 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 event_name - * - * @return string - */ - public function getEventName() - { - return $this->container['event_name']; - } - - /** - * Sets event_name - * - * @param string $event_name event_name - * - * @return self - */ - public function setEventName($event_name) - { - if (is_null($event_name)) { - throw new \InvalidArgumentException('non-nullable event_name cannot be null'); - } - $this->container['event_name'] = $event_name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequestPageview.php b/src/Client/src/Client/lib/Model/GoalCreateRequestPageview.php deleted file mode 100644 index 7f6ca1e3..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequestPageview.php +++ /dev/null @@ -1,482 +0,0 @@ - - */ -class GoalCreateRequestPageview implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.CreateRequest.Pageview'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal', - 'goal_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal' => null, - 'goal_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal' => false, - 'goal_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 = [ - 'goal' => 'goal', - 'goal_type' => 'goal_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType' - ]; - - /** - * 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; - } - - public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getGoalTypeAllowableValues() - { - return [ - self::GOAL_TYPE_GOAL_PAGEVIEW, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal', $data ?? [], null); - $this->setIfExists('goal_type', $data ?? [], 'Goal.Pageview'); - } - - /** - * 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['goal'] === null) { - $invalidProperties[] = "'goal' can't be null"; - } - if ($this->container['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!is_null($this->container['goal_type']) && !in_array($this->container['goal_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'goal_type', must be one of '%s'", - $this->container['goal_type'], - implode("', '", $allowedValues) - ); - } - - 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 goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequestPageviewGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - - /** - * Gets goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!in_array($goal_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'goal_type', must be one of '%s'", - $goal_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequestPageviewGoal.php b/src/Client/src/Client/lib/Model/GoalCreateRequestPageviewGoal.php deleted file mode 100644 index 71af68fc..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequestPageviewGoal.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class GoalCreateRequestPageviewGoal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_CreateRequest_Pageview_goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'path' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'path' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'path' => 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 = [ - 'path' => 'path' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'path' => 'setPath' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'path' => 'getPath' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('path', $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['path'] === null) { - $invalidProperties[] = "'path' 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 path - * - * @return string - */ - public function getPath() - { - return $this->container['path']; - } - - /** - * Sets path - * - * @param string $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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequestRevenue.php b/src/Client/src/Client/lib/Model/GoalCreateRequestRevenue.php deleted file mode 100644 index 69546d10..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequestRevenue.php +++ /dev/null @@ -1,482 +0,0 @@ - - */ -class GoalCreateRequestRevenue implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.CreateRequest.Revenue'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalCreateRequestRevenueGoal', - 'goal_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal' => null, - 'goal_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal' => false, - 'goal_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 = [ - 'goal' => 'goal', - 'goal_type' => 'goal_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType' - ]; - - /** - * 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; - } - - public const GOAL_TYPE_GOAL_REVENUE = 'Goal.Revenue'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getGoalTypeAllowableValues() - { - return [ - self::GOAL_TYPE_GOAL_REVENUE, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal', $data ?? [], null); - $this->setIfExists('goal_type', $data ?? [], 'Goal.Revenue'); - } - - /** - * 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['goal'] === null) { - $invalidProperties[] = "'goal' can't be null"; - } - if ($this->container['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!is_null($this->container['goal_type']) && !in_array($this->container['goal_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'goal_type', must be one of '%s'", - $this->container['goal_type'], - implode("', '", $allowedValues) - ); - } - - 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 goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalCreateRequestRevenueGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCreateRequestRevenueGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - - /** - * Gets goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $allowedValues = $this->getGoalTypeAllowableValues(); - if (!in_array($goal_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'goal_type', must be one of '%s'", - $goal_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCreateRequestRevenueGoal.php b/src/Client/src/Client/lib/Model/GoalCreateRequestRevenueGoal.php deleted file mode 100644 index d5e263d4..00000000 --- a/src/Client/src/Client/lib/Model/GoalCreateRequestRevenueGoal.php +++ /dev/null @@ -1,449 +0,0 @@ - - */ -class GoalCreateRequestRevenueGoal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_CreateRequest_Revenue_goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'currency' => 'string', - 'event_name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'currency' => null, - 'event_name' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'currency' => false, - 'event_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 = [ - 'currency' => 'currency', - 'event_name' => 'event_name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'currency' => 'setCurrency', - 'event_name' => 'setEventName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'currency' => 'getCurrency', - 'event_name' => 'getEventName' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('currency', $data ?? [], null); - $this->setIfExists('event_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 = []; - - if ($this->container['currency'] === null) { - $invalidProperties[] = "'currency' can't be null"; - } - if ($this->container['event_name'] === null) { - $invalidProperties[] = "'event_name' 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 currency - * - * @return string - */ - public function getCurrency() - { - return $this->container['currency']; - } - - /** - * Sets currency - * - * @param string $currency currency - * - * @return self - */ - public function setCurrency($currency) - { - if (is_null($currency)) { - throw new \InvalidArgumentException('non-nullable currency cannot be null'); - } - $this->container['currency'] = $currency; - - return $this; - } - - /** - * Gets event_name - * - * @return string - */ - public function getEventName() - { - return $this->container['event_name']; - } - - /** - * Sets event_name - * - * @param string $event_name event_name - * - * @return self - */ - public function setEventName($event_name) - { - if (is_null($event_name)) { - throw new \InvalidArgumentException('non-nullable event_name cannot be null'); - } - $this->container['event_name'] = $event_name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCustomEvent.php b/src/Client/src/Client/lib/Model/GoalCustomEvent.php deleted file mode 100644 index 944d1ef9..00000000 --- a/src/Client/src/Client/lib/Model/GoalCustomEvent.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class GoalCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.CustomEvent'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_type' => 'string', - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalCustomEventAllOfGoal' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_type' => null, - 'goal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_type' => false, - 'goal' => 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 = [ - 'goal_type' => 'goal_type', - 'goal' => 'goal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_type', $data ?? [], null); - $this->setIfExists('goal', $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['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - if ($this->container['goal'] === null) { - $invalidProperties[] = "'goal' 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 goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - - /** - * Gets goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalCustomEventAllOfGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalCustomEventAllOfGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalCustomEventAllOfGoal.php b/src/Client/src/Client/lib/Model/GoalCustomEventAllOfGoal.php deleted file mode 100644 index 33b06de1..00000000 --- a/src/Client/src/Client/lib/Model/GoalCustomEventAllOfGoal.php +++ /dev/null @@ -1,486 +0,0 @@ - - */ -class GoalCustomEventAllOfGoal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_CustomEvent_allOf_goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'display_name' => 'string', - 'event_name' => 'string', - 'id' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'display_name' => null, - 'event_name' => null, - 'id' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'display_name' => false, - 'event_name' => false, - '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 = [ - 'display_name' => 'display_name', - 'event_name' => 'event_name', - 'id' => 'id' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'display_name' => 'setDisplayName', - 'event_name' => 'setEventName', - 'id' => 'setId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'display_name' => 'getDisplayName', - 'event_name' => 'getEventName', - 'id' => 'getId' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('display_name', $data ?? [], null); - $this->setIfExists('event_name', $data ?? [], null); - $this->setIfExists('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 = []; - - if ($this->container['display_name'] === null) { - $invalidProperties[] = "'display_name' can't be null"; - } - if ($this->container['event_name'] === null) { - $invalidProperties[] = "'event_name' can't be null"; - } - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' 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 display_name - * - * @return string - */ - public function getDisplayName() - { - return $this->container['display_name']; - } - - /** - * Sets display_name - * - * @param string $display_name Display name - * - * @return self - */ - public function setDisplayName($display_name) - { - if (is_null($display_name)) { - throw new \InvalidArgumentException('non-nullable display_name cannot be null'); - } - $this->container['display_name'] = $display_name; - - return $this; - } - - /** - * Gets event_name - * - * @return string - */ - public function getEventName() - { - return $this->container['event_name']; - } - - /** - * Sets event_name - * - * @param string $event_name Event Name - * - * @return self - */ - public function setEventName($event_name) - { - if (is_null($event_name)) { - throw new \InvalidArgumentException('non-nullable event_name cannot be null'); - } - $this->container['event_name'] = $event_name; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Goal ID - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalDeleteBulkRequest.php b/src/Client/src/Client/lib/Model/GoalDeleteBulkRequest.php deleted file mode 100644 index 4adc23fa..00000000 --- a/src/Client/src/Client/lib/Model/GoalDeleteBulkRequest.php +++ /dev/null @@ -1,428 +0,0 @@ - - */ -class GoalDeleteBulkRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.DeleteBulkRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_ids' => 'int[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_ids' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_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 = [ - 'goal_ids' => 'goal_ids' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_ids' => 'setGoalIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_ids' => 'getGoalIds' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_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 = []; - - if ($this->container['goal_ids'] === null) { - $invalidProperties[] = "'goal_ids' can't be null"; - } - if ((count($this->container['goal_ids']) > 8)) { - $invalidProperties[] = "invalid value for 'goal_ids', number of items must be less than or equal to 8."; - } - - if ((count($this->container['goal_ids']) < 1)) { - $invalidProperties[] = "invalid value for 'goal_ids', number of items must be greater than or equal to 1."; - } - - 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 goal_ids - * - * @return int[] - */ - public function getGoalIds() - { - return $this->container['goal_ids']; - } - - /** - * Sets goal_ids - * - * @param int[] $goal_ids goal_ids - * - * @return self - */ - public function setGoalIds($goal_ids) - { - if (is_null($goal_ids)) { - throw new \InvalidArgumentException('non-nullable goal_ids cannot be null'); - } - - if ((count($goal_ids) > 8)) { - throw new \InvalidArgumentException('invalid value for $goal_ids when calling GoalDeleteBulkRequest., number of items must be less than or equal to 8.'); - } - if ((count($goal_ids) < 1)) { - throw new \InvalidArgumentException('invalid length for $goal_ids when calling GoalDeleteBulkRequest., number of items must be greater than or equal to 1.'); - } - $this->container['goal_ids'] = $goal_ids; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalListResponse.php b/src/Client/src/Client/lib/Model/GoalListResponse.php deleted file mode 100644 index 3150b66e..00000000 --- a/src/Client/src/Client/lib/Model/GoalListResponse.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class GoalListResponse implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.ListResponse'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goals' => '\PlausibleAnalyticsWPClient\Model\Goal[]', - 'meta' => '\PlausibleAnalyticsWPClient\Model\GoalListResponseMeta' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goals' => null, - 'meta' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goals' => false, - 'meta' => 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 = [ - 'goals' => 'goals', - 'meta' => 'meta' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goals' => 'setGoals', - 'meta' => 'setMeta' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goals' => 'getGoals', - 'meta' => 'getMeta' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goals', $data ?? [], null); - $this->setIfExists('meta', $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['goals'] === null) { - $invalidProperties[] = "'goals' can't be null"; - } - if ($this->container['meta'] === null) { - $invalidProperties[] = "'meta' 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 goals - * - * @return \PlausibleAnalyticsWPClient\Model\Goal[] - */ - public function getGoals() - { - return $this->container['goals']; - } - - /** - * Sets goals - * - * @param \PlausibleAnalyticsWPClient\Model\Goal[] $goals goals - * - * @return self - */ - public function setGoals($goals) - { - if (is_null($goals)) { - throw new \InvalidArgumentException('non-nullable goals cannot be null'); - } - $this->container['goals'] = $goals; - - return $this; - } - - /** - * Gets meta - * - * @return \PlausibleAnalyticsWPClient\Model\GoalListResponseMeta - */ - public function getMeta() - { - return $this->container['meta']; - } - - /** - * Sets meta - * - * @param \PlausibleAnalyticsWPClient\Model\GoalListResponseMeta $meta meta - * - * @return self - */ - public function setMeta($meta) - { - if (is_null($meta)) { - throw new \InvalidArgumentException('non-nullable meta cannot be null'); - } - $this->container['meta'] = $meta; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalListResponseMeta.php b/src/Client/src/Client/lib/Model/GoalListResponseMeta.php deleted file mode 100644 index f9f2a6f8..00000000 --- a/src/Client/src/Client/lib/Model/GoalListResponseMeta.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class GoalListResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_ListResponse_meta'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'pagination' => '\PlausibleAnalyticsWPClient\Model\PaginationMetadata' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'pagination' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'pagination' => 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 = [ - 'pagination' => 'pagination' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'pagination' => 'setPagination' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - '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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $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 = []; - - if ($this->container['pagination'] === null) { - $invalidProperties[] = "'pagination' 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 pagination - * - * @return \PlausibleAnalyticsWPClient\Model\PaginationMetadata - */ - public function getPagination() - { - return $this->container['pagination']; - } - - /** - * Sets pagination - * - * @param \PlausibleAnalyticsWPClient\Model\PaginationMetadata $pagination pagination - * - * @return self - */ - public function setPagination($pagination) - { - if (is_null($pagination)) { - throw new \InvalidArgumentException('non-nullable pagination cannot be null'); - } - $this->container['pagination'] = $pagination; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalPageview.php b/src/Client/src/Client/lib/Model/GoalPageview.php deleted file mode 100644 index 3e3c0ced..00000000 --- a/src/Client/src/Client/lib/Model/GoalPageview.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class GoalPageview implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.Pageview'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_type' => 'string', - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalPageviewAllOfGoal' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_type' => null, - 'goal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_type' => false, - 'goal' => 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 = [ - 'goal_type' => 'goal_type', - 'goal' => 'goal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_type', $data ?? [], null); - $this->setIfExists('goal', $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['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - if ($this->container['goal'] === null) { - $invalidProperties[] = "'goal' 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 goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - - /** - * Gets goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalPageviewAllOfGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalPageviewAllOfGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalPageviewAllOfGoal.php b/src/Client/src/Client/lib/Model/GoalPageviewAllOfGoal.php deleted file mode 100644 index 4aaf764b..00000000 --- a/src/Client/src/Client/lib/Model/GoalPageviewAllOfGoal.php +++ /dev/null @@ -1,486 +0,0 @@ - - */ -class GoalPageviewAllOfGoal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_Pageview_allOf_goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'display_name' => 'string', - 'id' => 'int', - 'path' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'display_name' => null, - 'id' => null, - 'path' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'display_name' => false, - 'id' => false, - 'path' => 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 = [ - 'display_name' => 'display_name', - 'id' => 'id', - 'path' => 'path' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'display_name' => 'setDisplayName', - 'id' => 'setId', - 'path' => 'setPath' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'display_name' => 'getDisplayName', - 'id' => 'getId', - 'path' => 'getPath' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('display_name', $data ?? [], null); - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('path', $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['display_name'] === null) { - $invalidProperties[] = "'display_name' can't be null"; - } - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - if ($this->container['path'] === null) { - $invalidProperties[] = "'path' 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 display_name - * - * @return string - */ - public function getDisplayName() - { - return $this->container['display_name']; - } - - /** - * Sets display_name - * - * @param string $display_name Display name - * - * @return self - */ - public function setDisplayName($display_name) - { - if (is_null($display_name)) { - throw new \InvalidArgumentException('non-nullable display_name cannot be null'); - } - $this->container['display_name'] = $display_name; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Goal ID - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets path - * - * @return string - */ - public function getPath() - { - return $this->container['path']; - } - - /** - * Sets path - * - * @param string $path Page 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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalRevenue.php b/src/Client/src/Client/lib/Model/GoalRevenue.php deleted file mode 100644 index ce6e4993..00000000 --- a/src/Client/src/Client/lib/Model/GoalRevenue.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class GoalRevenue implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.Revenue'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_type' => 'string', - 'goal' => '\PlausibleAnalyticsWPClient\Model\GoalRevenueAllOfGoal' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_type' => null, - 'goal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_type' => false, - 'goal' => 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 = [ - 'goal_type' => 'goal_type', - 'goal' => 'goal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_type', $data ?? [], null); - $this->setIfExists('goal', $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['goal_type'] === null) { - $invalidProperties[] = "'goal_type' can't be null"; - } - if ($this->container['goal'] === null) { - $invalidProperties[] = "'goal' 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 goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - - /** - * Gets goal - * - * @return \PlausibleAnalyticsWPClient\Model\GoalRevenueAllOfGoal - */ - public function getGoal() - { - return $this->container['goal']; - } - - /** - * Sets goal - * - * @param \PlausibleAnalyticsWPClient\Model\GoalRevenueAllOfGoal $goal goal - * - * @return self - */ - public function setGoal($goal) - { - if (is_null($goal)) { - throw new \InvalidArgumentException('non-nullable goal cannot be null'); - } - $this->container['goal'] = $goal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalRevenueAllOfGoal.php b/src/Client/src/Client/lib/Model/GoalRevenueAllOfGoal.php deleted file mode 100644 index e0544a2a..00000000 --- a/src/Client/src/Client/lib/Model/GoalRevenueAllOfGoal.php +++ /dev/null @@ -1,523 +0,0 @@ - - */ -class GoalRevenueAllOfGoal implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal_Revenue_allOf_goal'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'currency' => 'string', - 'display_name' => 'string', - 'event_name' => 'string', - 'id' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'currency' => null, - 'display_name' => null, - 'event_name' => null, - 'id' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'currency' => false, - 'display_name' => false, - 'event_name' => false, - '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 = [ - 'currency' => 'currency', - 'display_name' => 'display_name', - 'event_name' => 'event_name', - 'id' => 'id' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'currency' => 'setCurrency', - 'display_name' => 'setDisplayName', - 'event_name' => 'setEventName', - 'id' => 'setId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'currency' => 'getCurrency', - 'display_name' => 'getDisplayName', - 'event_name' => 'getEventName', - 'id' => 'getId' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('currency', $data ?? [], null); - $this->setIfExists('display_name', $data ?? [], null); - $this->setIfExists('event_name', $data ?? [], null); - $this->setIfExists('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 = []; - - if ($this->container['currency'] === null) { - $invalidProperties[] = "'currency' can't be null"; - } - if ($this->container['display_name'] === null) { - $invalidProperties[] = "'display_name' can't be null"; - } - if ($this->container['event_name'] === null) { - $invalidProperties[] = "'event_name' can't be null"; - } - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' 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 currency - * - * @return string - */ - public function getCurrency() - { - return $this->container['currency']; - } - - /** - * Sets currency - * - * @param string $currency Currency - * - * @return self - */ - public function setCurrency($currency) - { - if (is_null($currency)) { - throw new \InvalidArgumentException('non-nullable currency cannot be null'); - } - $this->container['currency'] = $currency; - - return $this; - } - - /** - * Gets display_name - * - * @return string - */ - public function getDisplayName() - { - return $this->container['display_name']; - } - - /** - * Sets display_name - * - * @param string $display_name Display name - * - * @return self - */ - public function setDisplayName($display_name) - { - if (is_null($display_name)) { - throw new \InvalidArgumentException('non-nullable display_name cannot be null'); - } - $this->container['display_name'] = $display_name; - - return $this; - } - - /** - * Gets event_name - * - * @return string - */ - public function getEventName() - { - return $this->container['event_name']; - } - - /** - * Sets event_name - * - * @param string $event_name Event Name - * - * @return self - */ - public function setEventName($event_name) - { - if (is_null($event_name)) { - throw new \InvalidArgumentException('non-nullable event_name cannot be null'); - } - $this->container['event_name'] = $event_name; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Goal ID - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/GoalType.php b/src/Client/src/Client/lib/Model/GoalType.php deleted file mode 100644 index 3d160fc4..00000000 --- a/src/Client/src/Client/lib/Model/GoalType.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class GoalType implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Goal.Type'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'goal_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'goal_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'goal_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 = [ - 'goal_type' => 'goal_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'goal_type' => 'setGoalType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'goal_type' => 'getGoalType' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('goal_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['goal_type'] === null) { - $invalidProperties[] = "'goal_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 goal_type - * - * @return string - */ - public function getGoalType() - { - return $this->container['goal_type']; - } - - /** - * Sets goal_type - * - * @param string $goal_type goal_type - * - * @return self - */ - public function setGoalType($goal_type) - { - if (is_null($goal_type)) { - throw new \InvalidArgumentException('non-nullable goal_type cannot be null'); - } - $this->container['goal_type'] = $goal_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/Link.php b/src/Client/src/Client/lib/Model/Link.php deleted file mode 100644 index 8f0a0a1e..00000000 --- a/src/Client/src/Client/lib/Model/Link.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class Link implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Link'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'url' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'url' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - '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 = [ - 'url' => 'url' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'url' => 'setUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - '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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $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 = []; - - if ($this->container['url'] === null) { - $invalidProperties[] = "'url' 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 url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $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 $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/ModelInterface.php b/src/Client/src/Client/lib/Model/ModelInterface.php deleted file mode 100644 index 88ff8601..00000000 --- a/src/Client/src/Client/lib/Model/ModelInterface.php +++ /dev/null @@ -1,111 +0,0 @@ - - */ -class NotFoundError implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'NotFoundError'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'errors' => '\PlausibleAnalyticsWPClient\Model\Error[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'errors' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => 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' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'errors' => 'setErrors' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'errors' => 'getErrors' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('errors', $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['errors'] === null) { - $invalidProperties[] = "'errors' 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 errors - * - * @return \PlausibleAnalyticsWPClient\Model\Error[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \PlausibleAnalyticsWPClient\Model\Error[] $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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/PaginationMetadata.php b/src/Client/src/Client/lib/Model/PaginationMetadata.php deleted file mode 100644 index 547039f2..00000000 --- a/src/Client/src/Client/lib/Model/PaginationMetadata.php +++ /dev/null @@ -1,484 +0,0 @@ - - */ -class PaginationMetadata implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PaginationMetadata'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'has_next_page' => 'bool', - 'has_prev_page' => 'bool', - 'links' => '\PlausibleAnalyticsWPClient\Model\PaginationMetadataLinks' - ]; - - /** - * 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, - 'links' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'has_next_page' => false, - 'has_prev_page' => false, - 'links' => 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', - 'links' => 'links' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'has_next_page' => 'setHasNextPage', - 'has_prev_page' => 'setHasPrevPage', - 'links' => 'setLinks' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'has_next_page' => 'getHasNextPage', - 'has_prev_page' => 'getHasPrevPage', - 'links' => 'getLinks' - ]; - - /** - * 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[] $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('links', $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['has_next_page'] === null) { - $invalidProperties[] = "'has_next_page' can't be null"; - } - if ($this->container['has_prev_page'] === null) { - $invalidProperties[] = "'has_prev_page' 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 has_next_page - * - * @return bool - */ - public function getHasNextPage() - { - return $this->container['has_next_page']; - } - - /** - * Sets has_next_page - * - * @param bool $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 - */ - public function getHasPrevPage() - { - return $this->container['has_prev_page']; - } - - /** - * Sets has_prev_page - * - * @param bool $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 links - * - * @return \PlausibleAnalyticsWPClient\Model\PaginationMetadataLinks|null - */ - public function getLinks() - { - return $this->container['links']; - } - - /** - * Sets links - * - * @param \PlausibleAnalyticsWPClient\Model\PaginationMetadataLinks|null $links links - * - * @return self - */ - public function setLinks($links) - { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); - } - $this->container['links'] = $links; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/PaginationMetadataLinks.php b/src/Client/src/Client/lib/Model/PaginationMetadataLinks.php deleted file mode 100644 index dae09572..00000000 --- a/src/Client/src/Client/lib/Model/PaginationMetadataLinks.php +++ /dev/null @@ -1,443 +0,0 @@ - - */ -class PaginationMetadataLinks implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PaginationMetadata_links'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'next' => '\PlausibleAnalyticsWPClient\Model\Link', - 'prev' => '\PlausibleAnalyticsWPClient\Model\Link' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'next' => null, - 'prev' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'next' => false, - 'prev' => 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 = [ - 'next' => 'next', - 'prev' => 'prev' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'next' => 'setNext', - 'prev' => 'setPrev' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'next' => 'getNext', - 'prev' => 'getPrev' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('next', $data ?? [], null); - $this->setIfExists('prev', $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 next - * - * @return \PlausibleAnalyticsWPClient\Model\Link|null - */ - public function getNext() - { - return $this->container['next']; - } - - /** - * Sets next - * - * @param \PlausibleAnalyticsWPClient\Model\Link|null $next next - * - * @return self - */ - public function setNext($next) - { - if (is_null($next)) { - throw new \InvalidArgumentException('non-nullable next cannot be null'); - } - $this->container['next'] = $next; - - return $this; - } - - /** - * Gets prev - * - * @return \PlausibleAnalyticsWPClient\Model\Link|null - */ - public function getPrev() - { - return $this->container['prev']; - } - - /** - * Sets prev - * - * @param \PlausibleAnalyticsWPClient\Model\Link|null $prev prev - * - * @return self - */ - public function setPrev($prev) - { - if (is_null($prev)) { - throw new \InvalidArgumentException('non-nullable prev cannot be null'); - } - $this->container['prev'] = $prev; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/PaymentRequiredError.php b/src/Client/src/Client/lib/Model/PaymentRequiredError.php deleted file mode 100644 index 732d1443..00000000 --- a/src/Client/src/Client/lib/Model/PaymentRequiredError.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class PaymentRequiredError implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PaymentRequiredError'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'errors' => '\PlausibleAnalyticsWPClient\Model\Error[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'errors' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => 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' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'errors' => 'setErrors' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'errors' => 'getErrors' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('errors', $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['errors'] === null) { - $invalidProperties[] = "'errors' 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 errors - * - * @return \PlausibleAnalyticsWPClient\Model\Error[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \PlausibleAnalyticsWPClient\Model\Error[] $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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/SharedLink.php b/src/Client/src/Client/lib/Model/SharedLink.php deleted file mode 100644 index 6334fb7b..00000000 --- a/src/Client/src/Client/lib/Model/SharedLink.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class SharedLink implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SharedLink'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'shared_link' => '\PlausibleAnalyticsWPClient\Model\SharedLinkSharedLink' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'shared_link' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'shared_link' => 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 = [ - 'shared_link' => 'shared_link' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'shared_link' => 'setSharedLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'shared_link' => 'getSharedLink' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('shared_link', $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['shared_link'] === null) { - $invalidProperties[] = "'shared_link' 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 shared_link - * - * @return \PlausibleAnalyticsWPClient\Model\SharedLinkSharedLink - */ - public function getSharedLink() - { - return $this->container['shared_link']; - } - - /** - * Sets shared_link - * - * @param \PlausibleAnalyticsWPClient\Model\SharedLinkSharedLink $shared_link shared_link - * - * @return self - */ - public function setSharedLink($shared_link) - { - if (is_null($shared_link)) { - throw new \InvalidArgumentException('non-nullable shared_link cannot be null'); - } - $this->container['shared_link'] = $shared_link; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/SharedLinkCreateRequest.php b/src/Client/src/Client/lib/Model/SharedLinkCreateRequest.php deleted file mode 100644 index b2f366c7..00000000 --- a/src/Client/src/Client/lib/Model/SharedLinkCreateRequest.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class SharedLinkCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SharedLink.CreateRequest'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'shared_link' => '\PlausibleAnalyticsWPClient\Model\SharedLinkCreateRequestSharedLink' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'shared_link' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'shared_link' => 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 = [ - 'shared_link' => 'shared_link' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'shared_link' => 'setSharedLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'shared_link' => 'getSharedLink' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('shared_link', $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['shared_link'] === null) { - $invalidProperties[] = "'shared_link' 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 shared_link - * - * @return \PlausibleAnalyticsWPClient\Model\SharedLinkCreateRequestSharedLink - */ - public function getSharedLink() - { - return $this->container['shared_link']; - } - - /** - * Sets shared_link - * - * @param \PlausibleAnalyticsWPClient\Model\SharedLinkCreateRequestSharedLink $shared_link shared_link - * - * @return self - */ - public function setSharedLink($shared_link) - { - if (is_null($shared_link)) { - throw new \InvalidArgumentException('non-nullable shared_link cannot be null'); - } - $this->container['shared_link'] = $shared_link; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php b/src/Client/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php deleted file mode 100644 index f154c80d..00000000 --- a/src/Client/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class SharedLinkCreateRequestSharedLink implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SharedLink_CreateRequest_shared_link'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'name' => 'string', - 'password' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'name' => null, - 'password' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'name' => false, - 'password' => 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 = [ - 'name' => 'name', - 'password' => 'password' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'password' => 'setPassword' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'password' => 'getPassword' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('password', $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['name'] === null) { - $invalidProperties[] = "'name' 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 name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Shared 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 password - * - * @return string|null - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string|null $password Shared Link 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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/SharedLinkListResponse.php b/src/Client/src/Client/lib/Model/SharedLinkListResponse.php deleted file mode 100644 index 05fa719d..00000000 --- a/src/Client/src/Client/lib/Model/SharedLinkListResponse.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class SharedLinkListResponse implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SharedLink.ListResponse'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'meta' => '\PlausibleAnalyticsWPClient\Model\GoalListResponseMeta', - 'shared_links' => '\PlausibleAnalyticsWPClient\Model\SharedLink[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'meta' => null, - 'shared_links' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'meta' => false, - 'shared_links' => 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 = [ - 'meta' => 'meta', - 'shared_links' => 'shared_links' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'meta' => 'setMeta', - 'shared_links' => 'setSharedLinks' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'meta' => 'getMeta', - 'shared_links' => 'getSharedLinks' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('meta', $data ?? [], null); - $this->setIfExists('shared_links', $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['meta'] === null) { - $invalidProperties[] = "'meta' can't be null"; - } - if ($this->container['shared_links'] === null) { - $invalidProperties[] = "'shared_links' 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 meta - * - * @return \PlausibleAnalyticsWPClient\Model\GoalListResponseMeta - */ - public function getMeta() - { - return $this->container['meta']; - } - - /** - * Sets meta - * - * @param \PlausibleAnalyticsWPClient\Model\GoalListResponseMeta $meta meta - * - * @return self - */ - public function setMeta($meta) - { - if (is_null($meta)) { - throw new \InvalidArgumentException('non-nullable meta cannot be null'); - } - $this->container['meta'] = $meta; - - return $this; - } - - /** - * Gets shared_links - * - * @return \PlausibleAnalyticsWPClient\Model\SharedLink[] - */ - public function getSharedLinks() - { - return $this->container['shared_links']; - } - - /** - * Sets shared_links - * - * @param \PlausibleAnalyticsWPClient\Model\SharedLink[] $shared_links shared_links - * - * @return self - */ - public function setSharedLinks($shared_links) - { - if (is_null($shared_links)) { - throw new \InvalidArgumentException('non-nullable shared_links cannot be null'); - } - $this->container['shared_links'] = $shared_links; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/SharedLinkSharedLink.php b/src/Client/src/Client/lib/Model/SharedLinkSharedLink.php deleted file mode 100644 index b81517a4..00000000 --- a/src/Client/src/Client/lib/Model/SharedLinkSharedLink.php +++ /dev/null @@ -1,523 +0,0 @@ - - */ -class SharedLinkSharedLink implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SharedLink_shared_link'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'href' => 'string', - 'id' => 'int', - 'name' => 'string', - 'password_protected' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'href' => null, - 'id' => null, - 'name' => null, - 'password_protected' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'href' => false, - 'id' => false, - 'name' => false, - 'password_protected' => 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 = [ - 'href' => 'href', - 'id' => 'id', - 'name' => 'name', - 'password_protected' => 'password_protected' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'href' => 'setHref', - 'id' => 'setId', - 'name' => 'setName', - 'password_protected' => 'setPasswordProtected' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'href' => 'getHref', - 'id' => 'getId', - 'name' => 'getName', - 'password_protected' => 'getPasswordProtected' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('href', $data ?? [], null); - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('password_protected', $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['href'] === null) { - $invalidProperties[] = "'href' can't be null"; - } - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['password_protected'] === null) { - $invalidProperties[] = "'password_protected' 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 href - * - * @return string - */ - public function getHref() - { - return $this->container['href']; - } - - /** - * Sets href - * - * @param string $href Shared Link URL - * - * @return self - */ - public function setHref($href) - { - if (is_null($href)) { - throw new \InvalidArgumentException('non-nullable href cannot be null'); - } - $this->container['href'] = $href; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Shared Link ID - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Shared 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 password_protected - * - * @return bool - */ - public function getPasswordProtected() - { - return $this->container['password_protected']; - } - - /** - * Sets password_protected - * - * @param bool $password_protected Shared Link Has Password - * - * @return self - */ - public function setPasswordProtected($password_protected) - { - if (is_null($password_protected)) { - throw new \InvalidArgumentException('non-nullable password_protected cannot be null'); - } - $this->container['password_protected'] = $password_protected; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/UnauthorizedError.php b/src/Client/src/Client/lib/Model/UnauthorizedError.php deleted file mode 100644 index 0777c16e..00000000 --- a/src/Client/src/Client/lib/Model/UnauthorizedError.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class UnauthorizedError implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'UnauthorizedError'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'errors' => '\PlausibleAnalyticsWPClient\Model\Error[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'errors' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => 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' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'errors' => 'setErrors' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'errors' => 'getErrors' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('errors', $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['errors'] === null) { - $invalidProperties[] = "'errors' 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 errors - * - * @return \PlausibleAnalyticsWPClient\Model\Error[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \PlausibleAnalyticsWPClient\Model\Error[] $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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/Model/UnprocessableEntityError.php b/src/Client/src/Client/lib/Model/UnprocessableEntityError.php deleted file mode 100644 index c00082f4..00000000 --- a/src/Client/src/Client/lib/Model/UnprocessableEntityError.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class UnprocessableEntityError implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'UnprocessableEntityError'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'errors' => '\PlausibleAnalyticsWPClient\Model\Error[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'errors' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => 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' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'errors' => 'setErrors' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'errors' => 'getErrors' - ]; - - /** - * 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[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('errors', $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['errors'] === null) { - $invalidProperties[] = "'errors' 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 errors - * - * @return \PlausibleAnalyticsWPClient\Model\Error[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \PlausibleAnalyticsWPClient\Model\Error[] $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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($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 $offset Offset - * - * @return void - */ - public function offsetUnset($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/src/Client/lib/ObjectSerializer.php b/src/Client/src/Client/lib/ObjectSerializer.php deleted file mode 100644 index 192300b3..00000000 --- a/src/Client/src/Client/lib/ObjectSerializer.php +++ /dev/null @@ -1,567 +0,0 @@ -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 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') ? $prop = "{$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); - - 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 http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - 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 string|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[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used - * - * @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 = '\PlausibleAnalyticsWPClient\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; - } - } - - /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); - } -} diff --git a/src/Client/src/Client/phpunit.xml.dist b/src/Client/src/Client/phpunit.xml.dist deleted file mode 100644 index 485899aa..00000000 --- a/src/Client/src/Client/phpunit.xml.dist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - ./lib/Api - ./lib/Model - - - - - ./test/Api - ./test/Model - - - - - -