From d52de9891259e9caf4f4aac6029a4f7269b68530 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:13:01 +0100 Subject: [PATCH 01/32] Include openapi-generator-cli in package.json. --- npm-shrinkwrap.json | 2710 ++++++++++++++++++++++++++++++++++++++++++- package.json | 93 +- 2 files changed, 2729 insertions(+), 74 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 18fee8f..b054283 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -17,6 +17,7 @@ "@babel/preset-env": "^7.22.20", "@babel/runtime": "^7.18.9", "@es-joy/jsdoccomment": "0.31.0", + "@openapitools/openapi-generator-cli": "*", "@prettier/plugin-php": "^0.18.9", "@tailwindcss/forms": "^0.5.7", "@wordpress/eslint-plugin": "^12.5.0", @@ -97,6 +98,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -1628,6 +1630,17 @@ "node": ">=6.9.0" } }, + "node_modules/@borewit/text-codec": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.1.1.tgz", + "integrity": "sha512-5L/uBxmjaCIX5h8Z+uu+kA9BQLkc/Wl06UGR5ajNRxu+/XjonB5i8JpgFMrPj3LXTCPA0pv8yxUvbUi+QthGGA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/@csstools/selector-specificity": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.2.0.tgz", @@ -1797,6 +1810,28 @@ "deprecated": "Use @eslint/object-schema instead", "dev": true }, + "node_modules/@inquirer/external-editor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.3.tgz", + "integrity": "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^2.1.1", + "iconv-lite": "^0.7.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, "node_modules/@isaacs/balanced-match": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", @@ -1902,6 +1937,16 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@lukeed/csprng": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", + "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -1965,6 +2010,241 @@ "node": ">= 8" } }, + "node_modules/@nuxt/opencollective": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@nuxt/opencollective/-/opencollective-0.4.1.tgz", + "integrity": "sha512-GXD3wy50qYbxCJ652bDrDzgMr3NFEkIS374+IgFQKkCvk9yiYcLvX2XDYr7UyQxf4wK0e+yqDYRubZ0DtOxnmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "consola": "^3.2.3" + }, + "bin": { + "opencollective": "bin/opencollective.js" + }, + "engines": { + "node": "^14.18.0 || >=16.10.0", + "npm": ">=5.10.0" + } + }, + "node_modules/@nuxt/opencollective/node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, + "node_modules/@nuxtjs/opencollective": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@nuxtjs/opencollective/-/opencollective-0.3.2.tgz", + "integrity": "sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "consola": "^2.15.0", + "node-fetch": "^2.6.1" + }, + "bin": { + "opencollective": "bin/opencollective.js" + }, + "engines": { + "node": ">=8.0.0", + "npm": ">=5.0.0" + } + }, + "node_modules/@openapitools/openapi-generator-cli": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.25.2.tgz", + "integrity": "sha512-TXElbW1NXCy0EECXiO5AD2ZzT1dmaCs41Z8t3pBUGaJf8zgF/Lm0P6GRhVEpw29iHBNjZcy8nrgQ1acUfuCdng==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@nestjs/axios": "4.0.1", + "@nestjs/common": "11.1.9", + "@nestjs/core": "11.1.9", + "@nuxtjs/opencollective": "0.3.2", + "axios": "1.13.2", + "chalk": "4.1.2", + "commander": "8.3.0", + "compare-versions": "6.1.1", + "concurrently": "9.2.1", + "console.table": "0.10.0", + "fs-extra": "11.3.2", + "glob": "13.0.0", + "inquirer": "8.2.7", + "proxy-agent": "6.5.0", + "reflect-metadata": "0.2.2", + "rxjs": "7.8.2", + "tslib": "2.8.1" + }, + "bin": { + "openapi-generator-cli": "main.js" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/openapi_generator" + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/@nestjs/axios": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-4.0.1.tgz", + "integrity": "sha512-68pFJgu+/AZbWkGu65Z3r55bTsCPlgyKaV4BSG8yUAD72q1PPuyVRgUwFv6BxdnibTUHlyxm06FmYWNC+bjN7A==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@nestjs/common": "^10.0.0 || ^11.0.0", + "axios": "^1.3.1", + "rxjs": "^7.0.0" + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/@nestjs/common": { + "version": "11.1.9", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.9.tgz", + "integrity": "sha512-zDntUTReRbAThIfSp3dQZ9kKqI+LjgLp5YZN5c1bgNRDuoeLySAoZg46Bg1a+uV8TMgIRziHocglKGNzr6l+bQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "file-type": "21.1.0", + "iterare": "1.2.1", + "load-esm": "1.0.3", + "tslib": "2.8.1", + "uid": "2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "class-transformer": ">=0.4.1", + "class-validator": ">=0.13.2", + "reflect-metadata": "^0.1.12 || ^0.2.0", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "class-transformer": { + "optional": true + }, + "class-validator": { + "optional": true + } + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/@nestjs/core": { + "version": "11.1.9", + "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-11.1.9.tgz", + "integrity": "sha512-a00B0BM4X+9z+t3UxJqIZlemIwCQdYoPKrMcM+ky4z3pkqqG1eTWexjs+YXpGObnLnjtMPVKWlcZHp3adDYvUw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@nuxt/opencollective": "0.4.1", + "fast-safe-stringify": "2.1.1", + "iterare": "1.2.1", + "path-to-regexp": "8.3.0", + "tslib": "2.8.1", + "uid": "2.0.2" + }, + "engines": { + "node": ">= 20" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "@nestjs/common": "^11.0.0", + "@nestjs/microservices": "^11.0.0", + "@nestjs/platform-express": "^11.0.0", + "@nestjs/websockets": "^11.0.0", + "reflect-metadata": "^0.1.12 || ^0.2.0", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "@nestjs/microservices": { + "optional": true + }, + "@nestjs/platform-express": { + "optional": true + }, + "@nestjs/websockets": { + "optional": true + } + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/compare-versions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz", + "integrity": "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/file-type": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-21.1.0.tgz", + "integrity": "sha512-boU4EHmP3JXkwDo4uhyBhTt5pPstxB6eEXKJBu2yu2l7aAMMm7QQYQEzssJmKReZYrFdFOJS8koVo6bXIBGDqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tokenizer/inflate": "^0.3.1", + "strtok3": "^10.3.1", + "token-types": "^6.0.0", + "uint8array-extras": "^1.4.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/glob": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz", + "integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^10.1.1", + "minipass": "^7.1.2", + "path-scurry": "^2.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@prettier/plugin-php": { "version": "0.18.9", "resolved": "https://registry.npmjs.org/@prettier/plugin-php/-/plugin-php-0.18.9.tgz", @@ -2151,6 +2431,39 @@ "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1 || >= 4.0.0-alpha.20 || >= 4.0.0-beta.1" } }, + "node_modules/@tokenizer/inflate": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.3.1.tgz", + "integrity": "sha512-4oeoZEBQdLdt5WmP/hx1KZ6D3/Oid/0cUb2nk4F0pTDAWy+KCH3/EnAkZF/bvckWo8I33EqBm01lIPgmgc8rCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.4.1", + "fflate": "^0.8.2", + "token-types": "^6.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "dev": true, + "license": "MIT" + }, "node_modules/@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", @@ -2299,6 +2612,7 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", "dev": true, + "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -2332,6 +2646,7 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.90.tgz", "integrity": "sha512-P9beVR/x06U9rCJzSxtENnOr4BrbJ6VrsrDTc+73TtHv9XHhryXKbjGRB+6oooB2r0G/pQkD/S4dHo/7jUfwFw==", "dev": true, + "peer": true, "dependencies": { "@types/prop-types": "*", "@types/scheduler": "^0.16", @@ -2509,6 +2824,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", "dev": true, + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "5.62.0", "@typescript-eslint/types": "5.62.0", @@ -3119,6 +3435,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -3147,6 +3464,16 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -3174,6 +3501,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3617,6 +3945,19 @@ "node": ">=0.10.0" } }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/ast-types-flow": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz", @@ -3656,6 +3997,13 @@ "integrity": "sha512-t5kQ/BRlYTNG2GsQue48DeKByahFGGHtC8w7LCEl1sGHbAgpthKXX6U2GL1t6xI89rWxCDc/xzEOW/8ObrZH0Q==", "dev": true }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, "node_modules/atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -3729,6 +4077,19 @@ "node": ">=4" } }, + "node_modules/axios": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz", + "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/axobject-query": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", @@ -3879,6 +4240,16 @@ "baseline-browser-mapping": "dist/cli.js" } }, + "node_modules/basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -4316,6 +4687,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -4715,6 +5087,13 @@ "tslib": "^2.0.3" } }, + "node_modules/chardet": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.1.1.tgz", + "integrity": "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==", + "dev": true, + "license": "MIT" + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -4842,6 +5221,19 @@ "node": ">=4" } }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cli-truncate": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-0.2.1.tgz", @@ -4855,6 +5247,91 @@ "node": ">=0.10.0" } }, + "node_modules/cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 10" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, "node_modules/clone-deep": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", @@ -5071,6 +5548,19 @@ "node": ">=0.1.90" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -5113,6 +5603,57 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/concurrently": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.1.tgz", + "integrity": "sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "4.1.2", + "rxjs": "7.8.2", + "shell-quote": "1.8.3", + "supports-color": "8.1.1", + "tree-kill": "1.2.2", + "yargs": "17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/config-chain": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", @@ -5123,12 +5664,32 @@ "proto-list": "~1.2.1" } }, + "node_modules/consola": { + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz", + "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==", + "dev": true, + "license": "MIT" + }, "node_modules/console-stream": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/console-stream/-/console-stream-0.1.1.tgz", "integrity": "sha512-QC/8l9e6ofi6nqZ5PawlDgzmMw3OxIXtvolBzap/F4UDBJlDaZRSNbL/lb41C29FcbSJncBFlJFj2WJoNyZRfQ==", "dev": true }, + "node_modules/console.table": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/console.table/-/console.table-0.10.0.tgz", + "integrity": "sha512-dPyZofqggxuvSf7WXvNjuRfnsOk1YazkVP8FdxH4tcH2c37wc79/Yl6Bhr7Lsu00KMgy2ql/qCMuNu8xctZM8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "easy-table": "1.1.0" + }, + "engines": { + "node": "> 0.10" + } + }, "node_modules/constant-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", @@ -5196,6 +5757,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -5479,6 +6041,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -5801,6 +6364,16 @@ "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", "dev": true }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/data-view-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", @@ -6099,6 +6672,19 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -6146,6 +6732,21 @@ "node": ">=0.10.0" } }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/del": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", @@ -6201,6 +6802,16 @@ "node": ">=0.10.0" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -6395,6 +7006,16 @@ "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==", "dev": true }, + "node_modules/easy-table": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.1.0.tgz", + "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "wcwidth": ">=1.0.1" + } + }, "node_modules/electron-to-chromium": { "version": "1.5.266", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.266.tgz", @@ -6682,12 +7303,35 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, "node_modules/eslint": { "version": "8.57.1", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -7605,6 +8249,13 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", @@ -7666,6 +8317,13 @@ "pend": "~1.2.0" } }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "dev": true, + "license": "MIT" + }, "node_modules/figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", @@ -7900,6 +8558,27 @@ "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", @@ -7924,6 +8603,23 @@ "node": ">=0.10.0" } }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fraction.js": { "version": "5.3.4", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", @@ -7965,6 +8661,21 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, + "node_modules/fs-extra": { + "version": "11.3.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.2.tgz", + "integrity": "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -8041,6 +8752,16 @@ "node": ">=6.9.0" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -8131,6 +8852,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-uri": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", + "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -8713,6 +9449,34 @@ "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", "dev": true }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/husky": { "version": "4.3.8", "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz", @@ -8755,6 +9519,23 @@ "node": ">=10" } }, + "node_modules/iconv-lite": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/icss-utils": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", @@ -9650,6 +10431,198 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "node_modules/inquirer": { + "version": "8.2.7", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.7.tgz", + "integrity": "sha512-UjOaSel/iddGZJ5xP/Eixh6dY1XghiBw4XK13rCCIJcJfyhhoul/7KhLLUGtebEj6GDYM6Vnx/mVsjx2L/mFIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/external-editor": "^1.0.0", + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.5.5", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6", + "wrap-ansi": "^6.0.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/inquirer/node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/inquirer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/inquirer/node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/inquirer/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/inquirer/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/internal-slot": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", @@ -9686,6 +10659,16 @@ "node": ">=4" } }, + "node_modules/ip-address": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, "node_modules/is-absolute-url": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", @@ -10021,6 +11004,16 @@ "node": ">=0.10.0" } }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-jpg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-jpg/-/is-jpg-2.0.0.tgz", @@ -10331,6 +11324,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -10423,6 +11429,16 @@ "node": ">= 4" } }, + "node_modules/iterare": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", + "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=6" + } + }, "node_modules/iterator.prototype": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", @@ -10616,6 +11632,19 @@ "node": ">=6" } }, + "node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/jsx-ast-utils": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", @@ -11038,6 +12067,7 @@ "resolved": "https://registry.npmjs.org/listr/-/listr-0.14.3.tgz", "integrity": "sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA==", "dev": true, + "peer": true, "dependencies": { "@samverschueren/stream-to-observable": "^0.3.0", "is-observable": "^1.1.0", @@ -11258,6 +12288,26 @@ "node": ">=4" } }, + "node_modules/load-esm": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/load-esm/-/load-esm-1.0.3.tgz", + "integrity": "sha512-v5xlu8eHD1+6r8EHTg6hfmO97LN8ugKtiXcy5e6oN72iD2r6u0RPfLl6fxM+7Wnh2ZRq15o0russMst44WauPA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + { + "type": "buymeacoffee", + "url": "https://buymeacoffee.com/borewit" + } + ], + "license": "MIT", + "engines": { + "node": ">=13.2.0" + } + }, "node_modules/load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -11886,6 +12936,16 @@ "node": ">= 6" } }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -11926,6 +12986,13 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true, + "license": "ISC" + }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -11995,6 +13062,16 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -12011,6 +13088,27 @@ "tslib": "^2.0.3" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-releases": { "version": "2.0.27", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", @@ -12426,6 +13524,127 @@ "node": ">=6" } }, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/ora/node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ora/node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ora/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ora/node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/os-filter-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/os-filter-obj/-/os-filter-obj-2.0.0.tgz", @@ -12593,6 +13812,40 @@ "node": ">=6" } }, + "node_modules/pac-proxy-agent": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", + "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.6", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dev": true, + "license": "MIT", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", @@ -12707,12 +13960,50 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-scurry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz", + "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.4.tgz", + "integrity": "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/path-sort": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/path-sort/-/path-sort-0.1.0.tgz", "integrity": "sha512-70MSq7edKtbODYKkqXYzSMQxtYMjDgP3K6D15Fu4KUvpyBPlxDWPvv8JI9GjNDF2K5baPHFEtlg818dOmf2ifg==", "dev": true }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -13005,6 +14296,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -13705,6 +14997,7 @@ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", "dev": true, + "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -13914,6 +15207,7 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, + "peer": true, "bin": { "prettier": "bin-prettier.js" }, @@ -13959,6 +15253,43 @@ "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", "dev": true }, + "node_modules/proxy-agent": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz", + "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.6", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.1.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true, + "license": "MIT" + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -14058,6 +15389,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", "dev": true, + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" @@ -14255,6 +15587,14 @@ "node": ">=0.10.0" } }, + "node_modules/reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", + "dev": true, + "license": "Apache-2.0", + "peer": true + }, "node_modules/reflect.getprototypeof": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", @@ -14417,6 +15757,16 @@ "node": ">= 0.10" } }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -14668,6 +16018,16 @@ "node": ">=4" } }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -14790,6 +16150,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, "node_modules/sax": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.3.tgz", @@ -15041,6 +16408,19 @@ "node": ">=8" } }, + "node_modules/shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -15152,6 +16532,17 @@ "node": ">=0.10.0" } }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, "node_modules/snake-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", @@ -15301,6 +16692,36 @@ "node": ">=0.10.0" } }, + "node_modules/socks": { + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", + "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ip-address": "^10.0.1", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/sort-keys": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", @@ -15866,6 +17287,23 @@ } ] }, + "node_modules/strtok3": { + "version": "10.3.4", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.4.tgz", + "integrity": "sha512-KIy5nylvC5le1OdaaoCJ07L+8iQzJHGH6pWDuzS+d07Cu7n1MZ2x26P8ZKIWfbK02+XIL8Mp4RkWeqdUCrDMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tokenizer/token": "^0.3.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/style-loader": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.4.tgz", @@ -15909,6 +17347,7 @@ "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.16.1.tgz", "integrity": "sha512-ErlzR/T3hhbV+a925/gbfc3f3Fep9/bnspMiJPorfGEmcBbXdS+oo6LrVtoUZ/w9fqD6o6k7PtUlCOsCRdjX/A==", "dev": true, + "peer": true, "dependencies": { "@csstools/selector-specificity": "^2.0.2", "balanced-match": "^2.0.0", @@ -16645,6 +18084,7 @@ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.18.tgz", "integrity": "sha512-6A2rnmW5xZMdw11LYjhcI5846rt9pbLSabY5XPxo+XWdxwZaFEn47Go4NzFiHu9sNNmr/kXivP1vStfvMaK1GQ==", "dev": true, + "peer": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -16731,23 +18171,6 @@ } } }, - "node_modules/tailwindcss/node_modules/yaml": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", - "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", - "dev": true, - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14.6" - }, - "funding": { - "url": "https://github.com/sponsors/eemeli" - } - }, "node_modules/tapable": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", @@ -16858,6 +18281,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -17021,6 +18445,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, + "peer": true, "engines": { "node": ">=12" }, @@ -17093,6 +18518,42 @@ "node": ">=8.0" } }, + "node_modules/token-types": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.1.tgz", + "integrity": "sha512-kh9LVIWH5CnL63Ipf0jhlBIy0UsrMj/NJDfpsy1SqOXlLKEVyXXYrnFxFT1yOOYVGBSApeVnjPw/sBz5BfEjAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@borewit/text-codec": "^0.1.0", + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, "node_modules/trim-newlines": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", @@ -17313,6 +18774,32 @@ "node": ">=14.17" } }, + "node_modules/uid": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", + "integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@lukeed/csprng": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/uint8array-extras": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.5.0.tgz", + "integrity": "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", @@ -17423,6 +18910,16 @@ "integrity": "sha512-mZdDpf3vBV5Efh29kMw5tXoup/buMgxLzOt/XKFKcVmi+15ManNQWr6HfZ2aiZTYlYixbdNJ0KFmIZIv52tHSQ==", "dev": true }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/unquote": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", @@ -17658,11 +19155,29 @@ "node": ">=10.13.0" } }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dev": true, + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true, + "license": "BSD-2-Clause" + }, "node_modules/webpack": { "version": "5.103.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.103.0.tgz", "integrity": "sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==", "dev": true, + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -17711,6 +19226,7 @@ "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", "dev": true, + "peer": true, "dependencies": { "@discoveryjs/json-ext": "^0.5.0", "@webpack-cli/configtest": "^1.2.0", @@ -18761,6 +20277,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -18818,6 +20335,17 @@ "node": ">=10.13.0" } }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -19138,6 +20666,16 @@ "node": ">=0.4" } }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", @@ -19153,6 +20691,25 @@ "node": ">= 6" } }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/yargs-parser": { "version": "20.2.9", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", @@ -19162,6 +20719,48 @@ "node": ">=10" } }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, "node_modules/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", @@ -19214,6 +20813,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, + "peer": true, "requires": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -20234,6 +21834,12 @@ "@babel/helper-validator-identifier": "^7.28.5" } }, + "@borewit/text-codec": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.1.1.tgz", + "integrity": "sha512-5L/uBxmjaCIX5h8Z+uu+kA9BQLkc/Wl06UGR5ajNRxu+/XjonB5i8JpgFMrPj3LXTCPA0pv8yxUvbUi+QthGGA==", + "dev": true + }, "@csstools/selector-specificity": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.2.0.tgz", @@ -20349,6 +21955,16 @@ "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, + "@inquirer/external-editor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.3.tgz", + "integrity": "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA==", + "dev": true, + "requires": { + "chardet": "^2.1.1", + "iconv-lite": "^0.7.0" + } + }, "@isaacs/balanced-match": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", @@ -20439,6 +22055,12 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@lukeed/csprng": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", + "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", + "dev": true + }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -20492,6 +22114,141 @@ "fastq": "^1.6.0" } }, + "@nuxt/opencollective": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@nuxt/opencollective/-/opencollective-0.4.1.tgz", + "integrity": "sha512-GXD3wy50qYbxCJ652bDrDzgMr3NFEkIS374+IgFQKkCvk9yiYcLvX2XDYr7UyQxf4wK0e+yqDYRubZ0DtOxnmQ==", + "dev": true, + "requires": { + "consola": "^3.2.3" + }, + "dependencies": { + "consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true + } + } + }, + "@nuxtjs/opencollective": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@nuxtjs/opencollective/-/opencollective-0.3.2.tgz", + "integrity": "sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "consola": "^2.15.0", + "node-fetch": "^2.6.1" + } + }, + "@openapitools/openapi-generator-cli": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.25.2.tgz", + "integrity": "sha512-TXElbW1NXCy0EECXiO5AD2ZzT1dmaCs41Z8t3pBUGaJf8zgF/Lm0P6GRhVEpw29iHBNjZcy8nrgQ1acUfuCdng==", + "dev": true, + "requires": { + "@nestjs/axios": "4.0.1", + "@nestjs/common": "11.1.9", + "@nestjs/core": "11.1.9", + "@nuxtjs/opencollective": "0.3.2", + "axios": "1.13.2", + "chalk": "4.1.2", + "commander": "8.3.0", + "compare-versions": "6.1.1", + "concurrently": "9.2.1", + "console.table": "0.10.0", + "fs-extra": "11.3.2", + "glob": "13.0.0", + "inquirer": "8.2.7", + "proxy-agent": "6.5.0", + "reflect-metadata": "0.2.2", + "rxjs": "7.8.2", + "tslib": "2.8.1" + }, + "dependencies": { + "@nestjs/axios": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-4.0.1.tgz", + "integrity": "sha512-68pFJgu+/AZbWkGu65Z3r55bTsCPlgyKaV4BSG8yUAD72q1PPuyVRgUwFv6BxdnibTUHlyxm06FmYWNC+bjN7A==", + "dev": true, + "requires": {} + }, + "@nestjs/common": { + "version": "11.1.9", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.9.tgz", + "integrity": "sha512-zDntUTReRbAThIfSp3dQZ9kKqI+LjgLp5YZN5c1bgNRDuoeLySAoZg46Bg1a+uV8TMgIRziHocglKGNzr6l+bQ==", + "dev": true, + "peer": true, + "requires": { + "file-type": "21.1.0", + "iterare": "1.2.1", + "load-esm": "1.0.3", + "tslib": "2.8.1", + "uid": "2.0.2" + } + }, + "@nestjs/core": { + "version": "11.1.9", + "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-11.1.9.tgz", + "integrity": "sha512-a00B0BM4X+9z+t3UxJqIZlemIwCQdYoPKrMcM+ky4z3pkqqG1eTWexjs+YXpGObnLnjtMPVKWlcZHp3adDYvUw==", + "dev": true, + "requires": { + "@nuxt/opencollective": "0.4.1", + "fast-safe-stringify": "2.1.1", + "iterare": "1.2.1", + "path-to-regexp": "8.3.0", + "tslib": "2.8.1", + "uid": "2.0.2" + } + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true + }, + "compare-versions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz", + "integrity": "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==", + "dev": true + }, + "file-type": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-21.1.0.tgz", + "integrity": "sha512-boU4EHmP3JXkwDo4uhyBhTt5pPstxB6eEXKJBu2yu2l7aAMMm7QQYQEzssJmKReZYrFdFOJS8koVo6bXIBGDqA==", + "dev": true, + "requires": { + "@tokenizer/inflate": "^0.3.1", + "strtok3": "^10.3.1", + "token-types": "^6.0.0", + "uint8array-extras": "^1.4.0" + } + }, + "glob": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz", + "integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==", + "dev": true, + "requires": { + "minimatch": "^10.1.1", + "minipass": "^7.1.2", + "path-scurry": "^2.0.0" + } + }, + "rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "peer": true, + "requires": { + "tslib": "^2.1.0" + } + } + } + }, "@prettier/plugin-php": { "version": "0.18.9", "resolved": "https://registry.npmjs.org/@prettier/plugin-php/-/plugin-php-0.18.9.tgz", @@ -20632,6 +22389,29 @@ "mini-svg-data-uri": "^1.2.3" } }, + "@tokenizer/inflate": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.3.1.tgz", + "integrity": "sha512-4oeoZEBQdLdt5WmP/hx1KZ6D3/Oid/0cUb2nk4F0pTDAWy+KCH3/EnAkZF/bvckWo8I33EqBm01lIPgmgc8rCA==", + "dev": true, + "requires": { + "debug": "^4.4.1", + "fflate": "^0.8.2", + "token-types": "^6.0.0" + } + }, + "@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", + "dev": true + }, + "@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "dev": true + }, "@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", @@ -20776,6 +22556,7 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", "dev": true, + "peer": true, "requires": { "undici-types": "~7.16.0" } @@ -20809,6 +22590,7 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.90.tgz", "integrity": "sha512-P9beVR/x06U9rCJzSxtENnOr4BrbJ6VrsrDTc+73TtHv9XHhryXKbjGRB+6oooB2r0G/pQkD/S4dHo/7jUfwFw==", "dev": true, + "peer": true, "requires": { "@types/prop-types": "*", "@types/scheduler": "^0.16", @@ -20952,6 +22734,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", "dev": true, + "peer": true, "requires": { "@typescript-eslint/scope-manager": "5.62.0", "@typescript-eslint/types": "5.62.0", @@ -21395,7 +23178,8 @@ "version": "8.15.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", - "dev": true + "dev": true, + "peer": true }, "acorn-import-phases": { "version": "1.0.4", @@ -21411,6 +23195,12 @@ "dev": true, "requires": {} }, + "agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true + }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -21434,6 +23224,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "peer": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -21744,6 +23535,15 @@ "integrity": "sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==", "dev": true }, + "ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dev": true, + "requires": { + "tslib": "^2.0.1" + } + }, "ast-types-flow": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz", @@ -21777,6 +23577,12 @@ "integrity": "sha512-t5kQ/BRlYTNG2GsQue48DeKByahFGGHtC8w7LCEl1sGHbAgpthKXX6U2GL1t6xI89rWxCDc/xzEOW/8ObrZH0Q==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -21812,6 +23618,18 @@ "integrity": "sha512-ilYanEU8vxxBexpJd8cWM4ElSQq4QctCLKih0TSfjIfCQTeyH/6zVrmIJfLPrKTKJRbiG+cfnZbQIjAlJmF1jQ==", "dev": true }, + "axios": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz", + "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==", + "dev": true, + "peer": true, + "requires": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, "axobject-query": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", @@ -21922,6 +23740,12 @@ "integrity": "sha512-ZCQ9GEWl73BVm8bu5Fts8nt7MHdbt5vY9bP6WGnUh+r3l8M7CgfyTlwsgCbMC66BNxPr6Xoce3j66Ms5YUQTNA==", "dev": true }, + "basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "dev": true + }, "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -22263,6 +24087,7 @@ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", "dev": true, + "peer": true, "requires": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -22569,6 +24394,12 @@ "tslib": "^2.0.3" } }, + "chardet": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.1.1.tgz", + "integrity": "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==", + "dev": true + }, "chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -22665,6 +24496,12 @@ "restore-cursor": "^2.0.0" } }, + "cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true + }, "cli-truncate": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-0.2.1.tgz", @@ -22675,6 +24512,65 @@ "string-width": "^1.0.1" } }, + "cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dev": true + }, "clone-deep": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", @@ -22861,6 +24757,15 @@ "integrity": "sha512-OsSVtHK8Ir8r3+Fxw/b4jS1ZLPXkV6ZxDRJQzeD7qo0SqMXWrHDM71DgYzPMHY8SFJ0Ao+nNU2p1MmwdzKqPrw==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -22897,6 +24802,40 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "concurrently": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.1.tgz", + "integrity": "sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng==", + "dev": true, + "requires": { + "chalk": "4.1.2", + "rxjs": "7.8.2", + "shell-quote": "1.8.3", + "supports-color": "8.1.1", + "tree-kill": "1.2.2", + "yargs": "17.7.2" + }, + "dependencies": { + "rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "config-chain": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", @@ -22907,12 +24846,27 @@ "proto-list": "~1.2.1" } }, + "consola": { + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz", + "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==", + "dev": true + }, "console-stream": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/console-stream/-/console-stream-0.1.1.tgz", "integrity": "sha512-QC/8l9e6ofi6nqZ5PawlDgzmMw3OxIXtvolBzap/F4UDBJlDaZRSNbL/lb41C29FcbSJncBFlJFj2WJoNyZRfQ==", "dev": true }, + "console.table": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/console.table/-/console.table-0.10.0.tgz", + "integrity": "sha512-dPyZofqggxuvSf7WXvNjuRfnsOk1YazkVP8FdxH4tcH2c37wc79/Yl6Bhr7Lsu00KMgy2ql/qCMuNu8xctZM8g==", + "dev": true, + "requires": { + "easy-table": "1.1.0" + } + }, "constant-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", @@ -22964,6 +24918,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "peer": true, "requires": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -23135,6 +25090,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "peer": true, "requires": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -23374,6 +25330,12 @@ "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", "dev": true }, + "data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "dev": true + }, "data-view-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", @@ -23601,6 +25563,15 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dev": true, + "requires": { + "clone": "^1.0.2" + } + }, "define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -23633,6 +25604,17 @@ "isobject": "^3.0.1" } }, + "degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dev": true, + "requires": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + } + }, "del": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", @@ -23680,6 +25662,12 @@ } } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true + }, "didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -23833,6 +25821,15 @@ "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==", "dev": true }, + "easy-table": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.1.0.tgz", + "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", + "dev": true, + "requires": { + "wcwidth": ">=1.0.1" + } + }, "electron-to-chromium": { "version": "1.5.266", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.266.tgz", @@ -24060,11 +26057,24 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, + "escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "requires": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2", + "source-map": "~0.6.1" + } + }, "eslint": { "version": "8.57.1", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "dev": true, + "peer": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -24771,6 +26781,12 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true + }, "fast-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", @@ -24810,6 +26826,12 @@ "pend": "~1.2.0" } }, + "fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "dev": true + }, "figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", @@ -24974,6 +26996,12 @@ "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true }, + "follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "dev": true + }, "for-each": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", @@ -24989,6 +27017,19 @@ "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", "dev": true }, + "form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + } + }, "fraction.js": { "version": "5.3.4", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", @@ -25020,6 +27061,17 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, + "fs-extra": { + "version": "11.3.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.2.tgz", + "integrity": "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -25071,6 +27123,12 @@ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, "get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -25137,6 +27195,17 @@ "get-intrinsic": "^1.2.6" } }, + "get-uri": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", + "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", + "dev": true, + "requires": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4" + } + }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -25576,6 +27645,26 @@ "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", "dev": true }, + "http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "requires": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + } + }, + "https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "requires": { + "agent-base": "^7.1.2", + "debug": "4" + } + }, "husky": { "version": "4.3.8", "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz", @@ -25605,6 +27694,15 @@ } } }, + "iconv-lite": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + }, "icss-utils": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", @@ -26322,6 +28420,138 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "inquirer": { + "version": "8.2.7", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.7.tgz", + "integrity": "sha512-UjOaSel/iddGZJ5xP/Eixh6dY1XghiBw4XK13rCCIJcJfyhhoul/7KhLLUGtebEj6GDYM6Vnx/mVsjx2L/mFIA==", + "dev": true, + "requires": { + "@inquirer/external-editor": "^1.0.0", + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.5.5", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6", + "wrap-ansi": "^6.0.1" + }, + "dependencies": { + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + } + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, "internal-slot": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", @@ -26349,6 +28579,12 @@ "p-is-promise": "^1.1.0" } }, + "ip-address": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "dev": true + }, "is-absolute-url": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", @@ -26584,6 +28820,12 @@ "is-extglob": "^2.1.1" } }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true + }, "is-jpg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-jpg/-/is-jpg-2.0.0.tgz", @@ -26791,6 +29033,12 @@ "which-typed-array": "^1.1.16" } }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -26856,6 +29104,12 @@ "is-object": "^1.0.1" } }, + "iterare": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", + "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", + "dev": true + }, "iterator.prototype": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", @@ -27001,6 +29255,16 @@ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, + "jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, "jsx-ast-utils": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", @@ -27331,6 +29595,7 @@ "resolved": "https://registry.npmjs.org/listr/-/listr-0.14.3.tgz", "integrity": "sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA==", "dev": true, + "peer": true, "requires": { "@samverschueren/stream-to-observable": "^0.3.0", "is-observable": "^1.1.0", @@ -27501,6 +29766,12 @@ } } }, + "load-esm": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/load-esm/-/load-esm-1.0.3.tgz", + "integrity": "sha512-v5xlu8eHD1+6r8EHTg6hfmO97LN8ugKtiXcy5e6oN72iD2r6u0RPfLl6fxM+7Wnh2ZRq15o0russMst44WauPA==", + "dev": true + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -27973,6 +30244,12 @@ "kind-of": "^6.0.3" } }, + "minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true + }, "mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -28004,6 +30281,12 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, "mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -28058,6 +30341,12 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "dev": true + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -28074,6 +30363,15 @@ "tslib": "^2.0.3" } }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + } + }, "node-releases": { "version": "2.0.27", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", @@ -28384,6 +30682,91 @@ "logalot": "^2.0.0" } }, + "ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, + "requires": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "dependencies": { + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + } + } + }, "os-filter-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/os-filter-obj/-/os-filter-obj-2.0.0.tgz", @@ -28497,6 +30880,32 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "pac-proxy-agent": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", + "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", + "dev": true, + "requires": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.6", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.5" + } + }, + "pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dev": true, + "requires": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + } + }, "param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", @@ -28590,12 +30999,36 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "path-scurry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz", + "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==", + "dev": true, + "requires": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "dependencies": { + "lru-cache": { + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.4.tgz", + "integrity": "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg==", + "dev": true + } + } + }, "path-sort": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/path-sort/-/path-sort-0.1.0.tgz", "integrity": "sha512-70MSq7edKtbODYKkqXYzSMQxtYMjDgP3K6D15Fu4KUvpyBPlxDWPvv8JI9GjNDF2K5baPHFEtlg818dOmf2ifg==", "dev": true }, + "path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "dev": true + }, "path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -28805,6 +31238,7 @@ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", "dev": true, + "peer": true, "requires": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -29222,6 +31656,7 @@ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", "dev": true, + "peer": true, "requires": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -29373,7 +31808,8 @@ "version": "2.8.8", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true + "dev": true, + "peer": true }, "prettier-linter-helpers": { "version": "1.0.0", @@ -29407,6 +31843,36 @@ "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", "dev": true }, + "proxy-agent": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz", + "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", + "dev": true, + "requires": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.6", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.1.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.5" + }, + "dependencies": { + "lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true + } + } + }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -29478,6 +31944,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", "dev": true, + "peer": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" @@ -29646,6 +32113,13 @@ } } }, + "reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", + "dev": true, + "peer": true + }, "reflect.getprototypeof": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", @@ -29769,6 +32243,12 @@ "integrity": "sha512-yD5BHCe7quCgBph4rMQ+0KkIRKwWCrHDOX1p1Gp6HwjPM5kVoCdKGNhN7ydqqsX6lJEnQDKZ/tFMiEdQ1dvPEw==", "dev": true }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true + }, "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -29961,6 +32441,12 @@ } } }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -30036,6 +32522,12 @@ "is-regex": "^1.2.1" } }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "sax": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.3.tgz", @@ -30235,6 +32727,12 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true + }, "side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -30318,6 +32816,12 @@ "integrity": "sha512-up04hB2hR92PgjpyU3y/eg91yIBILyjVY26NvvciY3EVVPjybkMszMpXQ9QAkcS3I5rtJBDLoTxxg+qvW8c7rw==", "dev": true }, + "smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true + }, "snake-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", @@ -30443,6 +32947,27 @@ } } }, + "socks": { + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", + "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", + "dev": true, + "requires": { + "ip-address": "^10.0.1", + "smart-buffer": "^4.2.0" + } + }, + "socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "dev": true, + "requires": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + } + }, "sort-keys": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", @@ -30886,6 +33411,15 @@ "integrity": "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA==", "dev": true }, + "strtok3": { + "version": "10.3.4", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.4.tgz", + "integrity": "sha512-KIy5nylvC5le1OdaaoCJ07L+8iQzJHGH6pWDuzS+d07Cu7n1MZ2x26P8ZKIWfbK02+XIL8Mp4RkWeqdUCrDMfg==", + "dev": true, + "requires": { + "@tokenizer/token": "^0.3.0" + } + }, "style-loader": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.4.tgz", @@ -30914,6 +33448,7 @@ "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.16.1.tgz", "integrity": "sha512-ErlzR/T3hhbV+a925/gbfc3f3Fep9/bnspMiJPorfGEmcBbXdS+oo6LrVtoUZ/w9fqD6o6k7PtUlCOsCRdjX/A==", "dev": true, + "peer": true, "requires": { "@csstools/selector-specificity": "^2.0.2", "balanced-match": "^2.0.0", @@ -31463,6 +33998,7 @@ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.18.tgz", "integrity": "sha512-6A2rnmW5xZMdw11LYjhcI5846rt9pbLSabY5XPxo+XWdxwZaFEn47Go4NzFiHu9sNNmr/kXivP1vStfvMaK1GQ==", "dev": true, + "peer": true, "requires": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -31502,14 +34038,6 @@ "requires": { "lilconfig": "^3.1.1" } - }, - "yaml": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", - "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", - "dev": true, - "optional": true, - "peer": true } } }, @@ -31580,6 +34108,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "peer": true, "requires": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -31699,7 +34228,8 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true + "dev": true, + "peer": true } } }, @@ -31755,6 +34285,29 @@ "is-number": "^7.0.0" } }, + "token-types": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.1.tgz", + "integrity": "sha512-kh9LVIWH5CnL63Ipf0jhlBIy0UsrMj/NJDfpsy1SqOXlLKEVyXXYrnFxFT1yOOYVGBSApeVnjPw/sBz5BfEjAQ==", + "dev": true, + "requires": { + "@borewit/text-codec": "^0.1.0", + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, + "tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true + }, "trim-newlines": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", @@ -31920,6 +34473,21 @@ "dev": true, "peer": true }, + "uid": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", + "integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==", + "dev": true, + "requires": { + "@lukeed/csprng": "^1.0.0" + } + }, + "uint8array-extras": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.5.0.tgz", + "integrity": "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==", + "dev": true + }, "unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", @@ -32008,6 +34576,12 @@ "integrity": "sha512-mZdDpf3vBV5Efh29kMw5tXoup/buMgxLzOt/XKFKcVmi+15ManNQWr6HfZ2aiZTYlYixbdNJ0KFmIZIv52tHSQ==", "dev": true }, + "universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true + }, "unquote": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", @@ -32188,11 +34762,27 @@ "graceful-fs": "^4.1.2" } }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, "webpack": { "version": "5.103.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.103.0.tgz", "integrity": "sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==", "dev": true, + "peer": true, "requires": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -32226,6 +34816,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "peer": true, "requires": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -32273,6 +34864,7 @@ "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", "dev": true, + "peer": true, "requires": { "@discoveryjs/json-ext": "^0.5.0", "@webpack-cli/configtest": "^1.2.0", @@ -33166,6 +35758,16 @@ "source-map": "~0.6.1" } }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -33416,6 +36018,12 @@ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, "yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", @@ -33428,6 +36036,52 @@ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "dev": true }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + } + } + }, "yargs-parser": { "version": "20.2.9", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", diff --git a/package.json b/package.json index ab55931..9e22362 100644 --- a/package.json +++ b/package.json @@ -29,51 +29,52 @@ }, "homepage": "https://github.com/plausible/wordpress#readme", "devDependencies": { - "@babel/core": "^7.18.13", - "@babel/eslint-parser": "^7.18.9", - "@babel/plugin-syntax-jsx": "^7.18.6", - "@babel/plugin-transform-react-jsx": "^7.18.10", - "@babel/plugin-transform-runtime": "^7.18.10", - "@babel/preset-env": "^7.22.20", - "@babel/runtime": "^7.18.9", - "@es-joy/jsdoccomment": "0.31.0", - "@prettier/plugin-php": "^0.18.9", - "@tailwindcss/forms": "^0.5.7", - "@wordpress/eslint-plugin": "^12.5.0", - "@wordpress/stylelint-config": "^20.0.2", - "autoprefixer": "^10.4.16", - "babel-loader": "^8.2.5", - "clean-webpack-plugin": "^4.0.0", - "copy-webpack-plugin": "^11.0.0", - "cross-env": "^7.0.3", - "css-loader": "^6.7.1", - "css-minimizer-webpack-plugin": "^4.2.2", - "cssnano": "^5.1.13", - "cssnano-preset-advanced": "^5.3.8", - "eslint": "^8.23.0", - "eslint-plugin-jsdoc": "^39.3.3", - "eslint-plugin-react": "^7.30.1", - "expose-loader": "^4.0.0", - "file-loader": "^6.2.0", - "husky": "^4.3.5", - "imagemin-webpack-plugin": "*", - "lint-staged": "^9.5.0", - "mini-css-extract-plugin": "^1.6.2", - "postcss": "^8.4.31", - "postcss-loader": "^7.3.3", - "prettier": "^2.7.1", - "script-loader": "^0.7.2", - "style-loader": "^3.3.1", - "stylelint": "^14.11.0", - "stylelint-config-prettier": "^9.0.3", - "stylelint-config-standard-scss": "^4.0.0", - "stylelint-prettier": "^2.0.0", - "stylelint-scss": "^4.2.0", - "tailwindcss": "^3.3.5", - "webpack": "^5.88.2", - "webpack-cli": "^4.10.0", - "webpack-rtl-plugin": "^2.0.0", - "wp-pot": "^1.10.2", - "wp-textdomain": "^1.0.1" + "@openapitools/openapi-generator-cli": "*", + "@babel/core": "^7.18.13", + "@babel/eslint-parser": "^7.18.9", + "@babel/plugin-syntax-jsx": "^7.18.6", + "@babel/plugin-transform-react-jsx": "^7.18.10", + "@babel/plugin-transform-runtime": "^7.18.10", + "@babel/preset-env": "^7.22.20", + "@babel/runtime": "^7.18.9", + "@es-joy/jsdoccomment": "0.31.0", + "@prettier/plugin-php": "^0.18.9", + "@tailwindcss/forms": "^0.5.7", + "@wordpress/eslint-plugin": "^12.5.0", + "@wordpress/stylelint-config": "^20.0.2", + "autoprefixer": "^10.4.16", + "babel-loader": "^8.2.5", + "clean-webpack-plugin": "^4.0.0", + "copy-webpack-plugin": "^11.0.0", + "cross-env": "^7.0.3", + "css-loader": "^6.7.1", + "css-minimizer-webpack-plugin": "^4.2.2", + "cssnano": "^5.1.13", + "cssnano-preset-advanced": "^5.3.8", + "eslint": "^8.23.0", + "eslint-plugin-jsdoc": "^39.3.3", + "eslint-plugin-react": "^7.30.1", + "expose-loader": "^4.0.0", + "file-loader": "^6.2.0", + "husky": "^4.3.5", + "imagemin-webpack-plugin": "*", + "lint-staged": "^9.5.0", + "mini-css-extract-plugin": "^1.6.2", + "postcss": "^8.4.31", + "postcss-loader": "^7.3.3", + "prettier": "^2.7.1", + "script-loader": "^0.7.2", + "style-loader": "^3.3.1", + "stylelint": "^14.11.0", + "stylelint-config-prettier": "^9.0.3", + "stylelint-config-standard-scss": "^4.0.0", + "stylelint-prettier": "^2.0.0", + "stylelint-scss": "^4.2.0", + "tailwindcss": "^3.3.5", + "webpack": "^5.88.2", + "webpack-cli": "^4.10.0", + "webpack-rtl-plugin": "^2.0.0", + "wp-pot": "^1.10.2", + "wp-textdomain": "^1.0.1" } } From 25a18c7ec67d71656c7723d414f8178091967524 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:22:39 +0100 Subject: [PATCH 02/32] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3fa2171..78d61ac 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,10 @@ etc. to a minimum. But, since this is a WordPress plugin, some manual modifications need to be done to make sure it doesn't conflict with other plugins: +> [!IMPORTANT] +> You need to have Java and [OpenAPI Generator](https://openapi-generator.tech/docs/installation/) installed +> globally. + - (Re)generate the PHP client using the following command (trigger it from the Plugin's root dir as output will be saved to `src/Client`): `openapi-generator-cli generate -i https://plausible.io/api/plugins/spec/openapi -g php -o src/Client --additional-properties=identifierNamingConvention=snake_case,invokerPackage="Plausible\\Analytics\\WP\\Client" --global-property=apis,models,supportingFiles,modelDocs=false,modelTests=false,apiDocs=false,apiTests=false` From 1c7ed2455ec19337b91fbfb35d8a191d9d61bbe6 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:33:14 +0100 Subject: [PATCH 03/32] Regenerated API Client. --- README.md | 3 +- src/Actions.php | 52 +- src/Client.php | 8 + src/Client/.openapi-generator/FILES | 8 +- src/Client/README.md | 26 +- src/Client/lib/Api/DefaultApi.php | 5403 ++++++++++------- src/Client/lib/ApiException.php | 31 +- src/Client/lib/Configuration.php | 292 +- src/Client/lib/HeaderSelector.php | 82 +- src/Client/lib/Model/Capabilities.php | 232 +- src/Client/lib/Model/CapabilitiesFeatures.php | 464 +- src/Client/lib/Model/CustomProp.php | 200 +- src/Client/lib/Model/CustomPropCustomProp.php | 201 +- .../lib/Model/CustomPropDisableRequest.php | 220 +- .../CustomPropDisableRequestBulkDisable.php | 204 +- .../lib/Model/CustomPropEnableRequest.php | 220 +- .../CustomPropEnableRequestBulkEnable.php | 204 +- .../lib/Model/CustomPropListResponse.php | 200 +- src/Client/lib/Model/Error.php | 200 +- src/Client/lib/Model/Funnel.php | 2 +- src/Client/lib/Model/FunnelCreateRequest.php | 2 +- .../lib/Model/FunnelCreateRequestFunnel.php | 9 +- src/Client/lib/Model/FunnelFunnel.php | 2 +- src/Client/lib/Model/FunnelListResponse.php | 9 +- src/Client/lib/Model/Goal.php | 221 +- src/Client/lib/Model/GoalCreateRequest.php | 259 +- .../GoalCreateRequestBulkGetOrCreate.php | 209 +- ...CreateRequestBulkGetOrCreateGoalsInner.php | 230 +- .../Model/GoalCreateRequestCustomEvent.php | 239 +- .../GoalCreateRequestCustomEventGoal.php | 201 +- .../lib/Model/GoalCreateRequestPageview.php | 239 +- .../Model/GoalCreateRequestPageviewGoal.php | 201 +- .../lib/Model/GoalCreateRequestRevenue.php | 239 +- .../Model/GoalCreateRequestRevenueGoal.php | 216 +- src/Client/lib/Model/GoalCustomEvent.php | 215 +- .../lib/Model/GoalCustomEventAllOfGoal.php | 230 +- .../lib/Model/GoalDeleteBulkRequest.php | 203 +- src/Client/lib/Model/GoalListResponse.php | 221 +- src/Client/lib/Model/GoalListResponseMeta.php | 196 +- src/Client/lib/Model/GoalPageview.php | 215 +- .../lib/Model/GoalPageviewAllOfGoal.php | 234 +- src/Client/lib/Model/GoalRevenue.php | 215 +- src/Client/lib/Model/GoalRevenueAllOfGoal.php | 245 +- src/Client/lib/Model/GoalType.php | 200 +- src/Client/lib/Model/Link.php | 201 +- src/Client/lib/Model/ModelInterface.php | 41 +- src/Client/lib/Model/NotFoundError.php | 200 +- src/Client/lib/Model/PaginationMetadata.php | 232 +- .../lib/Model/PaginationMetadataLinks.php | 210 +- src/Client/lib/Model/PaymentRequiredError.php | 200 +- src/Client/lib/Model/SharedLink.php | 200 +- .../lib/Model/SharedLinkCreateRequest.php | 200 +- .../SharedLinkCreateRequestSharedLink.php | 214 +- .../lib/Model/SharedLinkListResponse.php | 221 +- src/Client/lib/Model/SharedLinkSharedLink.php | 251 +- .../lib/Model/TrackerScriptConfiguration.php | 413 ++ ...onfigurationTrackerScriptConfiguration.php | 635 ++ ...rackerScriptConfigurationUpdateRequest.php | 413 ++ ...pdateRequestTrackerScriptConfiguration.php | 586 ++ src/Client/lib/Model/UnauthorizedError.php | 200 +- .../lib/Model/UnprocessableEntityError.php | 200 +- src/Client/lib/ObjectSerializer.php | 273 +- 62 files changed, 10087 insertions(+), 7505 deletions(-) create mode 100644 src/Client/lib/Model/TrackerScriptConfiguration.php create mode 100644 src/Client/lib/Model/TrackerScriptConfigurationTrackerScriptConfiguration.php create mode 100644 src/Client/lib/Model/TrackerScriptConfigurationUpdateRequest.php create mode 100644 src/Client/lib/Model/TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration.php diff --git a/README.md b/README.md index 78d61ac..bd20294 100644 --- a/README.md +++ b/README.md @@ -145,8 +145,7 @@ plugins: sure Mozart is installed globally) - In the `src/Client/lib` directory, replace all occurrences of ` GuzzleHttp` (mind the space) with - ` Plausible\Analytics\WP\Client\Lib\GuzzleHttp` ( - again, mind the space at the beginning) + ` Plausible\Analytics\WP\Client\Lib\GuzzleHttp` (again, mind the space at the beginning) - In the same directory, replace all occurrences of ` \GuzzleHttp` (mind the space and backslash) with ` \Plausible\Analytics\WP\Client\Lib\GuzzleHttp`. - If escaping characters doesn't work in your bash instance, you might also have to replace `PlausibleAnalyticsWPClient` diff --git a/src/Actions.php b/src/Actions.php index 2e9dbf4..54a4040 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -10,16 +10,33 @@ class Actions { /** - * Constructor. + * @var false|Client The Plausible Analytics API client. + */ + private $client; + + /** + * Build class. * @since 1.0.0 - * @access public * @return void */ - public function __construct() { + public function __construct( $init = true ) { + $client = new ClientFactory(); + $this->client = $client->build(); + + if ( $init ) { + $this->init(); + } + } + + /** + * Plugin actions/hooks + * @return void + */ + private function init() { add_action( 'wp_head', [ $this, 'maybe_insert_version_meta_tag' ] ); add_action( 'wp_enqueue_scripts', [ $this, 'maybe_register_assets' ] ); add_action( 'admin_bar_menu', [ $this, 'admin_bar_node' ], 100 ); - add_filter( 'get_search_form', [ $this, 'maybe_add_hidden_input_to_search_form' ], 10, 1 ); + add_filter( 'get_search_form', [ $this, 'maybe_add_hidden_input_to_search_form' ] ); add_filter( 'render_block', [ $this, 'maybe_add_hidden_input_to_search_block' ], 10, 2 ); } @@ -79,21 +96,24 @@ public function maybe_register_assets() { return; // @codeCoverageIgnore } - $version = Helpers::proxy_enabled() && file_exists( Helpers::get_js_path() ) ? filemtime( Helpers::get_js_path() ) : $this->get_plugin_version(); - + // Dummy script, which'll allow us to add inline scripts later. + wp_register_script( 'plausible-analytics', false ); wp_enqueue_script( 'plausible-analytics', - Helpers::get_js_url( true ), - '', - $version, + false, + [], + null, apply_filters( 'plausible_load_js_in_footer', false ) ); - // Goal tracking inline script (Don't disable this as it is required by 404). - wp_add_inline_script( - 'plausible-analytics', - 'window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }' + $id = $this->client->get_config_id(); + $script = sprintf( + 'window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},window.plausible.init=function(i){window.plausible.o=i||{}};var script=document.createElement("script");script.type="text/javascript",script.defer=!0,script.src="";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(script,r);', + $id ); + $script .= "\nplausible.init();"; + + wp_add_inline_script( 'plausible-analytics', $script ); // Track Cloaked Affiliate Links (if enabled) if ( Helpers::is_enhanced_measurement_enabled( 'affiliate-links' ) ) { @@ -126,7 +146,7 @@ public function maybe_register_assets() { wp_add_inline_script( 'plausible-analytics', - "document.addEventListener('DOMContentLoaded', function () { plausible( '404', $data ); });" + "document.addEventListener('DOMContentLoaded', () => { plausible( '404', $data ); });" ); } @@ -152,7 +172,7 @@ public function maybe_register_assets() { wp_add_inline_script( 'plausible-analytics', - "document.addEventListener('DOMContentLoaded', function () {\n$script\n});" + "document.addEventListener('DOMContentLoaded', () => {\n$script\n});" ); } } @@ -176,7 +196,7 @@ public function maybe_register_assets() { wp_add_inline_script( 'plausible-analytics', - "document.addEventListener('DOMContentLoaded', function () {\n$script\n});" + "document.addEventListener('DOMContentLoaded', () => {\n$script\n});" ); } diff --git a/src/Client.php b/src/Client.php index 4b1f341..f7e64d4 100644 --- a/src/Client.php +++ b/src/Client.php @@ -86,6 +86,14 @@ public function is_api_token_valid() { return isset( $valid_tokens[ $token ] ) && $valid_tokens[ $token ] === true; } + public function get_config_id() { + try { + return ''; + } catch ( \Exception $e ) { + return false; + } + } + /** * Retrieve Features from Capabilities object. * diff --git a/src/Client/.openapi-generator/FILES b/src/Client/.openapi-generator/FILES index af008fc..4b728e0 100644 --- a/src/Client/.openapi-generator/FILES +++ b/src/Client/.openapi-generator/FILES @@ -20,13 +20,12 @@ lib/Model/Error.php lib/Model/Funnel.php lib/Model/FunnelCreateRequest.php lib/Model/FunnelCreateRequestFunnel.php -lib/Model/FunnelCreateRequestFunnelStepsInner.php lib/Model/FunnelFunnel.php lib/Model/FunnelListResponse.php -lib/Model/FunnelListResponseMeta.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 @@ -37,6 +36,7 @@ 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 @@ -53,6 +53,10 @@ lib/Model/SharedLinkCreateRequest.php lib/Model/SharedLinkCreateRequestSharedLink.php lib/Model/SharedLinkListResponse.php lib/Model/SharedLinkSharedLink.php +lib/Model/TrackerScriptConfiguration.php +lib/Model/TrackerScriptConfigurationTrackerScriptConfiguration.php +lib/Model/TrackerScriptConfigurationUpdateRequest.php +lib/Model/TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration.php lib/Model/UnauthorizedError.php lib/Model/UnprocessableEntityError.php lib/ObjectSerializer.php diff --git a/src/Client/README.md b/src/Client/README.md index bec8bbf..9ee5139 100644 --- a/src/Client/README.md +++ b/src/Client/README.md @@ -61,12 +61,12 @@ $apiInstance = new PlausibleAnalyticsWPClient\Api\DefaultApi( new GuzzleHttp\Client(), $config ); +$custom_prop_disable_request = new \PlausibleAnalyticsWPClient\Model\CustomPropDisableRequest(); // \PlausibleAnalyticsWPClient\Model\CustomPropDisableRequest | CustomProp disable params try { - $result = $apiInstance->plausibleWebPluginsAPIControllersCapabilitiesIndex(); - print_r($result); + $apiInstance->customPropDisableBulk($custom_prop_disable_request); } catch (Exception $e) { - echo 'Exception when calling DefaultApi->plausibleWebPluginsAPIControllersCapabilitiesIndex: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DefaultApi->customPropDisableBulk: ', $e->getMessage(), PHP_EOL; } ``` @@ -77,20 +77,22 @@ All URIs are relative to *https://plausible.io* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**customPropDisableBulk**](docs/Api/DefaultApi.md#custompropdisablebulk) | **DELETE** /api/plugins/v1/custom_props | Disable CustomProp(s) +*DefaultApi* | [**customPropGetOrEnable**](docs/Api/DefaultApi.md#custompropgetorenable) | **PUT** /api/plugins/v1/custom_props | Get or enable CustomProp(s) +*DefaultApi* | [**funnelGetOrCreate**](docs/Api/DefaultApi.md#funnelgetorcreate) | **PUT** /api/plugins/v1/funnels | Get or create Funnel +*DefaultApi* | [**goalDeleteBulk**](docs/Api/DefaultApi.md#goaldeletebulk) | **DELETE** /api/plugins/v1/goals | Delete Goals in bulk +*DefaultApi* | [**goalGetOrCreate**](docs/Api/DefaultApi.md#goalgetorcreate) | **PUT** /api/plugins/v1/goals | Get or create Goal *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* | [**plausibleWebPluginsAPIControllersFunnelsCreate**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersfunnelscreate) | **PUT** /api/plugins/v1/funnels | Get or create Funnel *DefaultApi* | [**plausibleWebPluginsAPIControllersFunnelsGet**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersfunnelsget) | **GET** /api/plugins/v1/funnels/{id} | Retrieve Funnel by ID *DefaultApi* | [**plausibleWebPluginsAPIControllersFunnelsIndex**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollersfunnelsindex) | **GET** /api/plugins/v1/funnels | Retrieve Funnels -*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 +*DefaultApi* | [**plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerstrackerscriptconfigurationget) | **GET** /api/plugins/v1/tracker_script_configuration | Retrieve Tracker Script Configuration +*DefaultApi* | [**plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate**](docs/Api/DefaultApi.md#plausiblewebpluginsapicontrollerstrackerscriptconfigurationupdate) | **PUT** /api/plugins/v1/tracker_script_configuration | Update Tracker Script Configuration ## Models @@ -107,13 +109,12 @@ Class | Method | HTTP request | Description - [Funnel](docs/Model/Funnel.md) - [FunnelCreateRequest](docs/Model/FunnelCreateRequest.md) - [FunnelCreateRequestFunnel](docs/Model/FunnelCreateRequestFunnel.md) -- [FunnelCreateRequestFunnelStepsInner](docs/Model/FunnelCreateRequestFunnelStepsInner.md) - [FunnelFunnel](docs/Model/FunnelFunnel.md) - [FunnelListResponse](docs/Model/FunnelListResponse.md) -- [FunnelListResponseMeta](docs/Model/FunnelListResponseMeta.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) @@ -124,6 +125,7 @@ Class | Method | HTTP request | Description - [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) @@ -139,6 +141,10 @@ Class | Method | HTTP request | Description - [SharedLinkCreateRequestSharedLink](docs/Model/SharedLinkCreateRequestSharedLink.md) - [SharedLinkListResponse](docs/Model/SharedLinkListResponse.md) - [SharedLinkSharedLink](docs/Model/SharedLinkSharedLink.md) +- [TrackerScriptConfiguration](docs/Model/TrackerScriptConfiguration.md) +- [TrackerScriptConfigurationTrackerScriptConfiguration](docs/Model/TrackerScriptConfigurationTrackerScriptConfiguration.md) +- [TrackerScriptConfigurationUpdateRequest](docs/Model/TrackerScriptConfigurationUpdateRequest.md) +- [TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration](docs/Model/TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration.md) - [UnauthorizedError](docs/Model/UnauthorizedError.md) - [UnprocessableEntityError](docs/Model/UnprocessableEntityError.md) diff --git a/src/Client/lib/Api/DefaultApi.php b/src/Client/lib/Api/DefaultApi.php index 47d777a..5fbdf4d 100644 --- a/src/Client/lib/Api/DefaultApi.php +++ b/src/Client/lib/Api/DefaultApi.php @@ -2,7 +2,6 @@ /** * DefaultApi * PHP version 7.4 - * * @category Class * @package Plausible\Analytics\WP\Client * @author OpenAPI Generator team @@ -41,79 +40,84 @@ /** * DefaultApi Class Doc Comment - * * @category Class * @package Plausible\Analytics\WP\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech */ class DefaultApi { + /** + * @var ClientInterface + */ + protected $client; + + /** + * @var Configuration + */ + protected $config; + + /** + * @var HeaderSelector + */ + protected $headerSelector; + + /** + * @var int Host index + */ + protected $hostIndex; + /** @var string[] $contentTypes * */ public const contentTypes = [ - 'plausibleWebPluginsAPIControllersCapabilitiesIndex' => [ + 'customPropDisableBulk' => [ + 'application/json', + ], + 'customPropGetOrEnable' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersCustomPropsDisable' => [ + 'funnelGetOrCreate' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersCustomPropsEnable' => [ + 'goalDeleteBulk' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersFunnelsCreate' => [ + 'goalGetOrCreate' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersFunnelsGet' => [ + 'plausibleWebPluginsAPIControllersCapabilitiesIndex' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersFunnelsIndex' => [ + 'plausibleWebPluginsAPIControllersFunnelsGet' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersGoalsCreate' => [ + 'plausibleWebPluginsAPIControllersFunnelsIndex' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersGoalsDelete' => [ + 'plausibleWebPluginsAPIControllersGoalsDelete' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersGoalsDeleteBulk' => [ + 'plausibleWebPluginsAPIControllersGoalsGet' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersGoalsGet' => [ + 'plausibleWebPluginsAPIControllersGoalsIndex' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersGoalsIndex' => [ + 'plausibleWebPluginsAPIControllersSharedLinksCreate' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersSharedLinksCreate' => [ + 'plausibleWebPluginsAPIControllersSharedLinksGet' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersSharedLinksGet' => [ + 'plausibleWebPluginsAPIControllersSharedLinksIndex' => [ 'application/json', ], - 'plausibleWebPluginsAPIControllersSharedLinksIndex' => [ + 'plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet' => [ + 'application/json', + ], + 'plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate' => [ 'application/json', ], ]; - /** - * @var ClientInterface - */ - protected $client; - - /** - * @var Configuration - */ - protected $config; - - /** - * @var HeaderSelector - */ - protected $headerSelector; - - /** - * @var int Host index - */ - protected $hostIndex; - /** * @param ClientInterface $client * @param Configuration $config @@ -121,9 +125,9 @@ class DefaultApi { * @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, + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, $hostIndex = 0 ) { $this->client = $client ?: new Client(); @@ -132,15 +136,6 @@ public function __construct( $this->hostIndex = $hostIndex; } - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() { - return $this->hostIndex; - } - /** * Set the host index * @@ -150,6 +145,14 @@ public function setHostIndex( $hostIndex ): void { $this->hostIndex = $hostIndex; } + /** + * Get the host index + * @return int Host index + */ + public function getHostIndex() { + return $this->hostIndex; + } + /** * @return Configuration */ @@ -158,43 +161,39 @@ public function getConfig() { } /** - * Operation plausibleWebPluginsAPIControllersCapabilitiesIndex - * - * Retrieve Capabilities + * Operation customPropDisableBulk + * Disable CustomProp(s) * - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this - * operation + * @param \Plausible\Analytics\WP\Client\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropDisableBulk'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Model\Capabilities + * @return void * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndex( - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCapabilitiesIndex' ][ 0 ] + public function customPropDisableBulk( + $custom_prop_disable_request = null, + string $contentType = self::contentTypes['customPropDisableBulk'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo( $contentType ); - - return $response; + $this->customPropDisableBulkWithHttpInfo( $custom_prop_disable_request, $contentType ); } /** - * Operation plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo - * - * Retrieve Capabilities + * Operation customPropDisableBulkWithHttpInfo + * Disable CustomProp(s) * - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this - * operation + * @param \Plausible\Analytics\WP\Client\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropDisableBulk'] to see the possible values for this operation * - * @return array of \Plausible\Analytics\WP\Client\Model\Capabilities, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo( - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCapabilitiesIndex' ][ 0 ] + public function customPropDisableBulkWithHttpInfo( + $custom_prop_disable_request = null, + string $contentType = self::contentTypes['customPropDisableBulk'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( $contentType ); + $request = $this->customPropDisableBulkRequest( $custom_prop_disable_request, $contentType ); try { $options = $this->createHttpClientOption(); @@ -225,46 +224,30 @@ public function plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo( ); } - switch ( $statusCode ) { - case 200: - if ( '\Plausible\Analytics\WP\Client\Model\Capabilities' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\Capabilities' !== 'string' ) { - $content = json_decode( $content ); - } - } - - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\Capabilities', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - } - - $returnType = '\Plausible\Analytics\WP\Client\Model\Capabilities'; - 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(), - ]; + return [ null, $statusCode, $response->getHeaders() ]; } catch ( ApiException $e ) { switch ( $e->getCode() ) { - case 200: + case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\Capabilities', + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -275,20 +258,76 @@ public function plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersCapabilitiesIndex' + * Operation customPropDisableBulkAsync + * Disable CustomProp(s) * - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this - * operation + * @param \Plausible\Analytics\WP\Client\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropDisableBulk'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function customPropDisableBulkAsync( + $custom_prop_disable_request = null, + string $contentType = self::contentTypes['customPropDisableBulk'][0] + ) { + return $this->customPropDisableBulkAsyncWithHttpInfo( $custom_prop_disable_request, $contentType )->then( + function ( $response ) { + return $response[0]; + } + ); + } + + /** + * Operation customPropDisableBulkAsyncWithHttpInfo + * Disable CustomProp(s) + * + * @param \Plausible\Analytics\WP\Client\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropDisableBulk'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function customPropDisableBulkAsyncWithHttpInfo( + $custom_prop_disable_request = null, + string $contentType = self::contentTypes['customPropDisableBulk'][0] + ) { + $returnType = ''; + $request = $this->customPropDisableBulkRequest( $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 'customPropDisableBulk' + * + * @param \Plausible\Analytics\WP\Client\Model\CustomPropDisableRequest $custom_prop_disable_request CustomProp disable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropDisableBulk'] to see the possible values for this operation * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCapabilitiesIndex' ][ 0 ] + public function customPropDisableBulkRequest( + $custom_prop_disable_request = null, + string $contentType = self::contentTypes['customPropDisableBulk'][0] ) { - $resourcePath = '/api/plugins/v1/capabilities'; + $resourcePath = '/api/plugins/v1/custom_props'; $formParams = []; $queryParams = []; $headerParams = []; @@ -302,7 +341,16 @@ public function plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( ); // for model (json/xml) - if ( count( $formParams ) > 0 ) { + 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 ) { @@ -317,7 +365,7 @@ public function plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -328,12 +376,13 @@ public function plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -346,141 +395,46 @@ public function plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( $query = ObjectSerializer::buildQuery( $queryParams ); return new Request( - 'GET', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody + 'DELETE', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody ); } /** - * Create http client option - * - * @return array of http client options - * @throws \RuntimeException on file opening failure - */ - 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; - } - - /** - * Operation plausibleWebPluginsAPIControllersCapabilitiesIndexAsync - * - * Retrieve Capabilities + * Operation customPropGetOrEnable + * Get or enable CustomProp(s) * - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this - * operation + * @param \Plausible\Analytics\WP\Client\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropGetOrEnable'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @return \Plausible\Analytics\WP\Client\Model\CustomPropListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndexAsync( - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCapabilitiesIndex' ][ 0 ] + public function customPropGetOrEnable( + $custom_prop_enable_request = null, + string $contentType = self::contentTypes['customPropGetOrEnable'][0] ) { - return $this->plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo( $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + [ $response ] = $this->customPropGetOrEnableWithHttpInfo( $custom_prop_enable_request, $contentType ); + + return $response; } /** - * Operation plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo - * - * Retrieve Capabilities + * Operation customPropGetOrEnableWithHttpInfo + * Get or enable CustomProp(s) * - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this - * operation + * @param \Plausible\Analytics\WP\Client\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropGetOrEnable'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @return array of \Plausible\Analytics\WP\Client\Model\CustomPropListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo( - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCapabilitiesIndex' ][ 0 ] + public function customPropGetOrEnableWithHttpInfo( + $custom_prop_enable_request = null, + string $contentType = self::contentTypes['customPropGetOrEnable'][0] ) { - $returnType = '\Plausible\Analytics\WP\Client\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() - ); - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsDisable - * - * Disable CustomProp(s) - * - * @param \Plausible\Analytics\WP\Client\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 - * - * @return void - * @throws \InvalidArgumentException - * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response - */ - 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 \Plausible\Analytics\WP\Client\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 - * - * @return array of null, HTTP status code, HTTP response headers (array of strings) - * @throws \InvalidArgumentException - * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response - */ - public function plausibleWebPluginsAPIControllersCustomPropsDisableWithHttpInfo( - $custom_prop_disable_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsDisable' ][ 0 ] - ) { - $request = $this->plausibleWebPluginsAPIControllersCustomPropsDisableRequest( $custom_prop_disable_request, $contentType ); + $request = $this->customPropGetOrEnableRequest( $custom_prop_enable_request, $contentType ); try { $options = $this->createHttpClientOption(); @@ -511,10 +465,111 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableWithHttpInfo( ); } - return [ null, $statusCode, $response->getHeaders() ]; + switch ( $statusCode ) { + case 201: + if ( '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 401: + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 402: + if ( '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 422: + if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + } + + $returnType = '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse'; + 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(), + ]; } catch ( ApiException $e ) { switch ( $e->getCode() ) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -545,20 +600,86 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersCustomPropsDisable' + * Operation customPropGetOrEnableAsync + * Get or enable CustomProp(s) * - * @param \Plausible\Analytics\WP\Client\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 + * @param \Plausible\Analytics\WP\Client\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropGetOrEnable'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function customPropGetOrEnableAsync( + $custom_prop_enable_request = null, + string $contentType = self::contentTypes['customPropGetOrEnable'][0] + ) { + return $this->customPropGetOrEnableAsyncWithHttpInfo( $custom_prop_enable_request, $contentType )->then( + function ( $response ) { + return $response[0]; + } + ); + } + + /** + * Operation customPropGetOrEnableAsyncWithHttpInfo + * Get or enable CustomProp(s) + * + * @param \Plausible\Analytics\WP\Client\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropGetOrEnable'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function customPropGetOrEnableAsyncWithHttpInfo( + $custom_prop_enable_request = null, + string $contentType = self::contentTypes['customPropGetOrEnable'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse'; + $request = $this->customPropGetOrEnableRequest( $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 'customPropGetOrEnable' + * + * @param \Plausible\Analytics\WP\Client\Model\CustomPropEnableRequest $custom_prop_enable_request CustomProp enable params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customPropGetOrEnable'] to see the possible values for this operation * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersCustomPropsDisableRequest( - $custom_prop_disable_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsDisable' ][ 0 ] + public function customPropGetOrEnableRequest( + $custom_prop_enable_request = null, + string $contentType = self::contentTypes['customPropGetOrEnable'][0] ) { $resourcePath = '/api/plugins/v1/custom_props'; @@ -575,14 +696,14 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableRequest( ); // for model (json/xml) - if ( isset( $custom_prop_disable_request ) ) { - if ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + 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_disable_request ) + $httpBody = \GuzzleHttp\Utils::jsonEncode( + ObjectSerializer::sanitizeForSerialization( $custom_prop_enable_request ) ); } else { - $httpBody = $custom_prop_disable_request; + $httpBody = $custom_prop_enable_request; } } elseif ( count( $formParams ) > 0 ) { if ( $multipart ) { @@ -599,7 +720,7 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -610,12 +731,13 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -628,133 +750,61 @@ public function plausibleWebPluginsAPIControllersCustomPropsDisableRequest( $query = ObjectSerializer::buildQuery( $queryParams ); return new Request( - 'DELETE', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody + 'PUT', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody ); } /** - * Operation plausibleWebPluginsAPIControllersCustomPropsDisableAsync - * - * Disable CustomProp(s) + * Operation funnelGetOrCreate + * Get or create Funnel * - * @param \Plausible\Analytics\WP\Client\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 + * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['funnelGetOrCreate'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @return \Plausible\Analytics\WP\Client\Model\Funnel|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersCustomPropsDisableAsync( - $custom_prop_disable_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsDisable' ][ 0 ] + public function funnelGetOrCreate( + $funnel_create_request = null, + string $contentType = self::contentTypes['funnelGetOrCreate'][0] ) { - return $this->plausibleWebPluginsAPIControllersCustomPropsDisableAsyncWithHttpInfo( $custom_prop_disable_request, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); + [ $response ] = $this->funnelGetOrCreateWithHttpInfo( $funnel_create_request, $contentType ); + + return $response; } /** - * Operation plausibleWebPluginsAPIControllersCustomPropsDisableAsyncWithHttpInfo - * - * Disable CustomProp(s) + * Operation funnelGetOrCreateWithHttpInfo + * Get or create Funnel * - * @param \Plausible\Analytics\WP\Client\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 + * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['funnelGetOrCreate'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @return array of \Plausible\Analytics\WP\Client\Model\Funnel|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersCustomPropsDisableAsyncWithHttpInfo( - $custom_prop_disable_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsDisable' ][ 0 ] + public function funnelGetOrCreateWithHttpInfo( + $funnel_create_request = null, + string $contentType = self::contentTypes['funnelGetOrCreate'][0] ) { - $returnType = ''; - $request = $this->plausibleWebPluginsAPIControllersCustomPropsDisableRequest( $custom_prop_disable_request, $contentType ); + $request = $this->funnelGetOrCreateRequest( $funnel_create_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(); + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send( $request, $options ); + } catch ( RequestException $e ) { throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), $statusCode, $response->getHeaders(), (string) $response->getBody() - ); - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsEnable - * - * Get or enable CustomProp(s) - * - * @param \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Model\CustomPropListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError - * @throws \InvalidArgumentException - * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response - */ - public function plausibleWebPluginsAPIControllersCustomPropsEnable( - $custom_prop_enable_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsEnable' ][ 0 ] - ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo( $custom_prop_enable_request, $contentType ); - - return $response; - } - - /** - * Operation plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo - * - * Get or enable CustomProp(s) - * - * @param \Plausible\Analytics\WP\Client\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 - * - * @return array of - * \Plausible\Analytics\WP\Client\Model\CustomPropListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, - * HTTP status code, HTTP response headers (array of strings) - * @throws \InvalidArgumentException - * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response - */ - 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 + "[{$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 ); } @@ -772,17 +822,17 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo( switch ( $statusCode ) { case 201: - if ( '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse' === '\SplFileObject' ) { + if ( '\Plausible\Analytics\WP\Client\Model\Funnel' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\Funnel' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse', [] ), + ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\Funnel', [] ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -797,7 +847,11 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -812,7 +866,11 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -827,13 +885,17 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse'; + $returnType = '\Plausible\Analytics\WP\Client\Model\Funnel'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -854,7 +916,7 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo( case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\CustomPropListResponse', + '\Plausible\Analytics\WP\Client\Model\Funnel', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -889,22 +951,89 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersCustomPropsEnable' + * Operation funnelGetOrCreateAsync + * Get or create Funnel * - * @param \Plausible\Analytics\WP\Client\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 + * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['funnelGetOrCreate'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function funnelGetOrCreateAsync( + $funnel_create_request = null, + string $contentType = self::contentTypes['funnelGetOrCreate'][0] + ) { + return $this->funnelGetOrCreateAsyncWithHttpInfo( $funnel_create_request, $contentType )->then( + function ( $response ) { + return $response[0]; + } + ); + } + + /** + * Operation funnelGetOrCreateAsyncWithHttpInfo + * Get or create Funnel + * + * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['funnelGetOrCreate'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function funnelGetOrCreateAsyncWithHttpInfo( + $funnel_create_request = null, + string $contentType = self::contentTypes['funnelGetOrCreate'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\Funnel'; + $request = $this->funnelGetOrCreateRequest( $funnel_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 'funnelGetOrCreate' + * + * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['funnelGetOrCreate'] to see the possible values for this operation * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersCustomPropsEnableRequest( - $custom_prop_enable_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsEnable' ][ 0 ] + public function funnelGetOrCreateRequest( + $funnel_create_request = null, + string $contentType = self::contentTypes['funnelGetOrCreate'][0] ) { - $resourcePath = '/api/plugins/v1/custom_props'; + $resourcePath = '/api/plugins/v1/funnels'; $formParams = []; $queryParams = []; $headerParams = []; @@ -918,14 +1047,14 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableRequest( ); // for model (json/xml) - if ( isset( $custom_prop_enable_request ) ) { - if ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + if ( isset( $funnel_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( $custom_prop_enable_request ) + $httpBody = \GuzzleHttp\Utils::jsonEncode( + ObjectSerializer::sanitizeForSerialization( $funnel_create_request ) ); } else { - $httpBody = $custom_prop_enable_request; + $httpBody = $funnel_create_request; } } elseif ( count( $formParams ) > 0 ) { if ( $multipart ) { @@ -942,7 +1071,7 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -953,12 +1082,13 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -976,124 +1106,40 @@ public function plausibleWebPluginsAPIControllersCustomPropsEnableRequest( } /** - * Operation plausibleWebPluginsAPIControllersCustomPropsEnableAsync - * - * Get or enable CustomProp(s) - * - * @param \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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 \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersCustomPropsEnableAsyncWithHttpInfo( - $custom_prop_enable_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersCustomPropsEnable' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\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() - ); - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersFunnelsCreate + * Operation goalDeleteBulk * - * Get or create Funnel + * Delete Goals in bulk * - * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersFunnelsCreate'] - * to see the possible values for this operation + * @param \Plausible\Analytics\WP\Client\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalDeleteBulk'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Model\Funnel|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError - * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void */ - public function plausibleWebPluginsAPIControllersFunnelsCreate( - $funnel_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsCreate' ][ 0 ] + public function goalDeleteBulk( + $goal_delete_bulk_request = null, + string $contentType = self::contentTypes['goalDeleteBulk'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersFunnelsCreateWithHttpInfo( $funnel_create_request, $contentType ); - - return $response; + $this->goalDeleteBulkWithHttpInfo( $goal_delete_bulk_request, $contentType ); } /** - * Operation plausibleWebPluginsAPIControllersFunnelsCreateWithHttpInfo - * - * Get or create Funnel + * Operation goalDeleteBulkWithHttpInfo + * Delete Goals in bulk * - * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersFunnelsCreate'] - * to see the possible values for this operation + * @param \Plausible\Analytics\WP\Client\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalDeleteBulk'] to see the possible values for this operation * - * @return array of - * \Plausible\Analytics\WP\Client\Model\Funnel|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, - * HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersFunnelsCreateWithHttpInfo( - $funnel_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsCreate' ][ 0 ] + public function goalDeleteBulkWithHttpInfo( + $goal_delete_bulk_request = null, + string $contentType = self::contentTypes['goalDeleteBulk'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersFunnelsCreateRequest( $funnel_create_request, $contentType ); + $request = $this->goalDeleteBulkRequest( $goal_delete_bulk_request, $contentType ); try { $options = $this->createHttpClientOption(); @@ -1124,141 +1170,94 @@ public function plausibleWebPluginsAPIControllersFunnelsCreateWithHttpInfo( ); } - switch ( $statusCode ) { - case 201: - if ( '\Plausible\Analytics\WP\Client\Model\Funnel' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\Funnel' !== 'string' ) { - $content = json_decode( $content ); - } - } + return [ null, $statusCode, $response->getHeaders() ]; - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\Funnel', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; + } catch ( ApiException $e ) { + switch ( $e->getCode() ) { case 401: - if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' !== 'string' ) { - $content = json_decode( $content ); - } - } + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + } + throw $e; + } + } - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - case 402: - if ( '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError' !== 'string' ) { - $content = json_decode( $content ); - } - } - - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - case 422: - if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' !== 'string' ) { - $content = json_decode( $content ); - } - } - - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - } - - $returnType = '\Plausible\Analytics\WP\Client\Model\Funnel'; - if ( $returnType === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( $returnType !== 'string' ) { - $content = json_decode( $content ); - } + /** + * Operation goalDeleteBulkAsync + * Delete Goals in bulk + * + * @param \Plausible\Analytics\WP\Client\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalDeleteBulk'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function goalDeleteBulkAsync( + $goal_delete_bulk_request = null, + string $contentType = self::contentTypes['goalDeleteBulk'][0] + ) { + return $this->goalDeleteBulkAsyncWithHttpInfo( $goal_delete_bulk_request, $contentType )->then( + function ( $response ) { + return $response[0]; } + ); + } - return [ - ObjectSerializer::deserialize( $content, $returnType, [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; + /** + * Operation goalDeleteBulkAsyncWithHttpInfo + * Delete Goals in bulk + * + * @param \Plausible\Analytics\WP\Client\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalDeleteBulk'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function goalDeleteBulkAsyncWithHttpInfo( + $goal_delete_bulk_request = null, + string $contentType = self::contentTypes['goalDeleteBulk'][0] + ) { + $returnType = ''; + $request = $this->goalDeleteBulkRequest( $goal_delete_bulk_request, $contentType ); - } catch ( ApiException $e ) { - switch ( $e->getCode() ) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\Funnel', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; + 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() + ); } - throw $e; - } + ); } /** - * Create request for operation 'plausibleWebPluginsAPIControllersFunnelsCreate' + * Create request for operation 'goalDeleteBulk' * - * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersFunnelsCreate'] - * to see the possible values for this operation + * @param \Plausible\Analytics\WP\Client\Model\GoalDeleteBulkRequest $goal_delete_bulk_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalDeleteBulk'] to see the possible values for this operation * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersFunnelsCreateRequest( - $funnel_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsCreate' ][ 0 ] + public function goalDeleteBulkRequest( + $goal_delete_bulk_request = null, + string $contentType = self::contentTypes['goalDeleteBulk'][0] ) { - $resourcePath = '/api/plugins/v1/funnels'; + $resourcePath = '/api/plugins/v1/goals'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1272,14 +1271,14 @@ public function plausibleWebPluginsAPIControllersFunnelsCreateRequest( ); // for model (json/xml) - if ( isset( $funnel_create_request ) ) { - if ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + 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( $funnel_create_request ) + $httpBody = \GuzzleHttp\Utils::jsonEncode( + ObjectSerializer::sanitizeForSerialization( $goal_delete_bulk_request ) ); } else { - $httpBody = $funnel_create_request; + $httpBody = $goal_delete_bulk_request; } } elseif ( count( $formParams ) > 0 ) { if ( $multipart ) { @@ -1296,7 +1295,7 @@ public function plausibleWebPluginsAPIControllersFunnelsCreateRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -1307,12 +1306,13 @@ public function plausibleWebPluginsAPIControllersFunnelsCreateRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -1325,127 +1325,46 @@ public function plausibleWebPluginsAPIControllersFunnelsCreateRequest( $query = ObjectSerializer::buildQuery( $queryParams ); return new Request( - 'PUT', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersFunnelsCreateAsync - * - * Get or create Funnel - * - * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersFunnelsCreate'] - * to see the possible values for this operation - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersFunnelsCreateAsync( - $funnel_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsCreate' ][ 0 ] - ) { - return $this->plausibleWebPluginsAPIControllersFunnelsCreateAsyncWithHttpInfo( $funnel_create_request, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersFunnelsCreateAsyncWithHttpInfo - * - * Get or create Funnel - * - * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequest $funnel_create_request Funnel params (optional) - * @param string $contentType The value for the Content-Type header. Check - * self::contentTypes['plausibleWebPluginsAPIControllersFunnelsCreate'] - * to see the possible values for this operation - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersFunnelsCreateAsyncWithHttpInfo( - $funnel_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsCreate' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\Model\Funnel'; - $request = $this->plausibleWebPluginsAPIControllersFunnelsCreateRequest( $funnel_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() - ); - } + 'DELETE', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody ); } /** - * Operation plausibleWebPluginsAPIControllersFunnelsGet - * - * Retrieve Funnel by ID + * Operation goalGetOrCreate + * Get or create Goal * - * @param int $id Funnel ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to - * see the possible values for this operation + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequest $goal_create_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalGetOrCreate'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Model\Funnel|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError + * @return \Plausible\Analytics\WP\Client\Model\GoalListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersFunnelsGet( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsGet' ][ 0 ] + public function goalGetOrCreate( + $goal_create_request = null, + string $contentType = self::contentTypes['goalGetOrCreate'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( $id, $contentType ); + [ $response ] = $this->goalGetOrCreateWithHttpInfo( $goal_create_request, $contentType ); return $response; } /** - * Operation plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo - * - * Retrieve Funnel by ID + * Operation goalGetOrCreateWithHttpInfo + * Get or create Goal * - * @param int $id Funnel ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to - * see the possible values for this operation + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequest $goal_create_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalGetOrCreate'] to see the possible values for this operation * - * @return array of - * \Plausible\Analytics\WP\Client\Model\Funnel|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, - * HTTP status code, HTTP response headers (array of strings) + * @return array of \Plausible\Analytics\WP\Client\Model\GoalListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsGet' ][ 0 ] + public function goalGetOrCreateWithHttpInfo( + $goal_create_request = null, + string $contentType = self::contentTypes['goalGetOrCreate'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersFunnelsGetRequest( $id, $contentType ); + $request = $this->goalGetOrCreateRequest( $goal_create_request, $contentType ); try { $options = $this->createHttpClientOption(); @@ -1477,18 +1396,22 @@ public function plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( } switch ( $statusCode ) { - case 200: - if ( '\Plausible\Analytics\WP\Client\Model\Funnel' === '\SplFileObject' ) { + case 201: + if ( '\Plausible\Analytics\WP\Client\Model\GoalListResponse' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\Funnel' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\GoalListResponse' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\Funnel', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\GoalListResponse', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -1503,22 +1426,30 @@ public function plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; - case 404: - if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' === '\SplFileObject' ) { + case 402: + if ( '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\NotFoundError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -1533,13 +1464,17 @@ public function plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\Funnel'; + $returnType = '\Plausible\Analytics\WP\Client\Model\GoalListResponse'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -1557,10 +1492,10 @@ public function plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( } catch ( ApiException $e ) { switch ( $e->getCode() ) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\Funnel', + '\Plausible\Analytics\WP\Client\Model\GoalListResponse', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -1573,10 +1508,10 @@ public function plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( ); $e->setResponseObject( $data ); break; - case 404: + case 402: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\NotFoundError', + '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -1595,43 +1530,95 @@ public function plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersFunnelsGet' + * Operation goalGetOrCreateAsync + * Get or create Goal * - * @param int $id Funnel ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to - * see the possible values for this operation + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequest $goal_create_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalGetOrCreate'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersFunnelsGetRequest( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsGet' ][ 0 ] + public function goalGetOrCreateAsync( + $goal_create_request = null, + string $contentType = self::contentTypes['goalGetOrCreate'][0] ) { + return $this->goalGetOrCreateAsyncWithHttpInfo( $goal_create_request, $contentType )->then( + function ( $response ) { + return $response[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 plausibleWebPluginsAPIControllersFunnelsGet' - ); - } - - $resourcePath = '/api/plugins/v1/funnels/{id}'; - $formParams = []; - $queryParams = []; + /** + * Operation goalGetOrCreateAsyncWithHttpInfo + * Get or create Goal + * + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequest $goal_create_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalGetOrCreate'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function goalGetOrCreateAsyncWithHttpInfo( + $goal_create_request = null, + string $contentType = self::contentTypes['goalGetOrCreate'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\GoalListResponse'; + $request = $this->goalGetOrCreateRequest( $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 'goalGetOrCreate' + * + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequest $goal_create_request Goal params (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['goalGetOrCreate'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @throws \InvalidArgumentException + */ + public function goalGetOrCreateRequest( + $goal_create_request = null, + string $contentType = self::contentTypes['goalGetOrCreate'][0] + ) { + + $resourcePath = '/api/plugins/v1/goals'; + $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, @@ -1639,7 +1626,15 @@ public function plausibleWebPluginsAPIControllersFunnelsGetRequest( ); // for model (json/xml) - if ( count( $formParams ) > 0 ) { + 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 ) { @@ -1654,7 +1649,7 @@ public function plausibleWebPluginsAPIControllersFunnelsGetRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -1665,12 +1660,13 @@ public function plausibleWebPluginsAPIControllersFunnelsGetRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -1683,132 +1679,42 @@ public function plausibleWebPluginsAPIControllersFunnelsGetRequest( $query = ObjectSerializer::buildQuery( $queryParams ); return new Request( - 'GET', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersFunnelsGetAsync - * - * Retrieve Funnel by ID - * - * @param int $id Funnel ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to - * see the possible values for this operation - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersFunnelsGetAsync( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsGet' ][ 0 ] - ) { - return $this->plausibleWebPluginsAPIControllersFunnelsGetAsyncWithHttpInfo( $id, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersFunnelsGetAsyncWithHttpInfo - * - * Retrieve Funnel by ID - * - * @param int $id Funnel ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to - * see the possible values for this operation - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersFunnelsGetAsyncWithHttpInfo( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsGet' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\Model\Funnel'; - $request = $this->plausibleWebPluginsAPIControllersFunnelsGetRequest( $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() - ); - } + 'PUT', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody ); } /** - * Operation plausibleWebPluginsAPIControllersFunnelsIndex - * - * Retrieve Funnels + * Operation plausibleWebPluginsAPIControllersCapabilitiesIndex + * Retrieve Capabilities * - * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to - * see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Model\FunnelListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError + * @return \Plausible\Analytics\WP\Client\Model\Capabilities * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersFunnelsIndex( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersCapabilitiesIndex( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo( $limit, $after, $before, $contentType ); + [ $response ] = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo( $contentType ); return $response; } /** - * Operation plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo - * - * Retrieve Funnels + * Operation plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo + * Retrieve Capabilities * - * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to - * see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this operation * - * @return array of \Plausible\Analytics\WP\Client\Model\FunnelListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError, HTTP status - * code, HTTP response headers (array of strings) + * @return array of \Plausible\Analytics\WP\Client\Model\Capabilities, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersCapabilitiesIndexWithHttpInfo( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersFunnelsIndexRequest( $limit, $after, $before, $contentType ); + $request = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( $contentType ); try { $options = $this->createHttpClientOption(); @@ -1841,38 +1747,27 @@ public function plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo( switch ( $statusCode ) { case 200: - if ( '\Plausible\Analytics\WP\Client\Model\FunnelListResponse' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\FunnelListResponse' !== 'string' ) { - $content = json_decode( $content ); - } - } - - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\FunnelListResponse', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - case 401: - if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' === '\SplFileObject' ) { + if ( '\Plausible\Analytics\WP\Client\Model\Capabilities' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\Capabilities' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\Capabilities', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\FunnelListResponse'; + $returnType = '\Plausible\Analytics\WP\Client\Model\Capabilities'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -1893,15 +1788,7 @@ public function plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo( case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\FunnelListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + '\Plausible\Analytics\WP\Client\Model\Capabilities', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -1912,67 +1799,90 @@ public function plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersFunnelsIndex' + * Operation plausibleWebPluginsAPIControllersCapabilitiesIndexAsync + * Retrieve Capabilities * - * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to - * see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersFunnelsIndexRequest( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersCapabilitiesIndexAsync( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0] ) { + return $this->plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo( $contentType )->then( + function ( $response ) { + return $response[0]; + } + ); + } - $resourcePath = '/api/plugins/v1/funnels'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; + /** + * 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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersCapabilitiesIndexAsyncWithHttpInfo( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersCapabilitiesIndex'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\Capabilities'; + $request = $this->plausibleWebPluginsAPIControllersCapabilitiesIndexRequest( $contentType ); - // 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 - ) ?? [] + 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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @throws \InvalidArgumentException + */ + 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', ], @@ -1996,7 +1906,7 @@ public function plausibleWebPluginsAPIControllersFunnelsIndexRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -2007,12 +1917,13 @@ public function plausibleWebPluginsAPIControllersFunnelsIndexRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -2030,130 +1941,41 @@ public function plausibleWebPluginsAPIControllersFunnelsIndexRequest( } /** - * Operation plausibleWebPluginsAPIControllersFunnelsIndexAsync - * - * Retrieve Funnels - * - * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to - * see the possible values for this operation - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersFunnelsIndexAsync( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsIndex' ][ 0 ] - ) { - return $this->plausibleWebPluginsAPIControllersFunnelsIndexAsyncWithHttpInfo( $limit, $after, $before, $contentType )->then( - function ( $response ) { - return $response[ 0 ]; - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersFunnelsIndexAsyncWithHttpInfo - * - * Retrieve Funnels - * - * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to - * see the possible values for this operation - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersFunnelsIndexAsyncWithHttpInfo( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersFunnelsIndex' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\Model\FunnelListResponse'; - $request = $this->plausibleWebPluginsAPIControllersFunnelsIndexRequest( $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() - ); - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsCreate - * - * Get or create Goal + * Operation plausibleWebPluginsAPIControllersFunnelsGet + * Retrieve Funnel by ID * - * @param \Plausible\Analytics\WP\Client\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 + * @param int $id Funnel ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Model\GoalListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError + * @return \Plausible\Analytics\WP\Client\Model\Funnel|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsCreate( - $goal_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsCreate' ][ 0 ] + public function plausibleWebPluginsAPIControllersFunnelsGet( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo( $goal_create_request, $contentType ); + [ $response ] = $this->plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( $id, $contentType ); return $response; } /** - * Operation plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo - * - * Get or create Goal + * Operation plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo + * Retrieve Funnel by ID * - * @param \Plausible\Analytics\WP\Client\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 + * @param int $id Funnel ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to see the possible values for this operation * - * @return array of - * \Plausible\Analytics\WP\Client\Model\GoalListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\PaymentRequiredError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, - * HTTP status code, HTTP response headers (array of strings) + * @return array of \Plausible\Analytics\WP\Client\Model\Funnel|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo( - $goal_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsCreate' ][ 0 ] + public function plausibleWebPluginsAPIControllersFunnelsGetWithHttpInfo( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersGoalsCreateRequest( $goal_create_request, $contentType ); + $request = $this->plausibleWebPluginsAPIControllersFunnelsGetRequest( $id, $contentType ); try { $options = $this->createHttpClientOption(); @@ -2185,18 +2007,18 @@ public function plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo( } switch ( $statusCode ) { - case 201: - if ( '\Plausible\Analytics\WP\Client\Model\GoalListResponse' === '\SplFileObject' ) { + case 200: + if ( '\Plausible\Analytics\WP\Client\Model\Funnel' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\GoalListResponse' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\Funnel' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\GoalListResponse', [] ), + ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\Funnel', [] ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -2211,22 +2033,30 @@ public function plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; - case 402: - if ( '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError' === '\SplFileObject' ) { + case 404: + if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\NotFoundError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -2241,13 +2071,17 @@ public function plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\GoalListResponse'; + $returnType = '\Plausible\Analytics\WP\Client\Model\Funnel'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -2265,10 +2099,10 @@ public function plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo( } catch ( ApiException $e ) { switch ( $e->getCode() ) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\GoalListResponse', + '\Plausible\Analytics\WP\Client\Model\Funnel', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -2281,10 +2115,10 @@ public function plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo( ); $e->setResponseObject( $data ); break; - case 402: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\PaymentRequiredError', + '\Plausible\Analytics\WP\Client\Model\NotFoundError', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -2303,144 +2137,55 @@ public function plausibleWebPluginsAPIControllersGoalsCreateWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersGoalsCreate' + * Operation plausibleWebPluginsAPIControllersFunnelsGetAsync + * Retrieve Funnel by ID * - * @param \Plausible\Analytics\WP\Client\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 + * @param int $id Funnel ID (required) + * @param string $contentType The value for the Content-Type header. Check + * self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to see the possible + * values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersGoalsCreateRequest( - $goal_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsCreate' ][ 0 ] + public function plausibleWebPluginsAPIControllersFunnelsGetAsync( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'][0] ) { - - $resourcePath = '/api/plugins/v1/goals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - $headers = $this->headerSelector->selectHeaders( - [ 'application/json', ], - $contentType, - $multipart + return $this->plausibleWebPluginsAPIControllersFunnelsGetAsyncWithHttpInfo( $id, $contentType )->then( + function ( $response ) { + return $response[0]; + } ); + } - // 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 = \Plausible\Analytics\WP\Client\Lib\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 = \Plausible\Analytics\WP\Client\Lib\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 plausibleWebPluginsAPIControllersGoalsCreateAsync - * - * Get or create Goal - * - * @param \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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 \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersGoalsCreateAsyncWithHttpInfo( - $goal_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsCreate' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\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 ); + /** + * Operation plausibleWebPluginsAPIControllersFunnelsGetAsyncWithHttpInfo + * Retrieve Funnel by ID + * + * @param int $id Funnel ID (required) + * @param string $contentType The value for the Content-Type header. Check + * self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to see the possible + * values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersFunnelsGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\Funnel'; + $request = $this->plausibleWebPluginsAPIControllersFunnelsGetRequest( $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 ); } } @@ -2465,115 +2210,29 @@ function ( $exception ) { } /** - * 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 - * - * @return void - * @throws \InvalidArgumentException - * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response - */ - 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 - * - * @return array of null, HTTP status code, HTTP response headers (array of strings) - * @throws \InvalidArgumentException - * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response - */ - 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(), - '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; - } - throw $e; - } - } - - /** - * Create request for operation 'plausibleWebPluginsAPIControllersGoalsDelete' + * Create request for operation 'plausibleWebPluginsAPIControllersFunnelsGet' * - * @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 + * @param int $id Funnel ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'] to see the possible values for this operation * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersGoalsDeleteRequest( + public function plausibleWebPluginsAPIControllersFunnelsGetRequest( $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsDelete' ][ 0 ] + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsGet'][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' + 'Missing the required parameter $id when calling plausibleWebPluginsAPIControllersFunnelsGet' ); } - $resourcePath = '/api/plugins/v1/goals/{id}'; + $resourcePath = '/api/plugins/v1/funnels/{id}'; $formParams = []; - $queryParams = []; + $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2609,7 +2268,7 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -2620,12 +2279,13 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -2635,113 +2295,58 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteRequest( ); $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery( $queryParams ); + $query = ObjectSerializer::buildQuery( $queryParams ); return new Request( - 'DELETE', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody - ); - } - - /** - * 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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() - ); - } + 'GET', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody ); } /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteBulk - * - * Delete Goals in bulk + * Operation plausibleWebPluginsAPIControllersFunnelsIndex + * Retrieve Funnels * - * @param \Plausible\Analytics\WP\Client\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 + * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to see the possible values for this operation * - * @return void + * @return \Plausible\Analytics\WP\Client\Model\FunnelListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsDeleteBulk( - $goal_delete_bulk_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsDeleteBulk' ][ 0 ] + public function plausibleWebPluginsAPIControllersFunnelsIndex( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsIndex'][0] ) { - $this->plausibleWebPluginsAPIControllersGoalsDeleteBulkWithHttpInfo( $goal_delete_bulk_request, $contentType ); + [ $response ] = + $this->plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo( $limit, $after, $before, $contentType ); + + return $response; } /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteBulkWithHttpInfo - * - * Delete Goals in bulk + * Operation plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo + * Retrieve Funnels * - * @param \Plausible\Analytics\WP\Client\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 + * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to see the possible values for this operation * - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \Plausible\Analytics\WP\Client\Model\FunnelListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsDeleteBulkWithHttpInfo( - $goal_delete_bulk_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsDeleteBulk' ][ 0 ] + public function plausibleWebPluginsAPIControllersFunnelsIndexWithHttpInfo( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsIndex'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( $goal_delete_bulk_request, $contentType ); + $request = $this->plausibleWebPluginsAPIControllersFunnelsIndexRequest( $limit, $after, $before, $contentType ); try { $options = $this->createHttpClientOption(); @@ -2772,10 +2377,1026 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkWithHttpInfo( ); } - return [ null, $statusCode, $response->getHeaders() ]; + switch ( $statusCode ) { + case 200: + if ( '\Plausible\Analytics\WP\Client\Model\FunnelListResponse' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\FunnelListResponse' !== 'string' ) { + $content = json_decode( $content ); + } + } - } catch ( ApiException $e ) { + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\FunnelListResponse', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 401: + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + } + + $returnType = '\Plausible\Analytics\WP\Client\Model\FunnelListResponse'; + 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(), + ]; + + } catch ( ApiException $e ) { + switch ( $e->getCode() ) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\FunnelListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + } + throw $e; + } + } + + /** + * Operation plausibleWebPluginsAPIControllersFunnelsIndexAsync + * Retrieve Funnels + * + * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to see the + * possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersFunnelsIndexAsync( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsIndex'][0] + ) { + return $this->plausibleWebPluginsAPIControllersFunnelsIndexAsyncWithHttpInfo( + $limit, + $after, + $before, + $contentType + )->then( + function ( $response ) { + return $response[0]; + } + ); + } + + /** + * Operation plausibleWebPluginsAPIControllersFunnelsIndexAsyncWithHttpInfo + * Retrieve Funnels + * + * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to see the + * possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersFunnelsIndexAsyncWithHttpInfo( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsIndex'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\FunnelListResponse'; + $request = + $this->plausibleWebPluginsAPIControllersFunnelsIndexRequest( $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 'plausibleWebPluginsAPIControllersFunnelsIndex' + * + * @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['plausibleWebPluginsAPIControllersFunnelsIndex'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersFunnelsIndexRequest( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersFunnelsIndex'][0] + ) { + + $resourcePath = '/api/plugins/v1/funnels'; + $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 = \Plausible\Analytics\WP\Client\Lib\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 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 + * + * @return void + * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response + */ + 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 + * + * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response + */ + 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(), + '\Plausible\Analytics\WP\Client\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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + 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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + 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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @throws \InvalidArgumentException + */ + 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 = \Plausible\Analytics\WP\Client\Lib\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 + * + * @return \Plausible\Analytics\WP\Client\Model\Goal|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError + *@throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response + */ + public function plausibleWebPluginsAPIControllersGoalsGet( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'][0] + ) { + [ $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 + * + * @return array of \Plausible\Analytics\WP\Client\Model\Goal|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) + * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response + */ + 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 ( '\Plausible\Analytics\WP\Client\Model\Goal' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\Goal' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\Goal', [] ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 401: + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 404: + if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\NotFoundError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 422: + if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + } + + $returnType = '\Plausible\Analytics\WP\Client\Model\Goal'; + 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(), + ]; + + } catch ( ApiException $e ) { + switch ( $e->getCode() ) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\Goal', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\NotFoundError', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\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 \Plausible\Analytics\WP\Client\Lib\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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersGoalsGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsGet'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @throws \InvalidArgumentException + */ + 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 = \Plausible\Analytics\WP\Client\Lib\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 + * + * @return \Plausible\Analytics\WP\Client\Model\GoalListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError + *@throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response + */ + public function plausibleWebPluginsAPIControllersGoalsIndex( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'][0] + ) { + [ $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 + * + * @return array of \Plausible\Analytics\WP\Client\Model\GoalListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError, HTTP status code, HTTP response headers (array of strings) + * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response + */ + 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 ( '\Plausible\Analytics\WP\Client\Model\GoalListResponse' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\GoalListResponse' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\GoalListResponse', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 401: + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + } + + $returnType = '\Plausible\Analytics\WP\Client\Model\GoalListResponse'; + 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(), + ]; + + } catch ( ApiException $e ) { switch ( $e->getCode() ) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\GoalListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2790,19 +3411,109 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersGoalsDeleteBulk' + * Operation plausibleWebPluginsAPIControllersGoalsIndexAsync * - * @param \Plausible\Analytics\WP\Client\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 + * 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 \Plausible\Analytics\WP\Client\Lib\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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersGoalsIndexAsyncWithHttpInfo( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\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 * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( - $goal_delete_bulk_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsDeleteBulk' ][ 0 ] + public function plausibleWebPluginsAPIControllersGoalsIndexRequest( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersGoalsIndex'][0] ) { $resourcePath = '/api/plugins/v1/goals'; @@ -2812,6 +3523,43 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( $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, @@ -2819,16 +3567,7 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( ); // 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 = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( - ObjectSerializer::sanitizeForSerialization( $goal_delete_bulk_request ) - ); - } else { - $httpBody = $goal_delete_bulk_request; - } - } elseif ( count( $formParams ) > 0 ) { + if ( count( $formParams ) > 0 ) { if ( $multipart ) { $multipartContents = []; foreach ( $formParams as $formParamName => $formParamValue ) { @@ -2843,7 +3582,7 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -2854,12 +3593,13 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -2872,114 +3612,52 @@ public function plausibleWebPluginsAPIControllersGoalsDeleteBulkRequest( $query = ObjectSerializer::buildQuery( $queryParams ); return new Request( - 'DELETE', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersGoalsDeleteBulkAsync - * - * Delete Goals in bulk - * - * @param \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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 \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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() - ); - } + 'GET', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody ); } /** - * Operation plausibleWebPluginsAPIControllersGoalsGet - * - * Retrieve Goal by ID + * Operation plausibleWebPluginsAPIControllersSharedLinksCreate + * Get or create Shared Link * - * @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 + * @param \Plausible\Analytics\WP\Client\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 * - * @return \Plausible\Analytics\WP\Client\Model\Goal|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError + * @return \Plausible\Analytics\WP\Client\Model\SharedLink|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsGet( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsGet' ][ 0 ] + public function plausibleWebPluginsAPIControllersSharedLinksCreate( + $shared_link_create_request = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo( $id, $contentType ); + [ $response ] = $this->plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo( + $shared_link_create_request, + $contentType + ); return $response; } /** - * Operation plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo - * - * Retrieve Goal by ID + * Operation plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo + * Get or create Shared Link * - * @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 + * @param \Plausible\Analytics\WP\Client\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 * - * @return array of - * \Plausible\Analytics\WP\Client\Model\Goal|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, - * HTTP status code, HTTP response headers (array of strings) + * @return array of \Plausible\Analytics\WP\Client\Model\SharedLink|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsGet' ][ 0 ] + public function plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo( + $shared_link_create_request = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersGoalsGetRequest( $id, $contentType ); + $request = $this->plausibleWebPluginsAPIControllersSharedLinksCreateRequest( + $shared_link_create_request, + $contentType + ); try { $options = $this->createHttpClientOption(); @@ -3011,18 +3689,18 @@ public function plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo( } switch ( $statusCode ) { - case 200: - if ( '\Plausible\Analytics\WP\Client\Model\Goal' === '\SplFileObject' ) { + case 201: + if ( '\Plausible\Analytics\WP\Client\Model\SharedLink' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\Goal' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\SharedLink' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\Goal', [] ), + ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\SharedLink', [] ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -3037,22 +3715,11 @@ public function plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - case 404: - if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' !== 'string' ) { - $content = json_decode( $content ); - } - } - - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\NotFoundError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -3067,13 +3734,17 @@ public function plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\Goal'; + $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLink'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -3091,10 +3762,10 @@ public function plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo( } catch ( ApiException $e ) { switch ( $e->getCode() ) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\Goal', + '\Plausible\Analytics\WP\Client\Model\SharedLink', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -3107,14 +3778,6 @@ public function plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo( ); $e->setResponseObject( $data ); break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\NotFoundError', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; case 422: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -3129,42 +3792,121 @@ public function plausibleWebPluginsAPIControllersGoalsGetWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersGoalsGet' + * Operation plausibleWebPluginsAPIControllersSharedLinksCreateAsync * - * @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 + * Get or create Shared Link + * + * @param \Plausible\Analytics\WP\Client\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 * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface */ - public function plausibleWebPluginsAPIControllersGoalsGetRequest( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsGet' ][ 0 ] + 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]; + } + ); + } - // 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' - ); - } + /** + * Operation plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo + * Get or create Shared Link + * + * @param \Plausible\Analytics\WP\Client\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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo( + $shared_link_create_request = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksCreate'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLink'; + $request = $this->plausibleWebPluginsAPIControllersSharedLinksCreateRequest( + $shared_link_create_request, + $contentType + ); - $resourcePath = '/api/plugins/v1/goals/{id}'; + 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 \Plausible\Analytics\WP\Client\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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @throws \InvalidArgumentException + */ + 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; - - // path params - if ( $id !== null ) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue( $id ), - $resourcePath - ); - } + $multipart = false; $headers = $this->headerSelector->selectHeaders( [ 'application/json', ], @@ -3173,7 +3915,16 @@ public function plausibleWebPluginsAPIControllersGoalsGetRequest( ); // for model (json/xml) - if ( count( $formParams ) > 0 ) { + 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 ) { @@ -3188,7 +3939,7 @@ public function plausibleWebPluginsAPIControllersGoalsGetRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -3199,12 +3950,13 @@ public function plausibleWebPluginsAPIControllersGoalsGetRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -3217,132 +3969,46 @@ public function plausibleWebPluginsAPIControllersGoalsGetRequest( $query = ObjectSerializer::buildQuery( $queryParams ); return new Request( - 'GET', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody - ); - } - - /** - * 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersGoalsGetAsyncWithHttpInfo( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsGet' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\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() - ); - } + 'PUT', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody ); } /** - * Operation plausibleWebPluginsAPIControllersGoalsIndex - * - * Retrieve Goals + * Operation plausibleWebPluginsAPIControllersSharedLinksGet + * Retrieve Shared Link by ID * - * @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 + * @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 * - * @return \Plausible\Analytics\WP\Client\Model\GoalListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError - * @throws \InvalidArgumentException + * @return \Plausible\Analytics\WP\Client\Model\SharedLink|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError + *@throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsIndex( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersSharedLinksGet( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersGoalsIndexWithHttpInfo( $limit, $after, $before, $contentType ); + [ $response ] = $this->plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo( $id, $contentType ); return $response; } /** - * Operation plausibleWebPluginsAPIControllersGoalsIndexWithHttpInfo - * - * Retrieve Goals + * Operation plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo + * Retrieve Shared Link by ID * - * @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 + * @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 * - * @return array of \Plausible\Analytics\WP\Client\Model\GoalListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError, HTTP status - * code, HTTP response headers (array of strings) + * @return array of \Plausible\Analytics\WP\Client\Model\SharedLink|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsIndexWithHttpInfo( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersGoalsIndexRequest( $limit, $after, $before, $contentType ); + $request = $this->plausibleWebPluginsAPIControllersSharedLinksGetRequest( $id, $contentType ); try { $options = $this->createHttpClientOption(); @@ -3373,40 +4039,82 @@ public function plausibleWebPluginsAPIControllersGoalsIndexWithHttpInfo( ); } - switch ( $statusCode ) { - case 200: - if ( '\Plausible\Analytics\WP\Client\Model\GoalListResponse' === '\SplFileObject' ) { + switch ( $statusCode ) { + case 201: + if ( '\Plausible\Analytics\WP\Client\Model\SharedLink' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\SharedLink' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\SharedLink', [] ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 401: + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' === '\SplFileObject' ) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' !== 'string' ) { + $content = json_decode( $content ); + } + } + + return [ + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), + $response->getStatusCode(), + $response->getHeaders(), + ]; + case 404: + if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\GoalListResponse' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\GoalListResponse', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\NotFoundError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; - case 401: - if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' === '\SplFileObject' ) { + case 422: + if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\UnauthorizedError' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\GoalListResponse'; + $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLink'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -3424,89 +4132,153 @@ public function plausibleWebPluginsAPIControllersGoalsIndexWithHttpInfo( } catch ( ApiException $e ) { switch ( $e->getCode() ) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\GoalListResponse', + '\Plausible\Analytics\WP\Client\Model\SharedLink', $e->getResponseHeaders() ); $e->setResponseObject( $data ); break; case 401: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + $e->getResponseBody(), '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', $e->getResponseHeaders() ); $e->setResponseObject( $data ); break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\NotFoundError', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', + $e->getResponseHeaders() + ); + $e->setResponseObject( $data ); + break; } throw $e; } } /** - * Create request for operation 'plausibleWebPluginsAPIControllersGoalsIndex' + * Operation plausibleWebPluginsAPIControllersSharedLinksGetAsync * - * @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 + * 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 \Plausible\Analytics\WP\Client\Lib\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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersSharedLinksGetAsyncWithHttpInfo( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\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 * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersGoalsIndexRequest( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersSharedLinksGetRequest( + $id, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'][0] ) { - $resourcePath = '/api/plugins/v1/goals'; + // 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; - // 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 - ) ?? [] - ); + // path params + if ( $id !== null ) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue( $id ), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( [ 'application/json', ], @@ -3530,7 +4302,7 @@ public function plausibleWebPluginsAPIControllersGoalsIndexRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -3541,12 +4313,13 @@ public function plausibleWebPluginsAPIControllersGoalsIndexRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -3564,130 +4337,55 @@ public function plausibleWebPluginsAPIControllersGoalsIndexRequest( } /** - * 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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 + * 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['plausibleWebPluginsAPIControllersGoalsIndex'] to - * see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @return \Plausible\Analytics\WP\Client\Model\SharedLinkListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError * @throws \InvalidArgumentException + * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersGoalsIndexAsyncWithHttpInfo( + public function plausibleWebPluginsAPIControllersSharedLinksIndex( $limit = null, $after = null, $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersGoalsIndex' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\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() - ); - } - ); - } - - /** - * Operation plausibleWebPluginsAPIControllersSharedLinksCreate - * - * Get or create Shared Link - * - * @param \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Model\SharedLink|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError - * @throws \InvalidArgumentException - * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response - */ - public function plausibleWebPluginsAPIControllersSharedLinksCreate( - $shared_link_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksCreate' ][ 0 ] + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo( $shared_link_create_request, $contentType ); + [ $response ] = $this->plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo( + $limit, + $after, + $before, + $contentType + ); return $response; } /** - * Operation plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo - * - * Get or create Shared Link + * Operation plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo + * Retrieve Shared Links * - * @param \Plausible\Analytics\WP\Client\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 + * @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 * - * @return array of - * \Plausible\Analytics\WP\Client\Model\SharedLink|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, - * HTTP status code, HTTP response headers (array of strings) + * @return array of \Plausible\Analytics\WP\Client\Model\SharedLinkListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError, HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo( - $shared_link_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksCreate' ][ 0 ] + public function plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersSharedLinksCreateRequest( $shared_link_create_request, $contentType ); + $request = + $this->plausibleWebPluginsAPIControllersSharedLinksIndexRequest( $limit, $after, $before, $contentType ); try { $options = $this->createHttpClientOption(); @@ -3719,18 +4417,22 @@ public function plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo( } switch ( $statusCode ) { - case 201: - if ( '\Plausible\Analytics\WP\Client\Model\SharedLink' === '\SplFileObject' ) { + case 200: + if ( '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\SharedLink' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\SharedLink', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -3745,28 +4447,17 @@ public function plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - case 422: - if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' !== 'string' ) { - $content = json_decode( $content ); - } - } - - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLink'; + $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -3784,10 +4475,10 @@ public function plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo( } catch ( ApiException $e ) { switch ( $e->getCode() ) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\SharedLink', + '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -3800,149 +4491,67 @@ public function plausibleWebPluginsAPIControllersSharedLinksCreateWithHttpInfo( ); $e->setResponseObject( $data ); break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; } throw $e; } } /** - * Create request for operation 'plausibleWebPluginsAPIControllersSharedLinksCreate' - * - * @param \Plausible\Analytics\WP\Client\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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request - * @throws \InvalidArgumentException - */ - 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 = \Plausible\Analytics\WP\Client\Lib\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 = \Plausible\Analytics\WP\Client\Lib\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 plausibleWebPluginsAPIControllersSharedLinksCreateAsync + * Operation plausibleWebPluginsAPIControllersSharedLinksIndexAsync * - * Get or create Shared Link + * Retrieve Shared Links * - * @param \Plausible\Analytics\WP\Client\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 + * @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 * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface * @throws \InvalidArgumentException + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface */ - public function plausibleWebPluginsAPIControllersSharedLinksCreateAsync( - $shared_link_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksCreate' ][ 0 ] + public function plausibleWebPluginsAPIControllersSharedLinksIndexAsync( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0] ) { - return $this->plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo( $shared_link_create_request, $contentType )->then( + return $this->plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpInfo( + $limit, + $after, + $before, + $contentType + )->then( function ( $response ) { - return $response[ 0 ]; + return $response[0]; } ); } /** - * Operation plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo - * - * Get or create Shared Link + * Operation plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpInfo + * Retrieve Shared Links * - * @param \Plausible\Analytics\WP\Client\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 + * @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 * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersSharedLinksCreateAsyncWithHttpInfo( - $shared_link_create_request = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksCreate' ][ 0 ] + public function plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpInfo( + $limit = null, + $after = null, + $before = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksIndex'][0] ) { - $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLink'; - $request = $this->plausibleWebPluginsAPIControllersSharedLinksCreateRequest( $shared_link_create_request, $contentType ); + $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse'; + $request = + $this->plausibleWebPluginsAPIControllersSharedLinksIndexRequest( $limit, $after, $before, $contentType ); return $this->client->sendAsync( $request, $this->createHttpClientOption() )->then( function ( $response ) use ( $returnType ) { @@ -3955,68 +4564,181 @@ function ( $response ) use ( $returnType ) { } } - 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() + ); + } + ); + } + + /** + * 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 + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @throws \InvalidArgumentException + */ + 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 = \Plausible\Analytics\WP\Client\Lib\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 plausibleWebPluginsAPIControllersSharedLinksGet - * - * Retrieve Shared Link by ID + * Operation plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet + * Retrieve Tracker Script Configuration * - * @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 + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'] to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Model\SharedLink|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError + * @return \Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration|\Plausible\Analytics\WP\Client\Model\UnauthorizedError * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersSharedLinksGet( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksGet' ][ 0 ] + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo( $id, $contentType ); + [ $response ] = + $this->plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetWithHttpInfo( $contentType ); return $response; } /** - * Operation plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo + * Operation plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetWithHttpInfo + * Retrieve Tracker Script Configuration * - * 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'] + * @param string $contentType The value for the Content-Type header. Check + * self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'] * to see the possible values for this operation * * @return array of - * \Plausible\Analytics\WP\Client\Model\SharedLink|\Plausible\Analytics\WP\Client\Model\UnauthorizedError|\Plausible\Analytics\WP\Client\Model\NotFoundError|\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError, + * \Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration|\Plausible\Analytics\WP\Client\Model\UnauthorizedError, * HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksGet' ][ 0 ] + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetWithHttpInfo( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersSharedLinksGetRequest( $id, $contentType ); + $request = $this->plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetRequest( $contentType ); try { $options = $this->createHttpClientOption(); @@ -4048,18 +4770,22 @@ public function plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo( } switch ( $statusCode ) { - case 201: - if ( '\Plausible\Analytics\WP\Client\Model\SharedLink' === '\SplFileObject' ) { + case 200: + if ( '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\SharedLink' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\SharedLink', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -4074,43 +4800,17 @@ public function plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - case 404: - if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\NotFoundError' !== 'string' ) { - $content = json_decode( $content ); - } - } - - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\NotFoundError', [] ), - $response->getStatusCode(), - $response->getHeaders(), - ]; - case 422: - if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' === '\SplFileObject' ) { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError' !== 'string' ) { - $content = json_decode( $content ); - } - } - - return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLink'; + $returnType = '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -4128,10 +4828,10 @@ public function plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo( } catch ( ApiException $e ) { switch ( $e->getCode() ) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\SharedLink', + '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -4144,65 +4844,101 @@ public function plausibleWebPluginsAPIControllersSharedLinksGetWithHttpInfo( ); $e->setResponseObject( $data ); break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\NotFoundError', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\UnprocessableEntityError', - $e->getResponseHeaders() - ); - $e->setResponseObject( $data ); - break; } throw $e; } } /** - * Create request for operation 'plausibleWebPluginsAPIControllersSharedLinksGet' + * Operation plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetAsync + * Retrieve Tracker Script Configuration * - * @param int $id Shared Link ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersSharedLinksGet'] + * @param string $contentType The value for the Content-Type header. Check + * self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'] * to see the possible values for this operation * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersSharedLinksGetRequest( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksGet' ][ 0 ] + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetAsync( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'][0] ) { + return $this->plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetAsyncWithHttpInfo( + $contentType + )->then( + function ( $response ) { + return $response[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' - ); - } + /** + * Operation plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetAsyncWithHttpInfo + * Retrieve Tracker Script Configuration + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'] to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetAsyncWithHttpInfo( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration'; + $request = $this->plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetRequest( $contentType ); - $resourcePath = '/api/plugins/v1/shared_links/{id}'; + 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 'plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet' + * + * @param string $contentType The value for the Content-Type header. Check + * self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'] + * to see the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationGetRequest( + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet'][0] + ) { + + $resourcePath = '/api/plugins/v1/tracker_script_configuration'; $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, @@ -4225,7 +4961,7 @@ public function plausibleWebPluginsAPIControllersSharedLinksGetRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -4236,152 +4972,101 @@ public function plausibleWebPluginsAPIControllersSharedLinksGetRequest( // 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() ); + $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 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersSharedLinksGetAsyncWithHttpInfo( - $id, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksGet' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLink'; - $request = $this->plausibleWebPluginsAPIControllersSharedLinksGetRequest( $id, $contentType ); + if ( $this->config->getUserAgent() ) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - 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 ); - } - } + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); - 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() - ); - } + $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 - * - * @return \Plausible\Analytics\WP\Client\Model\SharedLinkListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError + * Operation plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate + * Update Tracker Script Configuration + * + * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequest $tracker_script_configuration_update_request Tracker + * Script + * Configuration + * params + * (optional) + * @param string $contentType The + * value + * for + * the + * Content-Type + * header. + * Check + * self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'] + * to + * see + * the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration|\Plausible\Analytics\WP\Client\Model\UnauthorizedError * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersSharedLinksIndex( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate( + $tracker_script_configuration_update_request = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'][0] ) { - [ $response ] = $this->plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo( $limit, $after, $before, $contentType ); + [ $response ] = $this->plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateWithHttpInfo( + $tracker_script_configuration_update_request, + $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 + * Operation plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateWithHttpInfo + * Update Tracker Script Configuration + * + * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequest $tracker_script_configuration_update_request Tracker + * Script + * Configuration + * params + * (optional) + * @param string $contentType The + * value + * for + * the + * Content-Type + * header. + * Check + * self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'] + * to + * see + * the possible values for this operation * - * @return array of \Plausible\Analytics\WP\Client\Model\SharedLinkListResponse|\Plausible\Analytics\WP\Client\Model\UnauthorizedError, HTTP - * status code, HTTP response headers (array of strings) + * @return array of + * \Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration|\Plausible\Analytics\WP\Client\Model\UnauthorizedError, + * HTTP status code, HTTP response headers (array of strings) * @throws \InvalidArgumentException * @throws \Plausible\Analytics\WP\Client\ApiException on non-2xx response */ - public function plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateWithHttpInfo( + $tracker_script_configuration_update_request = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'][0] ) { - $request = $this->plausibleWebPluginsAPIControllersSharedLinksIndexRequest( $limit, $after, $before, $contentType ); + $request = $this->plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateRequest( + $tracker_script_configuration_update_request, + $contentType + ); try { $options = $this->createHttpClientOption(); @@ -4414,17 +5099,21 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo( switch ( $statusCode ) { case 200: - if ( '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse' === '\SplFileObject' ) { + if ( '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration' === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ( '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse' !== 'string' ) { + if ( '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration' !== 'string' ) { $content = json_decode( $content ); } } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; @@ -4439,13 +5128,17 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo( } return [ - ObjectSerializer::deserialize( $content, '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', [] ), + ObjectSerializer::deserialize( + $content, + '\Plausible\Analytics\WP\Client\Model\UnauthorizedError', + [] + ), $response->getStatusCode(), $response->getHeaders(), ]; } - $returnType = '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse'; + $returnType = '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration'; if ( $returnType === '\SplFileObject' ) { $content = $response->getBody(); //stream goes to serializer } else { @@ -4466,7 +5159,7 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo( case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Plausible\Analytics\WP\Client\Model\SharedLinkListResponse', + '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration', $e->getResponseHeaders() ); $e->setResponseObject( $data ); @@ -4485,69 +5178,143 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexWithHttpInfo( } /** - * Create request for operation 'plausibleWebPluginsAPIControllersSharedLinksIndex' + * Operation plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateAsync + * Update Tracker Script Configuration + * + * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequest $tracker_script_configuration_update_request Tracker + * Script + * Configuration + * params + * (optional) + * @param string $contentType The + * value + * for + * the + * Content-Type + * header. + * Check + * self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'] + * to + * see + * the possible values for this operation * - * @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 + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateAsync( + $tracker_script_configuration_update_request = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'][0] + ) { + return $this->plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateAsyncWithHttpInfo( + $tracker_script_configuration_update_request, + $contentType + )->then( + function ( $response ) { + return $response[0]; + } + ); + } + + /** + * Operation plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateAsyncWithHttpInfo + * Update Tracker Script Configuration + * + * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequest $tracker_script_configuration_update_request Tracker + * Script + * Configuration + * params + * (optional) + * @param string $contentType The + * value + * for + * the + * Content-Type + * header. + * Check + * self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'] + * to + * see + * the possible values for this operation + * + * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface + * @throws \InvalidArgumentException + */ + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateAsyncWithHttpInfo( + $tracker_script_configuration_update_request = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'][0] + ) { + $returnType = '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfiguration'; + $request = $this->plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateRequest( + $tracker_script_configuration_update_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 'plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate' + * + * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequest $tracker_script_configuration_update_request Tracker + * Script + * Configuration + * params + * (optional) + * @param string $contentType The + * value + * for + * the + * Content-Type + * header. + * Check + * self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'] + * to + * see + * the possible values for this operation * * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Psr7\Request * @throws \InvalidArgumentException */ - public function plausibleWebPluginsAPIControllersSharedLinksIndexRequest( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksIndex' ][ 0 ] + public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdateRequest( + $tracker_script_configuration_update_request = null, + string $contentType = self::contentTypes['plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate'][0] ) { - $resourcePath = '/api/plugins/v1/shared_links'; + $resourcePath = '/api/plugins/v1/tracker_script_configuration'; $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, @@ -4555,7 +5322,16 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexRequest( ); // for model (json/xml) - if ( count( $formParams ) > 0 ) { + if ( isset( $tracker_script_configuration_update_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( $tracker_script_configuration_update_request ) + ); + } else { + $httpBody = $tracker_script_configuration_update_request; + } + } elseif ( count( $formParams ) > 0 ) { if ( $multipart ) { $multipartContents = []; foreach ( $formParams as $formParamName => $formParamValue ) { @@ -4570,7 +5346,7 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexRequest( // for HTTP post (form) $httpBody = new MultipartStream( $multipartContents ); - } elseif ( stripos( $headers[ 'Content-Type' ], 'application/json' ) !== false ) { + } elseif ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the form parameters $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( $formParams ); } else { @@ -4581,12 +5357,13 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexRequest( // 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() ); + $headers['Authorization'] = + 'Basic ' . base64_encode( $this->config->getUsername() . ":" . $this->config->getPassword() ); } $defaultHeaders = []; if ( $this->config->getUserAgent() ) { - $defaultHeaders[ 'User-Agent' ] = $this->config->getUserAgent(); + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( @@ -4599,90 +5376,24 @@ public function plausibleWebPluginsAPIControllersSharedLinksIndexRequest( $query = ObjectSerializer::buildQuery( $queryParams ); return new Request( - 'GET', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody + 'PUT', $operationHost . $resourcePath . ( $query ? "?{$query}" : '' ), $headers, $httpBody ); } /** - * 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException + * Create http client option + * @return array of http client options + * @throws \RuntimeException on file opening failure */ - 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 ]; + 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() ); } - ); - } - - /** - * 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 - * - * @return \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Promise\PromiseInterface - * @throws \InvalidArgumentException - */ - public function plausibleWebPluginsAPIControllersSharedLinksIndexAsyncWithHttpInfo( - $limit = null, - $after = null, - $before = null, - string $contentType = self::contentTypes[ 'plausibleWebPluginsAPIControllersSharedLinksIndex' ][ 0 ] - ) { - $returnType = '\Plausible\Analytics\WP\Client\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() - ); - } - ); + return $options; } } diff --git a/src/Client/lib/ApiException.php b/src/Client/lib/ApiException.php index 86a4cd4..249b174 100644 --- a/src/Client/lib/ApiException.php +++ b/src/Client/lib/ApiException.php @@ -40,16 +40,15 @@ class ApiException extends Exception { /** * The HTTP body of the server response either as Json or string. - * * @var \stdClass|string|null */ protected $responseBody; - /** - * The HTTP header of the server response. - * - * @var string[]|null - */ + /** + * The HTTP header of the server response. + * + * @var string[]|null + */ protected $responseHeaders; /** @@ -65,7 +64,8 @@ class ApiException extends Exception { * @param string $message Error message * @param int $code HTTP status code * @param string[]|null $responseHeaders HTTP response header - * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string + * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or + * string */ public function __construct( $message = "", $code = 0, $responseHeaders = [], $responseBody = null ) { parent::__construct( $message, $code ); @@ -91,15 +91,6 @@ public function getResponseBody() { return $this->responseBody; } - /** - * Gets the deserialized response object (during deserialization) - * - * @return mixed the deserialized response object - */ - public function getResponseObject() { - return $this->responseObject; - } - /** * Sets the deserialized response object (during deserialization) * @@ -110,4 +101,12 @@ public function getResponseObject() { 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/lib/Configuration.php b/src/Client/lib/Configuration.php index 033efb1..f307532 100644 --- a/src/Client/lib/Configuration.php +++ b/src/Client/lib/Configuration.php @@ -48,16 +48,15 @@ class Configuration { /** * Associate array to store API key(s) - * * @var string[] */ protected $apiKeys = []; - /** - * Associate array to store API prefix (e.g. Bearer) - * - * @var string[] - */ + /** + * Associate array to store API prefix (e.g. Bearer) + * + * @var string[] + */ protected $apiKeyPrefixes = []; /** @@ -131,90 +130,64 @@ public function __construct() { } /** - * Gets the essential information for debugging - * - * @return string The report for debugging - */ - public static function toDebugReport() { - $report = 'PHP SDK (Plausible\Analytics\WP\Client) Debug Report:' . PHP_EOL; - $report .= ' OS: ' . php_uname() . PHP_EOL; - $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' The version of the OpenAPI document: 1.0-rc' . PHP_EOL; - $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; - - return $report; - } - - /** - * Gets the temp folder path - * - * @return string Temp folder path - */ - public function getTempFolderPath() { - return $this->tempFolderPath; - } - - /** - * Sets the temp folder path + * Sets API key * - * @param string $tempFolderPath Temp folder path + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token * * @return $this */ - public function setTempFolderPath( $tempFolderPath ) { - $this->tempFolderPath = $tempFolderPath; + public function setApiKey( $apiKeyIdentifier, $key ) { + $this->apiKeys[ $apiKeyIdentifier ] = $key; return $this; } /** - * Gets the default configuration instance + * Gets API key * - * @return Configuration + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token */ - public static function getDefaultConfiguration() { - if ( self::$defaultConfiguration === null ) { - self::$defaultConfiguration = new Configuration(); - } - - return self::$defaultConfiguration; + public function getApiKey( $apiKeyIdentifier ) { + return isset( $this->apiKeys[ $apiKeyIdentifier ] ) ? $this->apiKeys[ $apiKeyIdentifier ] : null; } /** - * Sets the default configuration instance + * Sets the prefix for API key (e.g. Bearer) * - * @param Configuration $config An instance of the Configuration Object + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer * - * @return void + * @return $this */ - public static function setDefaultConfiguration( Configuration $config ) { - self::$defaultConfiguration = $config; + public function setApiKeyPrefix( $apiKeyIdentifier, $prefix ) { + $this->apiKeyPrefixes[ $apiKeyIdentifier ] = $prefix; + + return $this; } /** - * Sets API key + * Gets API key prefix * * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $key API key or token * - * @return $this + * @return null|string */ - public function setApiKey( $apiKeyIdentifier, $key ) { - $this->apiKeys[ $apiKeyIdentifier ] = $key; - - return $this; + public function getApiKeyPrefix( $apiKeyIdentifier ) { + return isset( $this->apiKeyPrefixes[ $apiKeyIdentifier ] ) ? $this->apiKeyPrefixes[ $apiKeyIdentifier ] : null; } /** - * Sets the prefix for API key (e.g. Bearer) + * Sets the access token for OAuth * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $prefix API key prefix, e.g. Bearer + * @param string $accessToken Token for OAuth * * @return $this */ - public function setApiKeyPrefix( $apiKeyIdentifier, $prefix ) { - $this->apiKeyPrefixes[ $apiKeyIdentifier ] = $prefix; + public function setAccessToken( $accessToken ) { + $this->accessToken = $accessToken; return $this; } @@ -229,14 +202,14 @@ public function getAccessToken() { } /** - * Sets the access token for OAuth + * Sets boolean format for query string. * - * @param string $accessToken Token for OAuth + * @param string $booleanFormatForQueryString Boolean format for query string * * @return $this */ - public function setAccessToken( $accessToken ) { - $this->accessToken = $accessToken; + public function setBooleanFormatForQueryString( string $booleanFormat ) { + $this->booleanFormatForQueryString = $booleanFormat; return $this; } @@ -251,14 +224,14 @@ public function getBooleanFormatForQueryString(): string { } /** - * Sets boolean format for query string. + * Sets the username for HTTP basic authentication * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $username Username for HTTP basic authentication * * @return $this */ - public function setBooleanFormatForQueryString( string $booleanFormat ) { - $this->booleanFormatForQueryString = $booleanFormat; + public function setUsername( $username ) { + $this->username = $username; return $this; } @@ -273,14 +246,14 @@ public function getUsername() { } /** - * Sets the username for HTTP basic authentication + * Sets the password for HTTP basic authentication * - * @param string $username Username for HTTP basic authentication + * @param string $password Password for HTTP basic authentication * * @return $this */ - public function setUsername( $username ) { - $this->username = $username; + public function setPassword( $password ) { + $this->password = $password; return $this; } @@ -295,14 +268,14 @@ public function getPassword() { } /** - * Sets the password for HTTP basic authentication + * Sets the host * - * @param string $password Password for HTTP basic authentication + * @param string $host Host * * @return $this */ - public function setPassword( $password ) { - $this->password = $password; + public function setHost( $host ) { + $this->host = $host; return $this; } @@ -317,14 +290,19 @@ public function getHost() { } /** - * Sets the host + * Sets the user agent of the api client * - * @param string $host Host + * @param string $userAgent the user agent of the api client * + * @throws \InvalidArgumentException * @return $this */ - public function setHost( $host ) { - $this->host = $host; + public function setUserAgent( $userAgent ) { + if ( ! is_string( $userAgent ) ) { + throw new \InvalidArgumentException( 'User-agent must be a string.' ); + } + + $this->userAgent = $userAgent; return $this; } @@ -339,19 +317,14 @@ public function getUserAgent() { } /** - * Sets the user agent of the api client + * Sets debug flag * - * @param string $userAgent the user agent of the api client + * @param bool $debug Debug flag * * @return $this - * @throws \InvalidArgumentException */ - public function setUserAgent( $userAgent ) { - if ( ! is_string( $userAgent ) ) { - throw new \InvalidArgumentException( 'User-agent must be a string.' ); - } - - $this->userAgent = $userAgent; + public function setDebug( $debug ) { + $this->debug = $debug; return $this; } @@ -366,14 +339,14 @@ public function getDebug() { } /** - * Sets debug flag + * Sets the debug file * - * @param bool $debug Debug flag + * @param string $debugFile Debug file * * @return $this */ - public function setDebug( $debug ) { - $this->debug = $debug; + public function setDebugFile( $debugFile ) { + $this->debugFile = $debugFile; return $this; } @@ -388,18 +361,64 @@ public function getDebugFile() { } /** - * Sets the debug file + * Sets the temp folder path * - * @param string $debugFile Debug file + * @param string $tempFolderPath Temp folder path * * @return $this */ - public function setDebugFile( $debugFile ) { - $this->debugFile = $debugFile; + 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 (Plausible\Analytics\WP\Client) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 1.0-rc' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + /** * Get API key (with prefix if set) * @@ -411,7 +430,7 @@ public function getApiKeyWithPrefix( $apiKeyIdentifier ) { $prefix = $this->getApiKeyPrefix( $apiKeyIdentifier ); $apiKey = $this->getApiKey( $apiKeyIdentifier ); - if ( $apiKey === null ) { + if ($apiKey === null ) { return null; } @@ -425,79 +444,65 @@ public function getApiKeyWithPrefix( $apiKeyIdentifier ) { } /** - * 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; - } - - /** - * 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; - } - - /** - * 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) + * Returns an array of host settings * - * @return string URL based on host settings + * @return array an array of host settings */ - public function getHostFromSettings( $index, $variables = null ) { - return self::getHostString( $this->getHostSettings(), $index, $variables ); + 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 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 $hostsSettings, $hostIndex, ?array $variables = null ) { + public static function getHostString( array $hostsSettings, $hostIndex, array $variables = null ) { if ( null === $variables ) { $variables = []; } // check array index out of bound if ( $hostIndex < 0 || $hostIndex >= count( $hostsSettings ) ) { - throw new \InvalidArgumentException( "Invalid index $hostIndex when selecting the host. Must be less than " . count( $hostsSettings ) ); + throw new \InvalidArgumentException( + "Invalid index $hostIndex when selecting the host. Must be less than " . count( $hostsSettings ) + ); } $host = $hostsSettings[ $hostIndex ]; - $url = $host[ "url" ]; + $url = $host["url"]; // go through variable and assign a value - foreach ( $host[ "variables" ] ?? [] as $name => $variable ) { + 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 + 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" ] ) . + join( ',', $variable["enum_values"] ) . "." ); } } else { // use default value - $url = str_replace( "{" . $name . "}", $variable[ "default_value" ], $url ); + $url = str_replace( "{" . $name . "}", $variable["default_value"], $url ); } } @@ -505,16 +510,13 @@ public static function getHostString( array $hostsSettings, $hostIndex, ?array $ } /** - * Returns an array of host settings + * Returns URL based on the index and variables * - * @return array an array of host settings + * @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 getHostSettings() { - return [ - [ - "url" => "https://plausible.io", - "description" => "This server", - ], - ]; + public function getHostFromSettings( $index, $variables = null ) { + return self::getHostString( $this->getHostSettings(), $index, $variables ); } } diff --git a/src/Client/lib/HeaderSelector.php b/src/Client/lib/HeaderSelector.php index e7f9ae9..edd6ebf 100644 --- a/src/Client/lib/HeaderSelector.php +++ b/src/Client/lib/HeaderSelector.php @@ -48,7 +48,7 @@ public function selectHeaders( array $accept, string $contentType, bool $isMulti $accept = $this->selectAcceptHeader( $accept ); if ( $accept !== null ) { - $headers[ 'Accept' ] = $accept; + $headers['Accept'] = $accept; } if ( ! $isMultipart ) { @@ -56,7 +56,7 @@ public function selectHeaders( array $accept, string $contentType, bool $isMulti $contentType = 'application/json'; } - $headers[ 'Content-Type' ] = $contentType; + $headers['Content-Type'] = $contentType; } return $headers; @@ -112,19 +112,19 @@ private function getAcceptHeaderWithAdjustedWeight( array $accept, array $header $headerData = $this->getHeaderAndWeight( $header ); - if ( stripos( $headerData[ 'header' ], 'application/json' ) === 0 ) { - $processedHeaders[ 'withApplicationJson' ][] = $headerData; + if ( stripos( $headerData['header'], 'application/json' ) === 0 ) { + $processedHeaders['withApplicationJson'][] = $headerData; } elseif ( in_array( $header, $headersWithJson, true ) ) { - $processedHeaders[ 'withJson' ][] = $headerData; + $processedHeaders['withJson'][] = $headerData; } else { - $processedHeaders[ 'withoutJson' ][] = $headerData; + $processedHeaders['withoutJson'][] = $headerData; } } $acceptHeaders = []; $currentWeight = 1000; - $hasMoreThan28Headers = count( $accept ) > 28; + $hasMoreThan28Headers = count( $accept) > 28; foreach ( $processedHeaders as $headers ) { if ( count( $headers ) > 0 ) { @@ -148,8 +148,8 @@ 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 ), + 'header' => $outputArray[1], + 'weight' => (int) ( $outputArray[2] * 1000 ), ]; } else { $headerData = [ @@ -172,19 +172,19 @@ private function adjustWeight( array $headers, float &$currentWeight, bool $hasM usort( $headers, function ( array $a, array $b ) { - return $b[ 'weight' ] - $a[ 'weight' ]; + return $b['weight'] - $a['weight']; } ); $acceptHeaders = []; foreach ( $headers as $index => $header ) { - if ( $index > 0 && $headers[ $index - 1 ][ 'weight' ] > $header[ 'weight' ] ) { + if ( $index > 0 && $headers[ $index - 1 ]['weight'] > $header['weight'] ) { $currentWeight = $this->getNextWeight( $currentWeight, $hasMoreThan28Headers ); } $weight = $currentWeight; - $acceptHeaders[] = $this->buildAcceptHeader( $header[ 'header' ], $weight ); + $acceptHeaders[] = $this->buildAcceptHeader( $header['header'], $weight ); } $currentWeight = $this->getNextWeight( $currentWeight, $hasMoreThan28Headers ); @@ -193,22 +193,30 @@ function ( array $a, array $b ) { } /** - * 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: + * @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. + * 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 @@ -218,26 +226,12 @@ function ( array $a, array $b ) { public function getNextWeight( int $currentWeight, bool $hasMoreThan28Headers ): int { if ( $currentWeight <= 1 ) { return 1; - } + } - if ( $hasMoreThan28Headers ) { - return $currentWeight - 1; - } + if ($hasMoreThan28Headers ) { + return $currentWeight - 1; + } return $currentWeight - 10 ** floor( log10( $currentWeight - 1 ) ); } - - /** - * @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' ); - } } diff --git a/src/Client/lib/Model/Capabilities.php b/src/Client/lib/Model/Capabilities.php index 727b9b1..1298dec 100644 --- a/src/Client/lib/Model/Capabilities.php +++ b/src/Client/lib/Model/Capabilities.php @@ -33,12 +33,11 @@ /** * Capabilities Class Doc Comment - * - * @category Class + * @category Class * @description Capabilities object - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class Capabilities implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class Capabilities implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Capabilities'; @@ -87,80 +85,50 @@ class Capabilities implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'authorized' => 'setAuthorized', - 'data_domain' => 'setDataDomain', - 'features' => 'setFeatures', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'authorized' => 'getAuthorized', - 'data_domain' => 'getDataDomain', - 'features' => 'getFeatures', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'authorized', $data ?? [], null ); - $this->setIfExists( 'data_domain', $data ?? [], null ); - $this->setIfExists( 'features', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -175,31 +143,49 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'authorized' => 'authorized', + 'data_domain' => 'data_domain', + 'features' => 'features', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -213,7 +199,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -222,7 +207,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -230,42 +214,49 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'authorized', $data ?? [], null ); + $this->setIfExists( 'data_domain', $data ?? [], null ); + $this->setIfExists( 'features', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -276,13 +267,13 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'authorized' ] === null ) { + if ( $this->container['authorized'] === null ) { $invalidProperties[] = "'authorized' can't be null"; } - if ( $this->container[ 'data_domain' ] === null ) { + if ( $this->container['data_domain'] === null ) { $invalidProperties[] = "'data_domain' can't be null"; } - if ( $this->container[ 'features' ] === null ) { + if ( $this->container['features'] === null ) { $invalidProperties[] = "'features' can't be null"; } @@ -290,12 +281,21 @@ public function listInvalidProperties() { } /** - * Gets authorized + * 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' ]; + return $this->container['authorized']; } /** @@ -309,18 +309,17 @@ public function setAuthorized( $authorized ) { if ( is_null( $authorized ) ) { throw new \InvalidArgumentException( 'non-nullable authorized cannot be null' ); } - $this->container[ 'authorized' ] = $authorized; + $this->container['authorized'] = $authorized; return $this; } /** * Gets data_domain - * * @return string - */ + */ public function getDataDomain() { - return $this->container[ 'data_domain' ]; + return $this->container['data_domain']; } /** @@ -341,27 +340,17 @@ public function setDataDomain( $data_domain ) { $this->setOpenAPINullablesSetToNull( $nullablesSetToNull ); } } - $this->container[ 'data_domain' ] = $data_domain; + $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' ]; + return $this->container['features']; } /** @@ -375,7 +364,7 @@ public function setFeatures( $features ) { if ( is_null( $features ) ) { throw new \InvalidArgumentException( 'non-nullable features cannot be null' ); } - $this->container[ 'features' ] = $features; + $this->container['features'] = $features; return $this; } @@ -432,7 +421,6 @@ public function offsetUnset( $offset ): void { /** * 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 diff --git a/src/Client/lib/Model/CapabilitiesFeatures.php b/src/Client/lib/Model/CapabilitiesFeatures.php index 456dfd3..6eda8f6 100644 --- a/src/Client/lib/Model/CapabilitiesFeatures.php +++ b/src/Client/lib/Model/CapabilitiesFeatures.php @@ -45,22 +45,26 @@ class CapabilitiesFeatures implements ModelInterface, ArrayAccess, \JsonSerializ /** * 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[] - */ + /** + * 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', + 'consolidated_view' => 'bool', + 'funnels' => 'bool', + 'goals' => 'bool', + 'props' => 'bool', + 'revenue_goals' => 'bool', + 'sso' => 'bool', + 'shared_links' => 'bool', + 'site_segments' => 'bool', + 'sites_api' => 'bool', + 'stats_api' => 'bool', ]; /** @@ -71,11 +75,16 @@ class CapabilitiesFeatures implements ModelInterface, ArrayAccess, \JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ - 'funnels' => null, - 'goals' => null, - 'props' => null, - 'revenue_goals' => null, - 'stats_api' => null, + 'consolidated_view' => null, + 'funnels' => null, + 'goals' => null, + 'props' => null, + 'revenue_goals' => null, + 'sso' => null, + 'shared_links' => null, + 'site_segments' => null, + 'sites_api' => null, + 'stats_api' => null, ]; /** @@ -84,96 +93,63 @@ class CapabilitiesFeatures implements ModelInterface, ArrayAccess, \JsonSerializ * @var boolean[] */ protected static array $openAPINullables = [ - 'funnels' => false, - 'goals' => false, - 'props' => false, + 'consolidated_view' => false, + 'funnels' => false, + 'goals' => false, + 'props' => false, 'revenue_goals' => false, - 'stats_api' => false, + 'sso' => false, + 'shared_links' => false, + 'site_segments' => false, + 'sites_api' => false, + '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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'funnels' => 'setFunnels', - 'goals' => 'setGoals', - 'props' => 'setProps', - 'revenue_goals' => 'setRevenueGoals', - 'stats_api' => 'setStatsApi', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'funnels' => 'getFunnels', - 'goals' => 'getGoals', - 'props' => 'getProps', - 'revenue_goals' => 'getRevenueGoals', - 'stats_api' => 'getStatsApi', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - 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 ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -188,31 +164,70 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'consolidated_view' => 'ConsolidatedView', + 'funnels' => 'Funnels', + 'goals' => 'Goals', + 'props' => 'Props', + 'revenue_goals' => 'RevenueGoals', + 'sso' => 'SSO', + 'shared_links' => 'SharedLinks', + 'site_segments' => 'SiteSegments', + 'sites_api' => 'SitesAPI', + 'stats_api' => 'StatsAPI', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + protected static $setters = [ + 'consolidated_view' => 'setConsolidatedView', + 'funnels' => 'setFunnels', + 'goals' => 'setGoals', + 'props' => 'setProps', + 'revenue_goals' => 'setRevenueGoals', + 'sso' => 'setSso', + 'shared_links' => 'setSharedLinks', + 'site_segments' => 'setSiteSegments', + 'sites_api' => 'setSitesApi', + 'stats_api' => 'setStatsApi', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'consolidated_view' => 'getConsolidatedView', + 'funnels' => 'getFunnels', + 'goals' => 'getGoals', + 'props' => 'getProps', + 'revenue_goals' => 'getRevenueGoals', + 'sso' => 'getSso', + 'shared_links' => 'getSharedLinks', + 'site_segments' => 'getSiteSegments', + 'sites_api' => 'getSitesApi', + 'stats_api' => 'getStatsApi', + ]; /** * Array of attributes where the key is the local name, @@ -226,7 +241,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -235,7 +249,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -243,42 +256,56 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'consolidated_view', $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( 'sso', $data ?? [], null ); + $this->setIfExists( 'shared_links', $data ?? [], null ); + $this->setIfExists( 'site_segments', $data ?? [], null ); + $this->setIfExists( 'sites_api', $data ?? [], null ); + $this->setIfExists( 'stats_api', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -289,19 +316,34 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'funnels' ] === null ) { + if ( $this->container['consolidated_view'] === null ) { + $invalidProperties[] = "'consolidated_view' can't be null"; + } + if ( $this->container['funnels'] === null ) { $invalidProperties[] = "'funnels' can't be null"; } - if ( $this->container[ 'goals' ] === null ) { + if ( $this->container['goals'] === null ) { $invalidProperties[] = "'goals' can't be null"; } - if ( $this->container[ 'props' ] === null ) { + if ( $this->container['props'] === null ) { $invalidProperties[] = "'props' can't be null"; } - if ( $this->container[ 'revenue_goals' ] === null ) { + if ( $this->container['revenue_goals'] === null ) { $invalidProperties[] = "'revenue_goals' can't be null"; } - if ( $this->container[ 'stats_api' ] === null ) { + if ( $this->container['sso'] === null ) { + $invalidProperties[] = "'sso' can't be null"; + } + if ( $this->container['shared_links'] === null ) { + $invalidProperties[] = "'shared_links' can't be null"; + } + if ( $this->container['site_segments'] === null ) { + $invalidProperties[] = "'site_segments' can't be null"; + } + if ( $this->container['sites_api'] === null ) { + $invalidProperties[] = "'sites_api' can't be null"; + } + if ( $this->container['stats_api'] === null ) { $invalidProperties[] = "'stats_api' can't be null"; } @@ -309,12 +351,45 @@ public function listInvalidProperties() { } /** - * Gets funnels + * 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 consolidated_view + * @return bool + */ + public function getConsolidatedView() { + return $this->container['consolidated_view']; + } + + /** + * Sets consolidated_view + * + * @param bool $consolidated_view consolidated_view + * + * @return self + */ + public function setConsolidatedView( $consolidated_view ) { + if ( is_null( $consolidated_view ) ) { + throw new \InvalidArgumentException( 'non-nullable consolidated_view cannot be null' ); + } + $this->container['consolidated_view'] = $consolidated_view; + + return $this; + } + + /** + * Gets funnels * @return bool */ public function getFunnels() { - return $this->container[ 'funnels' ]; + return $this->container['funnels']; } /** @@ -328,7 +403,7 @@ public function setFunnels( $funnels ) { if ( is_null( $funnels ) ) { throw new \InvalidArgumentException( 'non-nullable funnels cannot be null' ); } - $this->container[ 'funnels' ] = $funnels; + $this->container['funnels'] = $funnels; return $this; } @@ -339,7 +414,7 @@ public function setFunnels( $funnels ) { * @return bool */ public function getGoals() { - return $this->container[ 'goals' ]; + return $this->container['goals']; } /** @@ -353,7 +428,7 @@ public function setGoals( $goals ) { if ( is_null( $goals ) ) { throw new \InvalidArgumentException( 'non-nullable goals cannot be null' ); } - $this->container[ 'goals' ] = $goals; + $this->container['goals'] = $goals; return $this; } @@ -364,7 +439,7 @@ public function setGoals( $goals ) { * @return bool */ public function getProps() { - return $this->container[ 'props' ]; + return $this->container['props']; } /** @@ -378,18 +453,17 @@ public function setProps( $props ) { if ( is_null( $props ) ) { throw new \InvalidArgumentException( 'non-nullable props cannot be null' ); } - $this->container[ 'props' ] = $props; + $this->container['props'] = $props; return $this; } /** * Gets revenue_goals - * * @return bool */ public function getRevenueGoals() { - return $this->container[ 'revenue_goals' ]; + return $this->container['revenue_goals']; } /** @@ -403,32 +477,128 @@ 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; + $this->container['revenue_goals'] = $revenue_goals; return $this; } /** - * Gets stats_api + * Gets sso * * @return bool */ + public function getSso() { + return $this->container['sso']; + } + + /** + * Sets sso + * + * @param bool $sso sso + * + * @return self + */ + public function setSso( $sso ) { + if ( is_null( $sso ) ) { + throw new \InvalidArgumentException( 'non-nullable sso cannot be null' ); + } + $this->container['sso'] = $sso; + + return $this; + } + + /** + * Gets shared_links + * @return bool + */ + public function getSharedLinks() { + return $this->container['shared_links']; + } + + /** + * Sets shared_links + * + * @param bool $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; + } + + /** + * Gets site_segments + * @return bool + */ + public function getSiteSegments() { + return $this->container['site_segments']; + } + + /** + * Sets site_segments + * + * @param bool $site_segments site_segments + * + * @return self + */ + public function setSiteSegments( $site_segments ) { + if ( is_null( $site_segments ) ) { + throw new \InvalidArgumentException( 'non-nullable site_segments cannot be null' ); + } + $this->container['site_segments'] = $site_segments; + + return $this; + } + + /** + * Gets sites_api + * @return bool + */ + public function getSitesApi() { + return $this->container['sites_api']; + } + + /** + * Sets sites_api + * + * @param bool $sites_api sites_api + * + * @return self + */ + public function setSitesApi( $sites_api ) { + if ( is_null( $sites_api ) ) { + throw new \InvalidArgumentException( 'non-nullable sites_api cannot be null' ); + } + $this->container['sites_api'] = $sites_api; + + return $this; + } + + /** + * Gets stats_api + * @return bool + */ public function getStatsApi() { - return $this->container[ 'stats_api' ]; + return $this->container['stats_api']; } /** * Sets stats_api * * @param bool $stats_api stats_api - * - * @return self + * + * @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; + $this->container['stats_api'] = $stats_api; return $this; } @@ -485,7 +655,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -498,7 +667,6 @@ public function jsonSerialize() { /** * Gets the string presentation of the object - * * @return string */ public function __toString() { @@ -510,21 +678,11 @@ public function __toString() { /** * 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 d87b4cf..35306f2 100644 --- a/src/Client/lib/Model/CustomProp.php +++ b/src/Client/lib/Model/CustomProp.php @@ -33,12 +33,11 @@ /** * CustomProp Class Doc Comment - * - * @category Class + * @category Class * @description Custom Property object - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class CustomProp implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class CustomProp implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'CustomProp'; @@ -81,72 +79,50 @@ class CustomProp implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'custom_prop' => 'setCustomProp', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'custom_prop' => 'getCustomProp', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'custom_prop', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'custom_prop' => 'custom_prop', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_prop', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'custom_prop' ] === null ) { + if ( $this->container['custom_prop'] === null) { $invalidProperties[] = "'custom_prop' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets custom_prop + * 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' ]; + return $this->container['custom_prop']; } /** @@ -289,7 +289,7 @@ 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; + $this->container['custom_prop'] = $custom_prop; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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 397f98c..d4f3ebc 100644 --- a/src/Client/lib/Model/CustomPropCustomProp.php +++ b/src/Client/lib/Model/CustomPropCustomProp.php @@ -45,16 +45,15 @@ class CustomPropCustomProp implements ModelInterface, ArrayAccess, \JsonSerializ /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'key' => 'string', ]; @@ -80,72 +79,50 @@ class CustomPropCustomProp implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'key' => 'setKey', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'key' => 'getKey', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'key', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -160,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'key' => 'key', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -198,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -207,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -215,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'key', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -261,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'key' ] === null ) { + if ( $this->container['key'] === null ) { $invalidProperties[] = "'key' can't be null"; } @@ -269,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets key + * 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' ]; + return $this->container['key']; } /** @@ -288,7 +289,7 @@ public function setKey( $key ) { if ( is_null( $key ) ) { throw new \InvalidArgumentException( 'non-nullable key cannot be null' ); } - $this->container[ 'key' ] = $key; + $this->container['key'] = $key; return $this; } @@ -345,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -376,15 +376,6 @@ public function __toString() { 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 8703cbe..a77e3a5 100644 --- a/src/Client/lib/Model/CustomPropDisableRequest.php +++ b/src/Client/lib/Model/CustomPropDisableRequest.php @@ -33,12 +33,11 @@ /** * CustomPropDisableRequest Class Doc Comment - * - * @category Class + * @category Class * @description Custom Property disable params - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class CustomPropDisableRequest implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class CustomPropDisableRequest implements ModelInterface, ArrayAccess, \JsonSeri /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'CustomProp.DisableRequest'; @@ -84,76 +82,50 @@ class CustomPropDisableRequest implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - 'custom_prop' => 'setCustomProp', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - 'custom_prop' => 'getCustomProp', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'custom_props', $data ?? [], null ); - $this->setIfExists( 'custom_prop', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -168,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + 'custom_prop' => 'custom_prop', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -206,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -215,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -223,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $data ?? [], null ); + $this->setIfExists( 'custom_prop', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -269,14 +260,15 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'custom_props' ] === null ) { + 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 ( ( 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 ) { + if ( $this->container['custom_prop'] === null) { $invalidProperties[] = "'custom_prop' can't be null"; } @@ -284,12 +276,21 @@ public function listInvalidProperties() { } /** - * Gets custom_props + * 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' ]; + return $this->container['custom_props']; } /** @@ -309,18 +310,17 @@ public function setCustomProps( $custom_props ) { '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; + $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' ]; + return $this->container['custom_prop']; } /** @@ -334,7 +334,7 @@ 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; + $this->container['custom_prop'] = $custom_prop; return $this; } @@ -391,7 +391,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -422,15 +421,6 @@ public function __toString() { 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 0ae278f..e58ed73 100644 --- a/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php +++ b/src/Client/lib/Model/CustomPropDisableRequestBulkDisable.php @@ -33,12 +33,11 @@ /** * CustomPropDisableRequestBulkDisable Class Doc Comment - * - * @category Class + * @category Class * @description Bulk Custom Property disable request - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class CustomPropDisableRequestBulkDisable implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class CustomPropDisableRequestBulkDisable implements ModelInterface, ArrayAccess /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'CustomProp_DisableRequest_BulkDisable'; @@ -81,72 +79,50 @@ class CustomPropDisableRequestBulkDisable implements ModelInterface, ArrayAccess ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'custom_props', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,23 +253,32 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'custom_props' ] === null ) { + 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 ( ( 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' ]; + return $this->container['custom_props']; } /** @@ -298,7 +298,7 @@ public function setCustomProps( $custom_props ) { '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; + $this->container['custom_props'] = $custom_props; return $this; } @@ -355,7 +355,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -386,15 +385,6 @@ public function __toString() { 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 cb892da..b116a61 100644 --- a/src/Client/lib/Model/CustomPropEnableRequest.php +++ b/src/Client/lib/Model/CustomPropEnableRequest.php @@ -33,12 +33,11 @@ /** * CustomPropEnableRequest Class Doc Comment - * - * @category Class + * @category Class * @description Custom Property enable params - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class CustomPropEnableRequest implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class CustomPropEnableRequest implements ModelInterface, ArrayAccess, \JsonSeria /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'CustomProp.EnableRequest'; @@ -84,76 +82,50 @@ class CustomPropEnableRequest implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - 'custom_prop' => 'setCustomProp', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - 'custom_prop' => 'getCustomProp', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'custom_props', $data ?? [], null ); - $this->setIfExists( 'custom_prop', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -168,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + 'custom_prop' => 'custom_prop', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -206,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -215,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -223,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $data ?? [], null ); + $this->setIfExists( 'custom_prop', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -269,14 +260,15 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'custom_props' ] === null ) { + 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 ( ( 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 ) { + if ( $this->container['custom_prop'] === null) { $invalidProperties[] = "'custom_prop' can't be null"; } @@ -284,12 +276,21 @@ public function listInvalidProperties() { } /** - * Gets custom_props + * 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' ]; + return $this->container['custom_props']; } /** @@ -309,18 +310,17 @@ public function setCustomProps( $custom_props ) { '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; + $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' ]; + return $this->container['custom_prop']; } /** @@ -334,7 +334,7 @@ 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; + $this->container['custom_prop'] = $custom_prop; return $this; } @@ -391,7 +391,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -422,15 +421,6 @@ public function __toString() { 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/CustomPropEnableRequestBulkEnable.php b/src/Client/lib/Model/CustomPropEnableRequestBulkEnable.php index d76339f..6bb839a 100644 --- a/src/Client/lib/Model/CustomPropEnableRequestBulkEnable.php +++ b/src/Client/lib/Model/CustomPropEnableRequestBulkEnable.php @@ -33,12 +33,11 @@ /** * CustomPropEnableRequestBulkEnable Class Doc Comment - * - * @category Class + * @category Class * @description Bulk Custom Property enable request - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class CustomPropEnableRequestBulkEnable implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class CustomPropEnableRequestBulkEnable implements ModelInterface, ArrayAccess, /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'CustomProp_EnableRequest_BulkEnable'; @@ -81,72 +79,50 @@ class CustomPropEnableRequestBulkEnable implements ModelInterface, ArrayAccess, ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'custom_props', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,23 +253,32 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'custom_props' ] === null ) { + 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 ( ( 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' ]; + return $this->container['custom_props']; } /** @@ -298,7 +298,7 @@ public function setCustomProps( $custom_props ) { '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; + $this->container['custom_props'] = $custom_props; return $this; } @@ -355,7 +355,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -386,15 +385,6 @@ public function __toString() { 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 3bf0b87..9fd81d2 100644 --- a/src/Client/lib/Model/CustomPropListResponse.php +++ b/src/Client/lib/Model/CustomPropListResponse.php @@ -33,12 +33,11 @@ /** * CustomPropListResponse Class Doc Comment - * - * @category Class + * @category Class * @description Custom Props list response - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class CustomPropListResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class CustomPropListResponse implements ModelInterface, ArrayAccess, \JsonSerial /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'CustomProp.ListResponse'; @@ -81,72 +79,50 @@ class CustomPropListResponse implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'custom_props' => 'setCustomProps', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'custom_props' => 'getCustomProps', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'custom_props', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'custom_props' => 'custom_props', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'custom_props', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'custom_props' ] === null ) { + if ( $this->container['custom_props'] === null) { $invalidProperties[] = "'custom_props' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets custom_props + * 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' ]; + return $this->container['custom_props']; } /** @@ -289,7 +289,7 @@ 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; + $this->container['custom_props'] = $custom_props; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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/Error.php b/src/Client/lib/Model/Error.php index c609621..d4f4327 100644 --- a/src/Client/lib/Model/Error.php +++ b/src/Client/lib/Model/Error.php @@ -33,12 +33,11 @@ /** * Error Class Doc Comment - * - * @category Class + * @category Class * @description An explanation of an error that occurred within the Plugins API - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class Error implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Error'; @@ -81,72 +79,50 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'detail' => 'setDetail', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'detail' => 'getDetail', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'detail', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'detail' => 'detail', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'detail', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'detail' ] === null ) { + if ( $this->container['detail'] === null ) { $invalidProperties[] = "'detail' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets detail + * 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' ]; + return $this->container['detail']; } /** @@ -289,7 +289,7 @@ public function setDetail( $detail ) { if ( is_null( $detail ) ) { throw new \InvalidArgumentException( 'non-nullable detail cannot be null' ); } - $this->container[ 'detail' ] = $detail; + $this->container['detail'] = $detail; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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/Funnel.php b/src/Client/lib/Model/Funnel.php index 0d9539c..3cc6ed3 100644 --- a/src/Client/lib/Model/Funnel.php +++ b/src/Client/lib/Model/Funnel.php @@ -243,7 +243,7 @@ public function getModelName() * @param mixed[] $data Associated array of property values * initializing the model */ - public function __construct(?array $data = null) + public function __construct( array $data = null ) { $this->setIfExists('funnel', $data ?? [], null); } diff --git a/src/Client/lib/Model/FunnelCreateRequest.php b/src/Client/lib/Model/FunnelCreateRequest.php index e81aee2..5143f92 100644 --- a/src/Client/lib/Model/FunnelCreateRequest.php +++ b/src/Client/lib/Model/FunnelCreateRequest.php @@ -243,7 +243,7 @@ public function getModelName() * @param mixed[] $data Associated array of property values * initializing the model */ - public function __construct( ?array $data = null ) + public function __construct( array $data = null ) { $this->setIfExists('funnel', $data ?? [], null); } diff --git a/src/Client/lib/Model/FunnelCreateRequestFunnel.php b/src/Client/lib/Model/FunnelCreateRequestFunnel.php index a96d49b..7bff8c3 100644 --- a/src/Client/lib/Model/FunnelCreateRequestFunnel.php +++ b/src/Client/lib/Model/FunnelCreateRequestFunnel.php @@ -58,7 +58,7 @@ class FunnelCreateRequestFunnel implements ModelInterface, ArrayAccess, \JsonSer */ protected static $openAPITypes = [ 'name' => 'string', - 'steps' => '\Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[]' + 'steps' => '\Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[]', ]; /** @@ -248,7 +248,7 @@ public function getModelName() * @param mixed[] $data Associated array of property values * initializing the model */ - public function __construct(?array $data = null) + public function __construct( array $data = null ) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('steps', $data ?? [], null); @@ -339,8 +339,7 @@ public function setName($name) /** * Gets steps - * - * @return \Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[] + * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] */ public function getSteps() { @@ -350,7 +349,7 @@ public function getSteps() /** * Sets steps * - * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[] $steps Funnel Steps + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] $steps Funnel Steps * * @return self */ diff --git a/src/Client/lib/Model/FunnelFunnel.php b/src/Client/lib/Model/FunnelFunnel.php index 8ffed94..4735d38 100644 --- a/src/Client/lib/Model/FunnelFunnel.php +++ b/src/Client/lib/Model/FunnelFunnel.php @@ -254,7 +254,7 @@ public function getModelName() * @param mixed[] $data Associated array of property values * initializing the model */ - public function __construct( ?array $data = null ) + public function __construct( array $data = null ) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/src/Client/lib/Model/FunnelListResponse.php b/src/Client/lib/Model/FunnelListResponse.php index bd19c8d..2b12660 100644 --- a/src/Client/lib/Model/FunnelListResponse.php +++ b/src/Client/lib/Model/FunnelListResponse.php @@ -59,7 +59,7 @@ class FunnelListResponse implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static $openAPITypes = [ 'funnels' => '\Plausible\Analytics\WP\Client\Model\Funnel[]', - 'meta' => '\Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta' + 'meta' => '\Plausible\Analytics\WP\Client\Model\GoalListResponseMeta', ]; /** @@ -249,7 +249,7 @@ public function getModelName() * @param mixed[] $data Associated array of property values * initializing the model */ - public function __construct( ?array $data = null ) + public function __construct( array $data = null ) { $this->setIfExists('funnels', $data ?? [], null); $this->setIfExists('meta', $data ?? [], null); @@ -332,8 +332,7 @@ public function setFunnels($funnels) /** * Gets meta - * - * @return \Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta + * @return \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta */ public function getMeta() { @@ -343,7 +342,7 @@ public function getMeta() /** * Sets meta * - * @param \Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta $meta meta + * @param \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta $meta meta * * @return self */ diff --git a/src/Client/lib/Model/Goal.php b/src/Client/lib/Model/Goal.php index b9d00e5..b665f14 100644 --- a/src/Client/lib/Model/Goal.php +++ b/src/Client/lib/Model/Goal.php @@ -33,12 +33,11 @@ /** * Goal Class Doc Comment - * - * @category Class + * @category Class * @description Goal object - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class Goal implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class Goal implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal'; @@ -84,79 +82,50 @@ class Goal implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - 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; + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -171,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal_type' => 'goal_type', + 'goal' => 'goal', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -209,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -218,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -226,42 +208,51 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + 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; } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -272,10 +263,10 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal_type' ] === null ) { + if ( $this->container['goal_type'] === null ) { $invalidProperties[] = "'goal_type' can't be null"; } - if ( $this->container[ 'goal' ] === null ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } @@ -283,12 +274,21 @@ public function listInvalidProperties() { } /** - * Gets goal_type + * 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' ]; + return $this->container['goal_type']; } /** @@ -302,18 +302,17 @@ 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; + $this->container['goal_type'] = $goal_type; return $this; } /** * Gets goal - * * @return \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -327,7 +326,7 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } @@ -384,7 +383,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -415,15 +413,6 @@ public function __toString() { 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/GoalCreateRequest.php b/src/Client/lib/Model/GoalCreateRequest.php index a8f8bf6..1b086be 100644 --- a/src/Client/lib/Model/GoalCreateRequest.php +++ b/src/Client/lib/Model/GoalCreateRequest.php @@ -33,22 +33,18 @@ /** * GoalCreateRequest Class Doc Comment - * - * @category Class + * @category Class * @description Goal creation params - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; - public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; - /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal.CreateRequest'; @@ -59,7 +55,7 @@ class GoalCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializabl * @var string[] */ protected static $openAPITypes = [ - 'goals' => '\Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[]', + 'goals' => '\Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[]', 'goal' => '\Plausible\Analytics\WP\Client\Model\GoalCreateRequestPageviewGoal', 'goal_type' => 'string', ]; @@ -89,80 +85,50 @@ class GoalCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goals' => 'setGoals', - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goals' => 'getGoals', - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goals', $data ?? [], null ); - $this->setIfExists( 'goal', $data ?? [], null ); - $this->setIfExists( 'goal_type', $data ?? [], 'Goal.Pageview' ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -177,31 +143,49 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goals' => 'goals', + 'goal' => 'goal', + 'goal_type' => 'goal_type', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -215,7 +199,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -224,7 +207,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -232,42 +214,61 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } + public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; + /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] + * Gets allowable values of the enum + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; + public function getGoalTypeAllowableValues() { + return [ + self::GOAL_TYPE_GOAL_PAGEVIEW, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() { - return self::$openAPIModelName; + 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' ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -278,28 +279,29 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goals' ] === null ) { + if ( $this->container['goals'] === null ) { $invalidProperties[] = "'goals' can't be null"; } - if ( ( count( $this->container[ 'goals' ] ) > 8 ) ) { + 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 ) ) { + 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 ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } - if ( $this->container[ 'goal_type' ] === 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 ) ) { + 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' ], + $this->container['goal_type'], implode( "', '", $allowedValues ) ); } @@ -308,29 +310,27 @@ public function listInvalidProperties() { } /** - * Gets allowable values of the enum - * - * @return string[] + * Validate all the properties in the model + * return true if all passed + * @return bool True if all properties are valid */ - public function getGoalTypeAllowableValues() { - return [ - self::GOAL_TYPE_GOAL_PAGEVIEW, - ]; + public function valid() { + return count( $this->listInvalidProperties() ) === 0; } /** * Gets goals * - * @return \Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[] + * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] */ public function getGoals() { - return $this->container[ 'goals' ]; + return $this->container['goals']; } /** * Sets goals * - * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[] $goals goals + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] $goals goals * * @return self */ @@ -349,18 +349,17 @@ public function setGoals( $goals ) { 'invalid length for $goals when calling GoalCreateRequest., number of items must be greater than or equal to 1.' ); } - $this->container[ 'goals' ] = $goals; + $this->container['goals'] = $goals; return $this; } /** * Gets goal - * * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestPageviewGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -374,7 +373,7 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } @@ -385,7 +384,7 @@ public function setGoal( $goal ) { * @return string */ public function getGoalType() { - return $this->container[ 'goal_type' ]; + return $this->container['goal_type']; } /** @@ -409,7 +408,7 @@ public function setGoalType( $goal_type ) { ) ); } - $this->container[ 'goal_type' ] = $goal_type; + $this->container['goal_type'] = $goal_type; return $this; } @@ -466,7 +465,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -497,15 +495,6 @@ public function __toString() { 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/GoalCreateRequestBulkGetOrCreate.php b/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreate.php index 00421f4..db8ca88 100644 --- a/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreate.php +++ b/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreate.php @@ -33,12 +33,11 @@ /** * GoalCreateRequestBulkGetOrCreate Class Doc Comment - * - * @category Class + * @category Class * @description Bulk goal creation request - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalCreateRequestBulkGetOrCreate implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class GoalCreateRequestBulkGetOrCreate implements ModelInterface, ArrayAccess, \ /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal_CreateRequest_BulkGetOrCreate'; @@ -57,7 +55,7 @@ class GoalCreateRequestBulkGetOrCreate implements ModelInterface, ArrayAccess, \ * @var string[] */ protected static $openAPITypes = [ - 'goals' => '\Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[]', + 'goals' => '\Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[]', ]; /** @@ -81,72 +79,50 @@ class GoalCreateRequestBulkGetOrCreate implements ModelInterface, ArrayAccess, \ ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goals' => 'setGoals', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goals' => 'getGoals', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goals', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goals' => 'goals', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'goals', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,33 +253,41 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goals' ] === null ) { + if ( $this->container['goals'] === null ) { $invalidProperties[] = "'goals' can't be null"; } - if ( ( count( $this->container[ 'goals' ] ) > 8 ) ) { + 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 ) ) { + 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 \Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[] + * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] */ public function getGoals() { - return $this->container[ 'goals' ]; + return $this->container['goals']; } /** * Sets goals * - * @param \Plausible\Analytics\WP\Client\Model\FunnelCreateRequestFunnelStepsInner[] $goals goals + * @param \Plausible\Analytics\WP\Client\Model\GoalCreateRequestBulkGetOrCreateGoalsInner[] $goals goals * * @return self */ @@ -307,7 +306,7 @@ public function setGoals( $goals ) { 'invalid length for $goals when calling GoalCreateRequestBulkGetOrCreate., number of items must be greater than or equal to 1.' ); } - $this->container[ 'goals' ] = $goals; + $this->container['goals'] = $goals; return $this; } @@ -364,7 +363,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -395,15 +393,6 @@ public function __toString() { 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/GoalCreateRequestBulkGetOrCreateGoalsInner.php b/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.php index 4202660..b69657d 100644 --- a/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.php +++ b/src/Client/lib/Model/GoalCreateRequestBulkGetOrCreateGoalsInner.php @@ -38,16 +38,16 @@ class GoalCreateRequestBulkGetOrCreateGoalsInner implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; - public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; - /** * 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 = [ @@ -57,6 +57,7 @@ class GoalCreateRequestBulkGetOrCreateGoalsInner implements ModelInterface, Arra /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] * @phpstan-var array * @psalm-var array @@ -68,6 +69,7 @@ class GoalCreateRequestBulkGetOrCreateGoalsInner implements ModelInterface, Arra /** * Array of nullable properties. Used for (de)serialization + * * @var boolean[] */ protected static array $openAPINullables = [ @@ -76,71 +78,50 @@ class GoalCreateRequestBulkGetOrCreateGoalsInner implements ModelInterface, Arra ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal', $data ?? [], null ); - $this->setIfExists( 'goal_type', $data ?? [], 'Goal.Pageview' ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -155,32 +136,51 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties - * @return array + * Checks if a nullable property is set to null. + * + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization - * @return array + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal' => 'goal', + 'goal_type' => 'goal_type', + ]; /** - * Array of property to format mappings. Used for (de)serialization - * @return array + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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() { @@ -204,59 +204,82 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } + public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; + /** - * Array of nullable field names deliberately set to null - * @return boolean[] + * Gets allowable values of the enum + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; + public function getGoalTypeAllowableValues() { + return [ + self::GOAL_TYPE_GOAL_PAGEVIEW, + ]; } /** - * The original name of the model. - * @return string + * Associative array for storing property values + * + * @var mixed[] */ - public function getModelName() { - return self::$openAPIModelName; + 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' ); } /** - * Validate all the properties in the model - * return true if all passed - * @return bool True if all properties are valid + * 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 */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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 ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } - if ( $this->container[ 'goal_type' ] === 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 ) ) { + 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' ], + $this->container['goal_type'], implode( "', '", $allowedValues ) ); } @@ -265,21 +288,21 @@ public function listInvalidProperties() { } /** - * Gets allowable values of the enum - * @return string[] + * Validate all the properties in the model + * return true if all passed + * @return bool True if all properties are valid */ - public function getGoalTypeAllowableValues() { - return [ - self::GOAL_TYPE_GOAL_PAGEVIEW, - ]; + public function valid() { + return count( $this->listInvalidProperties() ) === 0; } /** * Gets goal + * * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestPageviewGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -293,17 +316,18 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } /** * Gets goal_type + * * @return string */ public function getGoalType() { - return $this->container[ 'goal_type' ]; + return $this->container['goal_type']; } /** @@ -327,7 +351,7 @@ public function setGoalType( $goal_type ) { ) ); } - $this->container[ 'goal_type' ] = $goal_type; + $this->container['goal_type'] = $goal_type; return $this; } @@ -385,6 +409,7 @@ public function offsetUnset( $offset ): void { /** * 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. */ @@ -395,6 +420,7 @@ public function jsonSerialize() { /** * Gets the string presentation of the object + * * @return string */ public function __toString() { @@ -406,20 +432,12 @@ public function __toString() { /** * 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 f3e7424..aed462b 100644 --- a/src/Client/lib/Model/GoalCreateRequestCustomEvent.php +++ b/src/Client/lib/Model/GoalCreateRequestCustomEvent.php @@ -33,22 +33,18 @@ /** * GoalCreateRequestCustomEvent Class Doc Comment - * - * @category Class + * @category Class * @description Custom Event Goal creation params - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ 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'; @@ -86,76 +82,50 @@ class GoalCreateRequestCustomEvent implements ModelInterface, ArrayAccess, \Json ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal', $data ?? [], null ); - $this->setIfExists( 'goal_type', $data ?? [], 'Goal.CustomEvent' ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -170,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal' => 'goal', + 'goal_type' => 'goal_type', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -208,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -217,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -225,42 +208,60 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } + public const GOAL_TYPE_GOAL_CUSTOM_EVENT = 'Goal.CustomEvent'; + /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] + * Gets allowable values of the enum + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; + public function getGoalTypeAllowableValues() { + return [ + self::GOAL_TYPE_GOAL_CUSTOM_EVENT, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() { - return self::$openAPIModelName; + 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' ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -271,17 +272,18 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal' ] === null ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } - if ( $this->container[ 'goal_type' ] === 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 ) ) { + 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' ], + $this->container['goal_type'], implode( "', '", $allowedValues ) ); } @@ -290,14 +292,12 @@ public function listInvalidProperties() { } /** - * Gets allowable values of the enum - * - * @return string[] + * Validate all the properties in the model + * return true if all passed + * @return bool True if all properties are valid */ - public function getGoalTypeAllowableValues() { - return [ - self::GOAL_TYPE_GOAL_CUSTOM_EVENT, - ]; + public function valid() { + return count( $this->listInvalidProperties() ) === 0; } /** @@ -306,7 +306,7 @@ public function getGoalTypeAllowableValues() { * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestCustomEventGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -320,19 +320,18 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } /** * Gets goal_type - * * @return string */ - public function getGoalType() { - return $this->container[ 'goal_type' ]; - } + public function getGoalType() { + return $this->container['goal_type']; + } /** * Sets goal_type @@ -355,7 +354,7 @@ public function setGoalType( $goal_type ) { ) ); } - $this->container[ 'goal_type' ] = $goal_type; + $this->container['goal_type'] = $goal_type; return $this; } @@ -412,7 +411,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -443,15 +441,6 @@ public function __toString() { 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/GoalCreateRequestCustomEventGoal.php b/src/Client/lib/Model/GoalCreateRequestCustomEventGoal.php index 9633b33..4f31265 100644 --- a/src/Client/lib/Model/GoalCreateRequestCustomEventGoal.php +++ b/src/Client/lib/Model/GoalCreateRequestCustomEventGoal.php @@ -45,16 +45,15 @@ class GoalCreateRequestCustomEventGoal implements ModelInterface, ArrayAccess, \ /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'event_name' => 'string', ]; @@ -80,72 +79,50 @@ class GoalCreateRequestCustomEventGoal implements ModelInterface, ArrayAccess, \ ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'event_name' => 'setEventName', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'event_name' => 'getEventName', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'event_name', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -160,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'event_name' => 'event_name', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -198,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -207,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -215,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'event_name', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -261,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'event_name' ] === null ) { + if ( $this->container['event_name'] === null ) { $invalidProperties[] = "'event_name' can't be null"; } @@ -269,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets event_name + * 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' ]; + return $this->container['event_name']; } /** @@ -288,7 +289,7 @@ 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; + $this->container['event_name'] = $event_name; return $this; } @@ -345,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -376,15 +376,6 @@ public function __toString() { 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/GoalCreateRequestPageview.php b/src/Client/lib/Model/GoalCreateRequestPageview.php index aba226a..631139b 100644 --- a/src/Client/lib/Model/GoalCreateRequestPageview.php +++ b/src/Client/lib/Model/GoalCreateRequestPageview.php @@ -33,22 +33,18 @@ /** * GoalCreateRequestPageview Class Doc Comment - * - * @category Class + * @category Class * @description Pageview Goal creation params - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalCreateRequestPageview implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; - public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; - /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal.CreateRequest.Pageview'; @@ -86,76 +82,50 @@ class GoalCreateRequestPageview implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal', $data ?? [], null ); - $this->setIfExists( 'goal_type', $data ?? [], 'Goal.Pageview' ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -170,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal' => 'goal', + 'goal_type' => 'goal_type', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -208,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -217,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -225,42 +208,60 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } + public const GOAL_TYPE_GOAL_PAGEVIEW = 'Goal.Pageview'; + /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] + * Gets allowable values of the enum + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; + public function getGoalTypeAllowableValues() { + return [ + self::GOAL_TYPE_GOAL_PAGEVIEW, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() { - return self::$openAPIModelName; + 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' ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -271,17 +272,18 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal' ] === null ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } - if ( $this->container[ 'goal_type' ] === 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 ) ) { + 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' ], + $this->container['goal_type'], implode( "', '", $allowedValues ) ); } @@ -290,14 +292,12 @@ public function listInvalidProperties() { } /** - * Gets allowable values of the enum - * - * @return string[] + * Validate all the properties in the model + * return true if all passed + * @return bool True if all properties are valid */ - public function getGoalTypeAllowableValues() { - return [ - self::GOAL_TYPE_GOAL_PAGEVIEW, - ]; + public function valid() { + return count( $this->listInvalidProperties() ) === 0; } /** @@ -306,7 +306,7 @@ public function getGoalTypeAllowableValues() { * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestPageviewGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -320,19 +320,18 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } /** * Gets goal_type - * * @return string */ - public function getGoalType() { - return $this->container[ 'goal_type' ]; - } + public function getGoalType() { + return $this->container['goal_type']; + } /** * Sets goal_type @@ -355,7 +354,7 @@ public function setGoalType( $goal_type ) { ) ); } - $this->container[ 'goal_type' ] = $goal_type; + $this->container['goal_type'] = $goal_type; return $this; } @@ -412,7 +411,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -443,15 +441,6 @@ public function __toString() { 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/GoalCreateRequestPageviewGoal.php b/src/Client/lib/Model/GoalCreateRequestPageviewGoal.php index 08a15b2..194b664 100644 --- a/src/Client/lib/Model/GoalCreateRequestPageviewGoal.php +++ b/src/Client/lib/Model/GoalCreateRequestPageviewGoal.php @@ -45,16 +45,15 @@ class GoalCreateRequestPageviewGoal implements ModelInterface, ArrayAccess, \Jso /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'path' => 'string', ]; @@ -80,72 +79,50 @@ class GoalCreateRequestPageviewGoal implements ModelInterface, ArrayAccess, \Jso ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'path' => 'setPath', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'path' => 'getPath', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'path', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -160,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'path' => 'path', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -198,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -207,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -215,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'path', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -261,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'path' ] === null ) { + if ( $this->container['path'] === null ) { $invalidProperties[] = "'path' can't be null"; } @@ -269,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets path + * 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' ]; + return $this->container['path']; } /** @@ -288,7 +289,7 @@ public function setPath( $path ) { if ( is_null( $path ) ) { throw new \InvalidArgumentException( 'non-nullable path cannot be null' ); } - $this->container[ 'path' ] = $path; + $this->container['path'] = $path; return $this; } @@ -345,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -376,15 +376,6 @@ public function __toString() { 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 410cb7e..9cf60c1 100644 --- a/src/Client/lib/Model/GoalCreateRequestRevenue.php +++ b/src/Client/lib/Model/GoalCreateRequestRevenue.php @@ -33,22 +33,18 @@ /** * GoalCreateRequestRevenue Class Doc Comment - * - * @category Class + * @category Class * @description Revenue Goal creation params - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ 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'; @@ -86,76 +82,50 @@ class GoalCreateRequestRevenue implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal' => 'setGoal', - 'goal_type' => 'setGoalType', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal' => 'getGoal', - 'goal_type' => 'getGoalType', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal', $data ?? [], null ); - $this->setIfExists( 'goal_type', $data ?? [], 'Goal.Revenue' ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -170,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal' => 'goal', + 'goal_type' => 'goal_type', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -208,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -217,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -225,42 +208,60 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } + public const GOAL_TYPE_GOAL_REVENUE = 'Goal.Revenue'; + /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] + * Gets allowable values of the enum + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; + public function getGoalTypeAllowableValues() { + return [ + self::GOAL_TYPE_GOAL_REVENUE, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() { - return self::$openAPIModelName; + 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' ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -271,17 +272,18 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal' ] === null ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } - if ( $this->container[ 'goal_type' ] === 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 ) ) { + 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' ], + $this->container['goal_type'], implode( "', '", $allowedValues ) ); } @@ -290,14 +292,12 @@ public function listInvalidProperties() { } /** - * Gets allowable values of the enum - * - * @return string[] + * Validate all the properties in the model + * return true if all passed + * @return bool True if all properties are valid */ - public function getGoalTypeAllowableValues() { - return [ - self::GOAL_TYPE_GOAL_REVENUE, - ]; + public function valid() { + return count( $this->listInvalidProperties() ) === 0; } /** @@ -306,7 +306,7 @@ public function getGoalTypeAllowableValues() { * @return \Plausible\Analytics\WP\Client\Model\GoalCreateRequestRevenueGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -320,19 +320,18 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } /** * Gets goal_type - * * @return string */ - public function getGoalType() { - return $this->container[ 'goal_type' ]; - } + public function getGoalType() { + return $this->container['goal_type']; + } /** * Sets goal_type @@ -355,7 +354,7 @@ public function setGoalType( $goal_type ) { ) ); } - $this->container[ 'goal_type' ] = $goal_type; + $this->container['goal_type'] = $goal_type; return $this; } @@ -412,7 +411,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -443,15 +441,6 @@ public function __toString() { 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/GoalCreateRequestRevenueGoal.php b/src/Client/lib/Model/GoalCreateRequestRevenueGoal.php index d6ab215..68728d3 100644 --- a/src/Client/lib/Model/GoalCreateRequestRevenueGoal.php +++ b/src/Client/lib/Model/GoalCreateRequestRevenueGoal.php @@ -45,16 +45,15 @@ class GoalCreateRequestRevenueGoal implements ModelInterface, ArrayAccess, \Json /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'event_name' => 'string', @@ -83,76 +82,50 @@ class GoalCreateRequestRevenueGoal implements ModelInterface, ArrayAccess, \Json ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'currency' => 'setCurrency', - 'event_name' => 'setEventName', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'currency' => 'getCurrency', - 'event_name' => 'getEventName', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'currency', $data ?? [], null ); - $this->setIfExists( 'event_name', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -167,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'currency' => 'currency', + 'event_name' => 'event_name', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -205,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -214,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -222,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'currency', $data ?? [], null ); + $this->setIfExists( 'event_name', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -268,10 +260,10 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'currency' ] === null ) { + if ( $this->container['currency'] === null) { $invalidProperties[] = "'currency' can't be null"; } - if ( $this->container[ 'event_name' ] === null ) { + if ( $this->container['event_name'] === null ) { $invalidProperties[] = "'event_name' can't be null"; } @@ -279,12 +271,21 @@ public function listInvalidProperties() { } /** - * Gets currency + * 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' ]; + return $this->container['currency']; } /** @@ -298,18 +299,17 @@ public function setCurrency( $currency ) { if ( is_null( $currency ) ) { throw new \InvalidArgumentException( 'non-nullable currency cannot be null' ); } - $this->container[ 'currency' ] = $currency; + $this->container['currency'] = $currency; return $this; } /** * Gets event_name - * * @return string */ public function getEventName() { - return $this->container[ 'event_name' ]; + return $this->container['event_name']; } /** @@ -323,7 +323,7 @@ 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; + $this->container['event_name'] = $event_name; return $this; } @@ -380,7 +380,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -411,15 +410,6 @@ public function __toString() { 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 be3430c..d2a3276 100644 --- a/src/Client/lib/Model/GoalCustomEvent.php +++ b/src/Client/lib/Model/GoalCustomEvent.php @@ -33,12 +33,11 @@ /** * GoalCustomEvent Class Doc Comment - * - * @category Class + * @category Class * @description Custom Event Goal object - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class GoalCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal.CustomEvent'; @@ -84,76 +82,50 @@ class GoalCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal_type', $data ?? [], null ); - $this->setIfExists( 'goal', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -168,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal_type' => 'goal_type', + 'goal' => 'goal', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -206,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -215,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -223,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_type', $data ?? [], null ); + $this->setIfExists( 'goal', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -269,10 +260,10 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal_type' ] === null ) { + if ( $this->container['goal_type'] === null ) { $invalidProperties[] = "'goal_type' can't be null"; } - if ( $this->container[ 'goal' ] === null ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } @@ -280,12 +271,21 @@ public function listInvalidProperties() { } /** - * Gets goal_type + * 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' ]; + return $this->container['goal_type']; } /** @@ -299,18 +299,17 @@ 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; + $this->container['goal_type'] = $goal_type; return $this; } /** * Gets goal - * * @return \Plausible\Analytics\WP\Client\Model\GoalCustomEventAllOfGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -324,7 +323,7 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } @@ -381,7 +380,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -412,15 +410,6 @@ public function __toString() { 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/GoalCustomEventAllOfGoal.php b/src/Client/lib/Model/GoalCustomEventAllOfGoal.php index 5e61806..d9bfc4b 100644 --- a/src/Client/lib/Model/GoalCustomEventAllOfGoal.php +++ b/src/Client/lib/Model/GoalCustomEventAllOfGoal.php @@ -45,16 +45,15 @@ class GoalCustomEventAllOfGoal implements ModelInterface, ArrayAccess, \JsonSeri /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'display_name' => 'string', 'event_name' => 'string', @@ -86,80 +85,50 @@ class GoalCustomEventAllOfGoal implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'display_name' => 'setDisplayName', - 'event_name' => 'setEventName', - 'id' => 'setId', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'display_name' => 'getDisplayName', - 'event_name' => 'getEventName', - 'id' => 'getId', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'display_name', $data ?? [], null ); - $this->setIfExists( 'event_name', $data ?? [], null ); - $this->setIfExists( 'id', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -174,31 +143,49 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'display_name' => 'display_name', + 'event_name' => 'event_name', + 'id' => 'id', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -212,7 +199,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -221,7 +207,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -229,42 +214,49 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'display_name', $data ?? [], null ); + $this->setIfExists( 'event_name', $data ?? [], null ); + $this->setIfExists( 'id', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -275,13 +267,13 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'display_name' ] === null ) { + if ( $this->container['display_name'] === null ) { $invalidProperties[] = "'display_name' can't be null"; } - if ( $this->container[ 'event_name' ] === null ) { + if ( $this->container['event_name'] === null ) { $invalidProperties[] = "'event_name' can't be null"; } - if ( $this->container[ 'id' ] === null ) { + if ( $this->container['id'] === null ) { $invalidProperties[] = "'id' can't be null"; } @@ -289,12 +281,21 @@ public function listInvalidProperties() { } /** - * Gets display_name + * 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' ]; + return $this->container['display_name']; } /** @@ -308,18 +309,17 @@ 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; + $this->container['display_name'] = $display_name; return $this; } /** * Gets event_name - * * @return string */ public function getEventName() { - return $this->container[ 'event_name' ]; + return $this->container['event_name']; } /** @@ -333,7 +333,7 @@ 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; + $this->container['event_name'] = $event_name; return $this; } @@ -344,7 +344,7 @@ public function setEventName( $event_name ) { * @return int */ public function getId() { - return $this->container[ 'id' ]; + return $this->container['id']; } /** @@ -358,7 +358,7 @@ public function setId( $id ) { if ( is_null( $id ) ) { throw new \InvalidArgumentException( 'non-nullable id cannot be null' ); } - $this->container[ 'id' ] = $id; + $this->container['id'] = $id; return $this; } @@ -415,7 +415,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -446,15 +445,6 @@ public function __toString() { 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 d50f344..2f9bb5d 100644 --- a/src/Client/lib/Model/GoalDeleteBulkRequest.php +++ b/src/Client/lib/Model/GoalDeleteBulkRequest.php @@ -33,12 +33,11 @@ /** * GoalDeleteBulkRequest Class Doc Comment - * - * @category Class + * @category Class * @description Goal deletion params - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalDeleteBulkRequest implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class GoalDeleteBulkRequest implements ModelInterface, ArrayAccess, \JsonSeriali /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal.DeleteBulkRequest'; @@ -81,72 +79,50 @@ class GoalDeleteBulkRequest implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal_ids' => 'setGoalIds', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal_ids' => 'getGoalIds', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal_ids', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal_ids' => 'goal_ids', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_ids', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,27 +253,35 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal_ids' ] === null ) { + if ( $this->container['goal_ids'] === null ) { $invalidProperties[] = "'goal_ids' can't be null"; } - if ( ( count( $this->container[ 'goal_ids' ] ) > 8 ) ) { + 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 ) ) { + 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' ]; + return $this->container['goal_ids']; } /** @@ -307,7 +306,7 @@ public function setGoalIds( $goal_ids ) { '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; + $this->container['goal_ids'] = $goal_ids; return $this; } @@ -364,7 +363,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -395,15 +393,6 @@ public function __toString() { 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/GoalListResponse.php b/src/Client/lib/Model/GoalListResponse.php index b813fde..8038624 100644 --- a/src/Client/lib/Model/GoalListResponse.php +++ b/src/Client/lib/Model/GoalListResponse.php @@ -33,12 +33,11 @@ /** * GoalListResponse Class Doc Comment - * - * @category Class + * @category Class * @description Goals list response - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalListResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class GoalListResponse implements ModelInterface, ArrayAccess, \JsonSerializable /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal.ListResponse'; @@ -58,7 +56,7 @@ class GoalListResponse implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'goals' => '\Plausible\Analytics\WP\Client\Model\Goal[]', - 'meta' => '\Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta', + 'meta' => '\Plausible\Analytics\WP\Client\Model\GoalListResponseMeta', ]; /** @@ -84,76 +82,50 @@ class GoalListResponse implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goals' => 'setGoals', - 'meta' => 'setMeta', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goals' => 'getGoals', - 'meta' => 'getMeta', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goals', $data ?? [], null ); - $this->setIfExists( 'meta', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -168,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goals' => 'goals', + 'meta' => 'meta', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -206,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -215,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -223,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'goals', $data ?? [], null ); + $this->setIfExists( 'meta', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -269,10 +260,10 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goals' ] === null ) { + if ( $this->container['goals'] === null ) { $invalidProperties[] = "'goals' can't be null"; } - if ( $this->container[ 'meta' ] === null ) { + if ( $this->container['meta'] === null ) { $invalidProperties[] = "'meta' can't be null"; } @@ -280,12 +271,21 @@ public function listInvalidProperties() { } /** - * Gets goals + * 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 \Plausible\Analytics\WP\Client\Model\Goal[] */ public function getGoals() { - return $this->container[ 'goals' ]; + return $this->container['goals']; } /** @@ -299,24 +299,23 @@ public function setGoals( $goals ) { if ( is_null( $goals ) ) { throw new \InvalidArgumentException( 'non-nullable goals cannot be null' ); } - $this->container[ 'goals' ] = $goals; + $this->container['goals'] = $goals; return $this; } /** * Gets meta - * - * @return \Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta + * @return \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta */ public function getMeta() { - return $this->container[ 'meta' ]; + return $this->container['meta']; } /** * Sets meta * - * @param \Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta $meta meta + * @param \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta $meta meta * * @return self */ @@ -324,7 +323,7 @@ public function setMeta( $meta ) { if ( is_null( $meta ) ) { throw new \InvalidArgumentException( 'non-nullable meta cannot be null' ); } - $this->container[ 'meta' ] = $meta; + $this->container['meta'] = $meta; return $this; } @@ -381,7 +380,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -412,15 +410,6 @@ public function __toString() { 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 e1ad60b..b7d1b3b 100644 --- a/src/Client/lib/Model/GoalListResponseMeta.php +++ b/src/Client/lib/Model/GoalListResponseMeta.php @@ -40,12 +40,14 @@ class GoalListResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializ /** * 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 = [ @@ -54,6 +56,7 @@ class GoalListResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] * @phpstan-var array * @psalm-var array @@ -64,6 +67,7 @@ class GoalListResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of nullable properties. Used for (de)serialization + * * @var boolean[] */ protected static array $openAPINullables = [ @@ -71,67 +75,50 @@ class GoalListResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'pagination' => 'setPagination', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'pagination' => 'getPagination', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'pagination', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -146,32 +133,48 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties - * @return array + * Checks if a nullable property is set to null. + * + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization - * @return array + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'pagination' => 'pagination', + ]; /** - * Array of property to format mappings. Used for (de)serialization - * @return array + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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() { @@ -195,61 +198,80 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null - * @return boolean[] + * Associative array for storing property values + * + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. - * @return string + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'pagination', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed - * @return bool True if all properties are valid + * 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 */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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 ) { + 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' ]; + return $this->container['pagination']; } /** @@ -263,7 +285,7 @@ public function setPagination( $pagination ) { if ( is_null( $pagination ) ) { throw new \InvalidArgumentException( 'non-nullable pagination cannot be null' ); } - $this->container[ 'pagination' ] = $pagination; + $this->container['pagination'] = $pagination; return $this; } @@ -321,6 +343,7 @@ public function offsetUnset( $offset ): void { /** * 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. */ @@ -331,6 +354,7 @@ public function jsonSerialize() { /** * Gets the string presentation of the object + * * @return string */ public function __toString() { @@ -342,20 +366,12 @@ public function __toString() { /** * 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 932a168..076cde5 100644 --- a/src/Client/lib/Model/GoalPageview.php +++ b/src/Client/lib/Model/GoalPageview.php @@ -33,12 +33,11 @@ /** * GoalPageview Class Doc Comment - * - * @category Class + * @category Class * @description Pageview Goal object - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalPageview implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class GoalPageview implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal.Pageview'; @@ -84,76 +82,50 @@ class GoalPageview implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal_type', $data ?? [], null ); - $this->setIfExists( 'goal', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -168,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal_type' => 'goal_type', + 'goal' => 'goal', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -206,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -215,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -223,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_type', $data ?? [], null ); + $this->setIfExists( 'goal', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -269,10 +260,10 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal_type' ] === null ) { + if ( $this->container['goal_type'] === null ) { $invalidProperties[] = "'goal_type' can't be null"; } - if ( $this->container[ 'goal' ] === null ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } @@ -280,12 +271,21 @@ public function listInvalidProperties() { } /** - * Gets goal_type + * 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' ]; + return $this->container['goal_type']; } /** @@ -299,18 +299,17 @@ 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; + $this->container['goal_type'] = $goal_type; return $this; } /** * Gets goal - * * @return \Plausible\Analytics\WP\Client\Model\GoalPageviewAllOfGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -324,7 +323,7 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } @@ -381,7 +380,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -412,15 +410,6 @@ public function __toString() { 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/GoalPageviewAllOfGoal.php b/src/Client/lib/Model/GoalPageviewAllOfGoal.php index 78fd692..ffb3379 100644 --- a/src/Client/lib/Model/GoalPageviewAllOfGoal.php +++ b/src/Client/lib/Model/GoalPageviewAllOfGoal.php @@ -45,16 +45,15 @@ class GoalPageviewAllOfGoal implements ModelInterface, ArrayAccess, \JsonSeriali /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'display_name' => 'string', 'id' => 'int', @@ -86,80 +85,50 @@ class GoalPageviewAllOfGoal implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'display_name' => 'setDisplayName', - 'id' => 'setId', - 'path' => 'setPath', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'display_name' => 'getDisplayName', - 'id' => 'getId', - 'path' => 'getPath', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'display_name', $data ?? [], null ); - $this->setIfExists( 'id', $data ?? [], null ); - $this->setIfExists( 'path', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -174,31 +143,49 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'display_name' => 'display_name', + 'id' => 'id', + 'path' => 'path', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -212,7 +199,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -221,7 +207,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -229,42 +214,49 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'display_name', $data ?? [], null ); + $this->setIfExists( 'id', $data ?? [], null ); + $this->setIfExists( 'path', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -275,13 +267,13 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'display_name' ] === null ) { + if ( $this->container['display_name'] === null ) { $invalidProperties[] = "'display_name' can't be null"; } - if ( $this->container[ 'id' ] === null ) { + if ( $this->container['id'] === null ) { $invalidProperties[] = "'id' can't be null"; } - if ( $this->container[ 'path' ] === null ) { + if ( $this->container['path'] === null ) { $invalidProperties[] = "'path' can't be null"; } @@ -289,12 +281,21 @@ public function listInvalidProperties() { } /** - * Gets display_name + * 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' ]; + return $this->container['display_name']; } /** @@ -308,19 +309,18 @@ 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; + $this->container['display_name'] = $display_name; return $this; } /** * Gets id - * * @return int */ - public function getId() { - return $this->container[ 'id' ]; - } + public function getId() { + return $this->container['id']; + } /** * Sets id @@ -333,7 +333,7 @@ public function setId( $id ) { if ( is_null( $id ) ) { throw new \InvalidArgumentException( 'non-nullable id cannot be null' ); } - $this->container[ 'id' ] = $id; + $this->container['id'] = $id; return $this; } @@ -344,7 +344,7 @@ public function setId( $id ) { * @return string */ public function getPath() { - return $this->container[ 'path' ]; + return $this->container['path']; } /** @@ -358,7 +358,7 @@ public function setPath( $path ) { if ( is_null( $path ) ) { throw new \InvalidArgumentException( 'non-nullable path cannot be null' ); } - $this->container[ 'path' ] = $path; + $this->container['path'] = $path; return $this; } @@ -415,7 +415,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -446,15 +445,6 @@ public function __toString() { 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/GoalRevenue.php b/src/Client/lib/Model/GoalRevenue.php index 44b2ab9..8188d3c 100644 --- a/src/Client/lib/Model/GoalRevenue.php +++ b/src/Client/lib/Model/GoalRevenue.php @@ -33,12 +33,11 @@ /** * GoalRevenue Class Doc Comment - * - * @category Class + * @category Class * @description Revenue Goal object - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalRevenue implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class GoalRevenue implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal.Revenue'; @@ -84,76 +82,50 @@ class GoalRevenue implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - 'goal' => 'setGoal', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - 'goal' => 'getGoal', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal_type', $data ?? [], null ); - $this->setIfExists( 'goal', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -168,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal_type' => 'goal_type', + 'goal' => 'goal', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -206,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -215,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -223,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_type', $data ?? [], null ); + $this->setIfExists( 'goal', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -269,10 +260,10 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal_type' ] === null ) { + if ( $this->container['goal_type'] === null ) { $invalidProperties[] = "'goal_type' can't be null"; } - if ( $this->container[ 'goal' ] === null ) { + if ( $this->container['goal'] === null ) { $invalidProperties[] = "'goal' can't be null"; } @@ -280,12 +271,21 @@ public function listInvalidProperties() { } /** - * Gets goal_type + * 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' ]; + return $this->container['goal_type']; } /** @@ -299,18 +299,17 @@ 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; + $this->container['goal_type'] = $goal_type; return $this; } /** * Gets goal - * * @return \Plausible\Analytics\WP\Client\Model\GoalRevenueAllOfGoal */ public function getGoal() { - return $this->container[ 'goal' ]; + return $this->container['goal']; } /** @@ -324,7 +323,7 @@ public function setGoal( $goal ) { if ( is_null( $goal ) ) { throw new \InvalidArgumentException( 'non-nullable goal cannot be null' ); } - $this->container[ 'goal' ] = $goal; + $this->container['goal'] = $goal; return $this; } @@ -381,7 +380,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -412,15 +410,6 @@ public function __toString() { 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 604da7a..ad39687 100644 --- a/src/Client/lib/Model/GoalRevenueAllOfGoal.php +++ b/src/Client/lib/Model/GoalRevenueAllOfGoal.php @@ -45,16 +45,15 @@ class GoalRevenueAllOfGoal implements ModelInterface, ArrayAccess, \JsonSerializ /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'display_name' => 'string', @@ -89,84 +88,50 @@ class GoalRevenueAllOfGoal implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'currency' => 'setCurrency', - 'display_name' => 'setDisplayName', - 'event_name' => 'setEventName', - 'id' => 'setId', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'currency' => 'getCurrency', - 'display_name' => 'getDisplayName', - 'event_name' => 'getEventName', - 'id' => 'getId', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - 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 ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -181,31 +146,52 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'currency' => 'currency', + 'display_name' => 'display_name', + 'event_name' => 'event_name', + 'id' => 'id', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -219,7 +205,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -228,7 +213,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -236,42 +220,50 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + 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 ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -282,16 +274,16 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'currency' ] === null ) { + if ( $this->container['currency'] === null) { $invalidProperties[] = "'currency' can't be null"; } - if ( $this->container[ 'display_name' ] === null ) { + if ( $this->container['display_name'] === null ) { $invalidProperties[] = "'display_name' can't be null"; } - if ( $this->container[ 'event_name' ] === null ) { + if ( $this->container['event_name'] === null ) { $invalidProperties[] = "'event_name' can't be null"; } - if ( $this->container[ 'id' ] === null ) { + if ( $this->container['id'] === null ) { $invalidProperties[] = "'id' can't be null"; } @@ -299,12 +291,21 @@ public function listInvalidProperties() { } /** - * Gets currency + * 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' ]; + return $this->container['currency']; } /** @@ -318,18 +319,17 @@ public function setCurrency( $currency ) { if ( is_null( $currency ) ) { throw new \InvalidArgumentException( 'non-nullable currency cannot be null' ); } - $this->container[ 'currency' ] = $currency; + $this->container['currency'] = $currency; return $this; } /** * Gets display_name - * * @return string */ public function getDisplayName() { - return $this->container[ 'display_name' ]; + return $this->container['display_name']; } /** @@ -343,18 +343,17 @@ 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; + $this->container['display_name'] = $display_name; return $this; } /** * Gets event_name - * * @return string */ public function getEventName() { - return $this->container[ 'event_name' ]; + return $this->container['event_name']; } /** @@ -368,7 +367,7 @@ 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; + $this->container['event_name'] = $event_name; return $this; } @@ -379,7 +378,7 @@ public function setEventName( $event_name ) { * @return int */ public function getId() { - return $this->container[ 'id' ]; + return $this->container['id']; } /** @@ -393,7 +392,7 @@ public function setId( $id ) { if ( is_null( $id ) ) { throw new \InvalidArgumentException( 'non-nullable id cannot be null' ); } - $this->container[ 'id' ] = $id; + $this->container['id'] = $id; return $this; } @@ -450,7 +449,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -481,15 +479,6 @@ public function __toString() { 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/GoalType.php b/src/Client/lib/Model/GoalType.php index 77bb806..d41f445 100644 --- a/src/Client/lib/Model/GoalType.php +++ b/src/Client/lib/Model/GoalType.php @@ -33,12 +33,11 @@ /** * GoalType Class Doc Comment - * - * @category Class + * @category Class * @description Properties common to all Goals - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class GoalType implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class GoalType implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Goal.Type'; @@ -81,72 +79,50 @@ class GoalType implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'goal_type' => 'setGoalType', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'goal_type' => 'getGoalType', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'goal_type', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'goal_type' => 'goal_type', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'goal_type', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'goal_type' ] === null ) { + if ( $this->container['goal_type'] === null ) { $invalidProperties[] = "'goal_type' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets goal_type + * 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' ]; + return $this->container['goal_type']; } /** @@ -289,7 +289,7 @@ 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; + $this->container['goal_type'] = $goal_type; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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/Link.php b/src/Client/lib/Model/Link.php index 3272c66..5741209 100644 --- a/src/Client/lib/Model/Link.php +++ b/src/Client/lib/Model/Link.php @@ -45,16 +45,15 @@ class Link implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'Link'; - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'url' => 'string', ]; @@ -80,72 +79,50 @@ class Link implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'url' => 'setUrl', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'url' => 'getUrl', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'url', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -160,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'url' => 'url', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -198,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -207,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -215,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'url', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -261,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'url' ] === null ) { + if ( $this->container['url'] === null ) { $invalidProperties[] = "'url' can't be null"; } @@ -269,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets url + * 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' ]; + return $this->container['url']; } /** @@ -288,7 +289,7 @@ public function setUrl( $url ) { if ( is_null( $url ) ) { throw new \InvalidArgumentException( 'non-nullable url cannot be null' ); } - $this->container[ 'url' ] = $url; + $this->container['url'] = $url; return $this; } @@ -345,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -376,15 +376,6 @@ public function __toString() { 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/ModelInterface.php b/src/Client/lib/Model/ModelInterface.php index ffe8fb9..00ff694 100644 --- a/src/Client/lib/Model/ModelInterface.php +++ b/src/Client/lib/Model/ModelInterface.php @@ -36,17 +36,22 @@ */ interface ModelInterface { /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array + * The original name of the model. + * @return string */ - public static function openAPITypes(); + public function getModelName(); /** - * Array of property to format mappings. Used for (de)serialization - * + * Array of property to type mappings. Used for (de)serialization * @return array */ + public static function openAPITypes(); + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ public static function openAPIFormats(); /** @@ -70,22 +75,6 @@ public static function setters(); */ public static function getters(); - /** - * Checks if a property is nullable - * - * @param string $property - * - * @return bool - */ - public static function isNullable( string $property ): bool; - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName(); - /** * Show all the invalid properties with reasons. * @@ -101,6 +90,14 @@ public function listInvalidProperties(); */ public function valid(); + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable( string $property ): bool; + /** * Checks if a nullable property is set to null. * diff --git a/src/Client/lib/Model/NotFoundError.php b/src/Client/lib/Model/NotFoundError.php index b59521e..7b36da8 100644 --- a/src/Client/lib/Model/NotFoundError.php +++ b/src/Client/lib/Model/NotFoundError.php @@ -33,12 +33,11 @@ /** * NotFoundError Class Doc Comment - * - * @category Class + * @category Class * @description The response that is returned when the user makes a request to a non-existing resource - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class NotFoundError implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class NotFoundError implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'NotFoundError'; @@ -81,72 +79,50 @@ class NotFoundError implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'errors' => 'setErrors', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'errors' => 'getErrors', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'errors', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'errors' => 'errors', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'errors', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'errors' ] === null ) { + if ( $this->container['errors'] === null ) { $invalidProperties[] = "'errors' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets errors + * 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 \Plausible\Analytics\WP\Client\Model\Error[] */ public function getErrors() { - return $this->container[ 'errors' ]; + return $this->container['errors']; } /** @@ -289,7 +289,7 @@ public function setErrors( $errors ) { if ( is_null( $errors ) ) { throw new \InvalidArgumentException( 'non-nullable errors cannot be null' ); } - $this->container[ 'errors' ] = $errors; + $this->container['errors'] = $errors; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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 21e1c71..34006ff 100644 --- a/src/Client/lib/Model/PaginationMetadata.php +++ b/src/Client/lib/Model/PaginationMetadata.php @@ -33,12 +33,11 @@ /** * PaginationMetadata Class Doc Comment - * - * @category Class + * @category Class * @description Pagination meta data - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class PaginationMetadata implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class PaginationMetadata implements ModelInterface, ArrayAccess, \JsonSerializab /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'PaginationMetadata'; @@ -83,84 +81,54 @@ class PaginationMetadata implements ModelInterface, ArrayAccess, \JsonSerializab protected static array $openAPINullables = [ 'has_next_page' => false, 'has_prev_page' => false, - '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', + 'links' => false, ]; /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'has_next_page' => 'setHasNextPage', - 'has_prev_page' => 'setHasPrevPage', - 'links' => 'setLinks', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'has_next_page' => 'getHasNextPage', - 'has_prev_page' => 'getHasPrevPage', - 'links' => 'getLinks', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - 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 ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -175,31 +143,49 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'has_next_page' => 'has_next_page', + 'has_prev_page' => 'has_prev_page', + 'links' => 'links', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -213,7 +199,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -222,7 +207,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -230,42 +214,49 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + 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 ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -276,10 +267,10 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'has_next_page' ] === null ) { + if ( $this->container['has_next_page'] === null ) { $invalidProperties[] = "'has_next_page' can't be null"; } - if ( $this->container[ 'has_prev_page' ] === null ) { + if ( $this->container['has_prev_page'] === null ) { $invalidProperties[] = "'has_prev_page' can't be null"; } @@ -287,12 +278,21 @@ public function listInvalidProperties() { } /** - * Gets has_next_page + * 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' ]; + return $this->container['has_next_page']; } /** @@ -306,18 +306,17 @@ 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; + $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' ]; + return $this->container['has_prev_page']; } /** @@ -331,18 +330,17 @@ 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; + $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' ]; + return $this->container['links']; } /** @@ -356,7 +354,7 @@ public function setLinks( $links ) { if ( is_null( $links ) ) { throw new \InvalidArgumentException( 'non-nullable links cannot be null' ); } - $this->container[ 'links' ] = $links; + $this->container['links'] = $links; return $this; } @@ -413,7 +411,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -444,15 +441,6 @@ public function __toString() { 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/PaginationMetadataLinks.php b/src/Client/lib/Model/PaginationMetadataLinks.php index 8049456..85564f9 100644 --- a/src/Client/lib/Model/PaginationMetadataLinks.php +++ b/src/Client/lib/Model/PaginationMetadataLinks.php @@ -45,16 +45,15 @@ class PaginationMetadataLinks implements ModelInterface, ArrayAccess, \JsonSeria /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'next' => '\Plausible\Analytics\WP\Client\Model\Link', 'prev' => '\Plausible\Analytics\WP\Client\Model\Link', @@ -83,76 +82,50 @@ class PaginationMetadataLinks implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'next' => 'setNext', - 'prev' => 'setPrev', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'next' => 'getNext', - 'prev' => 'getPrev', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'next', $data ?? [], null ); - $this->setIfExists( 'prev', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -167,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'next' => 'next', + 'prev' => 'prev', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -205,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -214,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -222,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'next', $data ?? [], null ); + $this->setIfExists( 'prev', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -271,13 +263,22 @@ public function listInvalidProperties() { 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 \Plausible\Analytics\WP\Client\Model\Link|null */ public function getNext() { - return $this->container[ 'next' ]; + return $this->container['next']; } /** @@ -291,18 +292,17 @@ public function setNext( $next ) { if ( is_null( $next ) ) { throw new \InvalidArgumentException( 'non-nullable next cannot be null' ); } - $this->container[ 'next' ] = $next; + $this->container['next'] = $next; return $this; } /** * Gets prev - * * @return \Plausible\Analytics\WP\Client\Model\Link|null */ public function getPrev() { - return $this->container[ 'prev' ]; + return $this->container['prev']; } /** @@ -316,7 +316,7 @@ public function setPrev( $prev ) { if ( is_null( $prev ) ) { throw new \InvalidArgumentException( 'non-nullable prev cannot be null' ); } - $this->container[ 'prev' ] = $prev; + $this->container['prev'] = $prev; return $this; } @@ -373,7 +373,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -404,15 +403,6 @@ public function __toString() { 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/PaymentRequiredError.php b/src/Client/lib/Model/PaymentRequiredError.php index e850a9f..328c067 100644 --- a/src/Client/lib/Model/PaymentRequiredError.php +++ b/src/Client/lib/Model/PaymentRequiredError.php @@ -33,12 +33,11 @@ /** * PaymentRequiredError Class Doc Comment - * - * @category Class + * @category Class * @description The response that is returned when the user makes a request that cannot be processed due to their subscription limitations. - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class PaymentRequiredError implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class PaymentRequiredError implements ModelInterface, ArrayAccess, \JsonSerializ /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'PaymentRequiredError'; @@ -81,72 +79,50 @@ class PaymentRequiredError implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'errors' => 'setErrors', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'errors' => 'getErrors', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'errors', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'errors' => 'errors', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'errors', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'errors' ] === null ) { + if ( $this->container['errors'] === null ) { $invalidProperties[] = "'errors' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets errors + * 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 \Plausible\Analytics\WP\Client\Model\Error[] */ public function getErrors() { - return $this->container[ 'errors' ]; + return $this->container['errors']; } /** @@ -289,7 +289,7 @@ public function setErrors( $errors ) { if ( is_null( $errors ) ) { throw new \InvalidArgumentException( 'non-nullable errors cannot be null' ); } - $this->container[ 'errors' ] = $errors; + $this->container['errors'] = $errors; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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/SharedLink.php b/src/Client/lib/Model/SharedLink.php index 8f9f1c2..9ba12a0 100644 --- a/src/Client/lib/Model/SharedLink.php +++ b/src/Client/lib/Model/SharedLink.php @@ -33,12 +33,11 @@ /** * SharedLink Class Doc Comment - * - * @category Class + * @category Class * @description Shared Link object - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class SharedLink implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class SharedLink implements ModelInterface, ArrayAccess, \JsonSerializable { /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'SharedLink'; @@ -81,72 +79,50 @@ class SharedLink implements ModelInterface, ArrayAccess, \JsonSerializable { ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'shared_link' => 'setSharedLink', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'shared_link' => 'getSharedLink', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'shared_link', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'shared_link' => 'shared_link', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'shared_link', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'shared_link' ] === null ) { + if ( $this->container['shared_link'] === null) { $invalidProperties[] = "'shared_link' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets shared_link + * 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\SharedLinkSharedLink */ public function getSharedLink() { - return $this->container[ 'shared_link' ]; + return $this->container['shared_link']; } /** @@ -289,7 +289,7 @@ 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; + $this->container['shared_link'] = $shared_link; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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 b888a76..ad5bd19 100644 --- a/src/Client/lib/Model/SharedLinkCreateRequest.php +++ b/src/Client/lib/Model/SharedLinkCreateRequest.php @@ -33,12 +33,11 @@ /** * SharedLinkCreateRequest Class Doc Comment - * - * @category Class + * @category Class * @description Shared Links creation params - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class SharedLinkCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class SharedLinkCreateRequest implements ModelInterface, ArrayAccess, \JsonSeria /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'SharedLink.CreateRequest'; @@ -81,72 +79,50 @@ class SharedLinkCreateRequest implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'shared_link' => 'setSharedLink', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'shared_link' => 'getSharedLink', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'shared_link', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'shared_link' => 'shared_link', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'shared_link', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'shared_link' ] === null ) { + if ( $this->container['shared_link'] === null) { $invalidProperties[] = "'shared_link' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets shared_link + * 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' ]; + return $this->container['shared_link']; } /** @@ -289,7 +289,7 @@ 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; + $this->container['shared_link'] = $shared_link; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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 8ee1a35..72808b9 100644 --- a/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php +++ b/src/Client/lib/Model/SharedLinkCreateRequestSharedLink.php @@ -45,16 +45,15 @@ class SharedLinkCreateRequestSharedLink implements ModelInterface, ArrayAccess, /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'password' => 'string', @@ -83,76 +82,50 @@ class SharedLinkCreateRequestSharedLink implements ModelInterface, ArrayAccess, ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'name' => 'setName', - 'password' => 'setPassword', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'name' => 'getName', - 'password' => 'getPassword', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'name', $data ?? [], null ); - $this->setIfExists( 'password', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -167,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'name' => 'name', + 'password' => 'password', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -205,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -214,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -222,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'name', $data ?? [], null ); + $this->setIfExists( 'password', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -268,7 +260,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'name' ] === null ) { + if ( $this->container['name'] === null ) { $invalidProperties[] = "'name' can't be null"; } @@ -276,12 +268,21 @@ public function listInvalidProperties() { } /** - * Gets name + * 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' ]; + return $this->container['name']; } /** @@ -295,18 +296,17 @@ public function setName( $name ) { if ( is_null( $name ) ) { throw new \InvalidArgumentException( 'non-nullable name cannot be null' ); } - $this->container[ 'name' ] = $name; + $this->container['name'] = $name; return $this; } /** * Gets password - * * @return string|null */ public function getPassword() { - return $this->container[ 'password' ]; + return $this->container['password']; } /** @@ -320,7 +320,7 @@ public function setPassword( $password ) { if ( is_null( $password ) ) { throw new \InvalidArgumentException( 'non-nullable password cannot be null' ); } - $this->container[ 'password' ] = $password; + $this->container['password'] = $password; return $this; } @@ -377,7 +377,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -408,15 +407,6 @@ public function __toString() { 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 70b974e..2839a9f 100644 --- a/src/Client/lib/Model/SharedLinkListResponse.php +++ b/src/Client/lib/Model/SharedLinkListResponse.php @@ -33,12 +33,11 @@ /** * SharedLinkListResponse Class Doc Comment - * - * @category Class + * @category Class * @description Shared Links list response - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class SharedLinkListResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class SharedLinkListResponse implements ModelInterface, ArrayAccess, \JsonSerial /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'SharedLink.ListResponse'; @@ -57,7 +55,7 @@ class SharedLinkListResponse implements ModelInterface, ArrayAccess, \JsonSerial * @var string[] */ protected static $openAPITypes = [ - 'meta' => '\Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta', + 'meta' => '\Plausible\Analytics\WP\Client\Model\GoalListResponseMeta', 'shared_links' => '\Plausible\Analytics\WP\Client\Model\SharedLink[]', ]; @@ -84,76 +82,50 @@ class SharedLinkListResponse implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'meta' => 'setMeta', - 'shared_links' => 'setSharedLinks', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'meta' => 'getMeta', - 'shared_links' => 'getSharedLinks', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'meta', $data ?? [], null ); - $this->setIfExists( 'shared_links', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -168,31 +140,46 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'meta' => 'meta', + 'shared_links' => 'shared_links', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -206,7 +193,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -215,7 +201,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -223,42 +208,48 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'meta', $data ?? [], null ); + $this->setIfExists( 'shared_links', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -269,10 +260,10 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'meta' ] === null ) { + if ( $this->container['meta'] === null ) { $invalidProperties[] = "'meta' can't be null"; } - if ( $this->container[ 'shared_links' ] === null ) { + if ( $this->container['shared_links'] === null ) { $invalidProperties[] = "'shared_links' can't be null"; } @@ -280,18 +271,27 @@ public function listInvalidProperties() { } /** - * Gets meta + * Validate all the properties in the model + * return true if all passed * - * @return \Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta + * @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' ]; + return $this->container['meta']; } /** * Sets meta * - * @param \Plausible\Analytics\WP\Client\Model\FunnelListResponseMeta $meta meta + * @param \Plausible\Analytics\WP\Client\Model\GoalListResponseMeta $meta meta * * @return self */ @@ -299,18 +299,17 @@ public function setMeta( $meta ) { if ( is_null( $meta ) ) { throw new \InvalidArgumentException( 'non-nullable meta cannot be null' ); } - $this->container[ 'meta' ] = $meta; + $this->container['meta'] = $meta; return $this; } /** * Gets shared_links - * * @return \Plausible\Analytics\WP\Client\Model\SharedLink[] */ public function getSharedLinks() { - return $this->container[ 'shared_links' ]; + return $this->container['shared_links']; } /** @@ -324,7 +323,7 @@ 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; + $this->container['shared_links'] = $shared_links; return $this; } @@ -381,7 +380,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -412,15 +410,6 @@ public function __toString() { 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/SharedLinkSharedLink.php b/src/Client/lib/Model/SharedLinkSharedLink.php index 1d2c8cb..0672cf1 100644 --- a/src/Client/lib/Model/SharedLinkSharedLink.php +++ b/src/Client/lib/Model/SharedLinkSharedLink.php @@ -45,16 +45,15 @@ class SharedLinkSharedLink implements ModelInterface, ArrayAccess, \JsonSerializ /** * 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[] - */ + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'href' => 'string', 'id' => 'int', @@ -89,84 +88,50 @@ class SharedLinkSharedLink implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'href' => 'setHref', - 'id' => 'setId', - 'name' => 'setName', - 'password_protected' => 'setPasswordProtected', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'href' => 'getHref', - 'id' => 'getId', - 'name' => 'getName', - 'password_protected' => 'getPasswordProtected', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - 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 ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -181,31 +146,52 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'href' => 'href', + 'id' => 'id', + 'name' => 'name', + 'password_protected' => 'password_protected', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -219,7 +205,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -228,7 +213,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -236,42 +220,50 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + 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 ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -282,16 +274,16 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'href' ] === null ) { + if ( $this->container['href'] === null ) { $invalidProperties[] = "'href' can't be null"; } - if ( $this->container[ 'id' ] === null ) { + if ( $this->container['id'] === null ) { $invalidProperties[] = "'id' can't be null"; } - if ( $this->container[ 'name' ] === null ) { + if ( $this->container['name'] === null ) { $invalidProperties[] = "'name' can't be null"; } - if ( $this->container[ 'password_protected' ] === null ) { + if ( $this->container['password_protected'] === null ) { $invalidProperties[] = "'password_protected' can't be null"; } @@ -299,12 +291,21 @@ public function listInvalidProperties() { } /** - * Gets href + * 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' ]; + return $this->container['href']; } /** @@ -318,19 +319,18 @@ public function setHref( $href ) { if ( is_null( $href ) ) { throw new \InvalidArgumentException( 'non-nullable href cannot be null' ); } - $this->container[ 'href' ] = $href; + $this->container['href'] = $href; return $this; } /** * Gets id - * * @return int */ - public function getId() { - return $this->container[ 'id' ]; - } + public function getId() { + return $this->container['id']; + } /** * Sets id @@ -343,7 +343,7 @@ public function setId( $id ) { if ( is_null( $id ) ) { throw new \InvalidArgumentException( 'non-nullable id cannot be null' ); } - $this->container[ 'id' ] = $id; + $this->container['id'] = $id; return $this; } @@ -354,7 +354,7 @@ public function setId( $id ) { * @return string */ public function getName() { - return $this->container[ 'name' ]; + return $this->container['name']; } /** @@ -368,18 +368,17 @@ public function setName( $name ) { if ( is_null( $name ) ) { throw new \InvalidArgumentException( 'non-nullable name cannot be null' ); } - $this->container[ 'name' ] = $name; + $this->container['name'] = $name; return $this; } /** * Gets password_protected - * * @return bool - */ + */ public function getPasswordProtected() { - return $this->container[ 'password_protected' ]; + return $this->container['password_protected']; } /** @@ -393,7 +392,7 @@ 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; + $this->container['password_protected'] = $password_protected; return $this; } @@ -450,7 +449,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -481,15 +479,6 @@ public function __toString() { 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/TrackerScriptConfiguration.php b/src/Client/lib/Model/TrackerScriptConfiguration.php new file mode 100644 index 0000000..75a697d --- /dev/null +++ b/src/Client/lib/Model/TrackerScriptConfiguration.php @@ -0,0 +1,413 @@ + + */ +class TrackerScriptConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TrackerScriptConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'tracker_script_configuration' => '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationTrackerScriptConfiguration' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'tracker_script_configuration' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'tracker_script_configuration' => 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 = [ + 'tracker_script_configuration' => 'tracker_script_configuration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'tracker_script_configuration' => 'setTrackerScriptConfiguration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'tracker_script_configuration' => 'getTrackerScriptConfiguration' + ]; + + /** + * 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('tracker_script_configuration', $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['tracker_script_configuration'] === null) { + $invalidProperties[] = "'tracker_script_configuration' 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 tracker_script_configuration + * + * @return \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationTrackerScriptConfiguration + */ + public function getTrackerScriptConfiguration() + { + return $this->container['tracker_script_configuration']; + } + + /** + * Sets tracker_script_configuration + * + * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationTrackerScriptConfiguration $tracker_script_configuration tracker_script_configuration + * + * @return self + */ + public function setTrackerScriptConfiguration($tracker_script_configuration) + { + if (is_null($tracker_script_configuration)) { + throw new \InvalidArgumentException('non-nullable tracker_script_configuration cannot be null'); + } + $this->container['tracker_script_configuration'] = $tracker_script_configuration; + + 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/TrackerScriptConfigurationTrackerScriptConfiguration.php b/src/Client/lib/Model/TrackerScriptConfigurationTrackerScriptConfiguration.php new file mode 100644 index 0000000..4e78c52 --- /dev/null +++ b/src/Client/lib/Model/TrackerScriptConfigurationTrackerScriptConfiguration.php @@ -0,0 +1,635 @@ + + */ +class TrackerScriptConfigurationTrackerScriptConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TrackerScriptConfiguration_tracker_script_configuration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'file_downloads' => 'bool', + 'form_submissions' => 'bool', + 'hash_based_routing' => 'bool', + 'id' => 'string', + 'installation_type' => 'string', + 'outbound_links' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'file_downloads' => null, + 'form_submissions' => null, + 'hash_based_routing' => null, + 'id' => null, + 'installation_type' => null, + 'outbound_links' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'file_downloads' => false, + 'form_submissions' => false, + 'hash_based_routing' => false, + 'id' => false, + 'installation_type' => false, + 'outbound_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 = [ + 'file_downloads' => 'file_downloads', + 'form_submissions' => 'form_submissions', + 'hash_based_routing' => 'hash_based_routing', + 'id' => 'id', + 'installation_type' => 'installation_type', + 'outbound_links' => 'outbound_links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'file_downloads' => 'setFileDownloads', + 'form_submissions' => 'setFormSubmissions', + 'hash_based_routing' => 'setHashBasedRouting', + 'id' => 'setId', + 'installation_type' => 'setInstallationType', + 'outbound_links' => 'setOutboundLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'file_downloads' => 'getFileDownloads', + 'form_submissions' => 'getFormSubmissions', + 'hash_based_routing' => 'getHashBasedRouting', + 'id' => 'getId', + 'installation_type' => 'getInstallationType', + 'outbound_links' => 'getOutboundLinks' + ]; + + /** + * 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 INSTALLATION_TYPE_MANUAL = 'manual'; + public const INSTALLATION_TYPE_WORDPRESS = 'wordpress'; + public const INSTALLATION_TYPE_GTM = 'gtm'; + public const INSTALLATION_TYPE_NPM = 'npm'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInstallationTypeAllowableValues() + { + return [ + self::INSTALLATION_TYPE_MANUAL, + self::INSTALLATION_TYPE_WORDPRESS, + self::INSTALLATION_TYPE_GTM, + self::INSTALLATION_TYPE_NPM, + ]; + } + + /** + * 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('file_downloads', $data ?? [], null); + $this->setIfExists('form_submissions', $data ?? [], null); + $this->setIfExists('hash_based_routing', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('installation_type', $data ?? [], null); + $this->setIfExists('outbound_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['file_downloads'] === null) { + $invalidProperties[] = "'file_downloads' can't be null"; + } + if ($this->container['form_submissions'] === null) { + $invalidProperties[] = "'form_submissions' can't be null"; + } + if ($this->container['hash_based_routing'] === null) { + $invalidProperties[] = "'hash_based_routing' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['installation_type'] === null) { + $invalidProperties[] = "'installation_type' can't be null"; + } + $allowedValues = $this->getInstallationTypeAllowableValues(); + if (!is_null($this->container['installation_type']) && !in_array($this->container['installation_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'installation_type', must be one of '%s'", + $this->container['installation_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['outbound_links'] === null) { + $invalidProperties[] = "'outbound_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 file_downloads + * + * @return bool + */ + public function getFileDownloads() + { + return $this->container['file_downloads']; + } + + /** + * Sets file_downloads + * + * @param bool $file_downloads Track File Downloads + * + * @return self + */ + public function setFileDownloads($file_downloads) + { + if (is_null($file_downloads)) { + throw new \InvalidArgumentException('non-nullable file_downloads cannot be null'); + } + $this->container['file_downloads'] = $file_downloads; + + return $this; + } + + /** + * Gets form_submissions + * + * @return bool + */ + public function getFormSubmissions() + { + return $this->container['form_submissions']; + } + + /** + * Sets form_submissions + * + * @param bool $form_submissions Track Form Submissions + * + * @return self + */ + public function setFormSubmissions($form_submissions) + { + if (is_null($form_submissions)) { + throw new \InvalidArgumentException('non-nullable form_submissions cannot be null'); + } + $this->container['form_submissions'] = $form_submissions; + + return $this; + } + + /** + * Gets hash_based_routing + * + * @return bool + */ + public function getHashBasedRouting() + { + return $this->container['hash_based_routing']; + } + + /** + * Sets hash_based_routing + * + * @param bool $hash_based_routing Hash Based Routing + * + * @return self + */ + public function setHashBasedRouting($hash_based_routing) + { + if (is_null($hash_based_routing)) { + throw new \InvalidArgumentException('non-nullable hash_based_routing cannot be null'); + } + $this->container['hash_based_routing'] = $hash_based_routing; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Tracker Script Configuration 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 installation_type + * + * @return string + */ + public function getInstallationType() + { + return $this->container['installation_type']; + } + + /** + * Sets installation_type + * + * @param string $installation_type Tracker Script Installation Type + * + * @return self + */ + public function setInstallationType($installation_type) + { + if (is_null($installation_type)) { + throw new \InvalidArgumentException('non-nullable installation_type cannot be null'); + } + $allowedValues = $this->getInstallationTypeAllowableValues(); + if (!in_array($installation_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'installation_type', must be one of '%s'", + $installation_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['installation_type'] = $installation_type; + + return $this; + } + + /** + * Gets outbound_links + * + * @return bool + */ + public function getOutboundLinks() + { + return $this->container['outbound_links']; + } + + /** + * Sets outbound_links + * + * @param bool $outbound_links Track Outbound Links + * + * @return self + */ + public function setOutboundLinks($outbound_links) + { + if (is_null($outbound_links)) { + throw new \InvalidArgumentException('non-nullable outbound_links cannot be null'); + } + $this->container['outbound_links'] = $outbound_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/lib/Model/TrackerScriptConfigurationUpdateRequest.php b/src/Client/lib/Model/TrackerScriptConfigurationUpdateRequest.php new file mode 100644 index 0000000..317846c --- /dev/null +++ b/src/Client/lib/Model/TrackerScriptConfigurationUpdateRequest.php @@ -0,0 +1,413 @@ + + */ +class TrackerScriptConfigurationUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TrackerScriptConfiguration.UpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'tracker_script_configuration' => '\Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'tracker_script_configuration' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'tracker_script_configuration' => 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 = [ + 'tracker_script_configuration' => 'tracker_script_configuration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'tracker_script_configuration' => 'setTrackerScriptConfiguration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'tracker_script_configuration' => 'getTrackerScriptConfiguration' + ]; + + /** + * 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('tracker_script_configuration', $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['tracker_script_configuration'] === null) { + $invalidProperties[] = "'tracker_script_configuration' 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 tracker_script_configuration + * + * @return \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration + */ + public function getTrackerScriptConfiguration() + { + return $this->container['tracker_script_configuration']; + } + + /** + * Sets tracker_script_configuration + * + * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration $tracker_script_configuration tracker_script_configuration + * + * @return self + */ + public function setTrackerScriptConfiguration($tracker_script_configuration) + { + if (is_null($tracker_script_configuration)) { + throw new \InvalidArgumentException('non-nullable tracker_script_configuration cannot be null'); + } + $this->container['tracker_script_configuration'] = $tracker_script_configuration; + + 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/TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration.php b/src/Client/lib/Model/TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration.php new file mode 100644 index 0000000..8fe1363 --- /dev/null +++ b/src/Client/lib/Model/TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration.php @@ -0,0 +1,586 @@ + + */ +class TrackerScriptConfigurationUpdateRequestTrackerScriptConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TrackerScriptConfiguration_UpdateRequest_tracker_script_configuration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'file_downloads' => 'bool', + 'form_submissions' => 'bool', + 'hash_based_routing' => 'bool', + 'installation_type' => 'string', + 'outbound_links' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'file_downloads' => null, + 'form_submissions' => null, + 'hash_based_routing' => null, + 'installation_type' => null, + 'outbound_links' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'file_downloads' => false, + 'form_submissions' => false, + 'hash_based_routing' => false, + 'installation_type' => false, + 'outbound_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 = [ + 'file_downloads' => 'file_downloads', + 'form_submissions' => 'form_submissions', + 'hash_based_routing' => 'hash_based_routing', + 'installation_type' => 'installation_type', + 'outbound_links' => 'outbound_links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'file_downloads' => 'setFileDownloads', + 'form_submissions' => 'setFormSubmissions', + 'hash_based_routing' => 'setHashBasedRouting', + 'installation_type' => 'setInstallationType', + 'outbound_links' => 'setOutboundLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'file_downloads' => 'getFileDownloads', + 'form_submissions' => 'getFormSubmissions', + 'hash_based_routing' => 'getHashBasedRouting', + 'installation_type' => 'getInstallationType', + 'outbound_links' => 'getOutboundLinks' + ]; + + /** + * 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 INSTALLATION_TYPE_MANUAL = 'manual'; + public const INSTALLATION_TYPE_WORDPRESS = 'wordpress'; + public const INSTALLATION_TYPE_GTM = 'gtm'; + public const INSTALLATION_TYPE_NPM = 'npm'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInstallationTypeAllowableValues() + { + return [ + self::INSTALLATION_TYPE_MANUAL, + self::INSTALLATION_TYPE_WORDPRESS, + self::INSTALLATION_TYPE_GTM, + self::INSTALLATION_TYPE_NPM, + ]; + } + + /** + * 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('file_downloads', $data ?? [], null); + $this->setIfExists('form_submissions', $data ?? [], null); + $this->setIfExists('hash_based_routing', $data ?? [], null); + $this->setIfExists('installation_type', $data ?? [], null); + $this->setIfExists('outbound_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['installation_type'] === null) { + $invalidProperties[] = "'installation_type' can't be null"; + } + $allowedValues = $this->getInstallationTypeAllowableValues(); + if (!is_null($this->container['installation_type']) && !in_array($this->container['installation_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'installation_type', must be one of '%s'", + $this->container['installation_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 file_downloads + * + * @return bool|null + */ + public function getFileDownloads() + { + return $this->container['file_downloads']; + } + + /** + * Sets file_downloads + * + * @param bool|null $file_downloads Track File Downloads + * + * @return self + */ + public function setFileDownloads($file_downloads) + { + if (is_null($file_downloads)) { + throw new \InvalidArgumentException('non-nullable file_downloads cannot be null'); + } + $this->container['file_downloads'] = $file_downloads; + + return $this; + } + + /** + * Gets form_submissions + * + * @return bool|null + */ + public function getFormSubmissions() + { + return $this->container['form_submissions']; + } + + /** + * Sets form_submissions + * + * @param bool|null $form_submissions Track Form Submissions + * + * @return self + */ + public function setFormSubmissions($form_submissions) + { + if (is_null($form_submissions)) { + throw new \InvalidArgumentException('non-nullable form_submissions cannot be null'); + } + $this->container['form_submissions'] = $form_submissions; + + return $this; + } + + /** + * Gets hash_based_routing + * + * @return bool|null + */ + public function getHashBasedRouting() + { + return $this->container['hash_based_routing']; + } + + /** + * Sets hash_based_routing + * + * @param bool|null $hash_based_routing Hash Based Routing + * + * @return self + */ + public function setHashBasedRouting($hash_based_routing) + { + if (is_null($hash_based_routing)) { + throw new \InvalidArgumentException('non-nullable hash_based_routing cannot be null'); + } + $this->container['hash_based_routing'] = $hash_based_routing; + + return $this; + } + + /** + * Gets installation_type + * + * @return string + */ + public function getInstallationType() + { + return $this->container['installation_type']; + } + + /** + * Sets installation_type + * + * @param string $installation_type Tracker Script Installation Type + * + * @return self + */ + public function setInstallationType($installation_type) + { + if (is_null($installation_type)) { + throw new \InvalidArgumentException('non-nullable installation_type cannot be null'); + } + $allowedValues = $this->getInstallationTypeAllowableValues(); + if (!in_array($installation_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'installation_type', must be one of '%s'", + $installation_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['installation_type'] = $installation_type; + + return $this; + } + + /** + * Gets outbound_links + * + * @return bool|null + */ + public function getOutboundLinks() + { + return $this->container['outbound_links']; + } + + /** + * Sets outbound_links + * + * @param bool|null $outbound_links Track Outbound Links + * + * @return self + */ + public function setOutboundLinks($outbound_links) + { + if (is_null($outbound_links)) { + throw new \InvalidArgumentException('non-nullable outbound_links cannot be null'); + } + $this->container['outbound_links'] = $outbound_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/lib/Model/UnauthorizedError.php b/src/Client/lib/Model/UnauthorizedError.php index 751b3fd..04f29b2 100644 --- a/src/Client/lib/Model/UnauthorizedError.php +++ b/src/Client/lib/Model/UnauthorizedError.php @@ -33,12 +33,11 @@ /** * UnauthorizedError Class Doc Comment - * - * @category Class + * @category Class * @description The response that is returned when the user makes an unauthorized request. - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class UnauthorizedError implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class UnauthorizedError implements ModelInterface, ArrayAccess, \JsonSerializabl /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'UnauthorizedError'; @@ -81,72 +79,50 @@ class UnauthorizedError implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'errors' => 'setErrors', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'errors' => 'getErrors', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'errors', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'errors' => 'errors', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'errors', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'errors' ] === null ) { + if ( $this->container['errors'] === null ) { $invalidProperties[] = "'errors' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets errors + * 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 \Plausible\Analytics\WP\Client\Model\Error[] */ public function getErrors() { - return $this->container[ 'errors' ]; + return $this->container['errors']; } /** @@ -289,7 +289,7 @@ public function setErrors( $errors ) { if ( is_null( $errors ) ) { throw new \InvalidArgumentException( 'non-nullable errors cannot be null' ); } - $this->container[ 'errors' ] = $errors; + $this->container['errors'] = $errors; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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/UnprocessableEntityError.php b/src/Client/lib/Model/UnprocessableEntityError.php index 642809d..04c8259 100644 --- a/src/Client/lib/Model/UnprocessableEntityError.php +++ b/src/Client/lib/Model/UnprocessableEntityError.php @@ -33,12 +33,11 @@ /** * UnprocessableEntityError Class Doc Comment - * - * @category Class + * @category Class * @description The response that is returned when the user makes a request that cannot be processed. - * @package Plausible\Analytics\WP\Client - * @author OpenAPI Generator team - * @link https://openapi-generator.tech + * @package Plausible\Analytics\WP\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech * @implements \ArrayAccess */ class UnprocessableEntityError implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -46,7 +45,6 @@ class UnprocessableEntityError implements ModelInterface, ArrayAccess, \JsonSeri /** * The original name of the model. - * * @var string */ protected static $openAPIModelName = 'UnprocessableEntityError'; @@ -81,72 +79,50 @@ class UnprocessableEntityError implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * 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[] + * If a nullable field gets set to null, insert it here + * @var boolean[] */ - protected static $setters = [ - 'errors' => 'setErrors', - ]; + protected array $openAPINullablesSetToNull = []; /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] + * Array of property to type mappings. Used for (de)serialization + * @return array */ - protected static $getters = [ - 'errors' => 'getErrors', - ]; + public static function openAPITypes() { + return self::$openAPITypes; + } /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] + * Array of property to format mappings. Used for (de)serialization + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() { + return self::$openAPIFormats; + } /** - * Associative array for storing property values - * - * @var mixed[] + * Array of nullable properties + * @return array */ - protected $container = []; + protected static function openAPINullables(): array { + return self::$openAPINullables; + } /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model + * Array of nullable field names deliberately set to null + * @return boolean[] */ - public function __construct( ?array $data = null ) { - $this->setIfExists( 'errors', $data ?? [], null ); + private function getOpenAPINullablesSetToNull(): array { + return $this->openAPINullablesSetToNull; } /** - * 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 + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - 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; + private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** @@ -161,31 +137,43 @@ public static function isNullable( string $property ): bool { } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * + * @return bool */ - protected static function openAPINullables(): array { - return self::$openAPINullables; + public function isNullableSetToNull( string $property ): bool { + return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'errors' => 'errors', + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() { - return self::$openAPIFormats; - } + 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, @@ -199,7 +187,6 @@ public static function attributeMap() { /** * Array of attributes to setter functions (for deserialization of responses) - * * @return array */ public static function setters() { @@ -208,7 +195,6 @@ public static function setters() { /** * Array of attributes to getter functions (for serialization of requests) - * * @return array */ public static function getters() { @@ -216,42 +202,47 @@ public static function getters() { } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool + * The original name of the model. + * @return string */ - public function isNullableSetToNull( string $property ): bool { - return in_array( $property, $this->getOpenAPINullablesSetToNull(), true ); + public function getModelName() { + return self::$openAPIModelName; } /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return boolean[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getModelName() { - return self::$openAPIModelName; + public function __construct( array $data = null ) { + $this->setIfExists( 'errors', $data ?? [], null ); } /** - * Validate all the properties in the model - * return true if all passed + * 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 * - * @return bool True if all properties are valid + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue */ - public function valid() { - return count( $this->listInvalidProperties() ) === 0; + 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; } /** @@ -262,7 +253,7 @@ public function valid() { public function listInvalidProperties() { $invalidProperties = []; - if ( $this->container[ 'errors' ] === null ) { + if ( $this->container['errors'] === null ) { $invalidProperties[] = "'errors' can't be null"; } @@ -270,12 +261,21 @@ public function listInvalidProperties() { } /** - * Gets errors + * 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 \Plausible\Analytics\WP\Client\Model\Error[] */ public function getErrors() { - return $this->container[ 'errors' ]; + return $this->container['errors']; } /** @@ -289,7 +289,7 @@ public function setErrors( $errors ) { if ( is_null( $errors ) ) { throw new \InvalidArgumentException( 'non-nullable errors cannot be null' ); } - $this->container[ 'errors' ] = $errors; + $this->container['errors'] = $errors; return $this; } @@ -346,7 +346,6 @@ public function offsetUnset( $offset ): void { /** * 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 @@ -377,15 +376,6 @@ public function __toString() { 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 667117b..4b6ed42 100644 --- a/src/Client/lib/ObjectSerializer.php +++ b/src/Client/lib/ObjectSerializer.php @@ -1,9 +1,7 @@ isNullableSetToNull( $property ) ) || $value !== null ) { - $values[ $data::attributeMap()[ $property ] ] = self::sanitizeForSerialization( $value, $openAPIType, $formats[ $property ] ); + if ( ( $data::isNullable( $property ) && $data->isNullableSetToNull( $property ) ) || + $value !== null ) { + $values[ $data::attributeMap()[ $property ] ] = + self::sanitizeForSerialization( $value, $openAPIType, $formats[ $property ] ); } } } else { @@ -131,6 +132,37 @@ public static function sanitizeForSerialization( $data, $type = null, $format = } } + /** + * 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. @@ -144,22 +176,44 @@ public static function toPathValue( $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". + * Checks if a value is empty, based on its OpenAPI type. * - * @param string|bool|\DateTime $value the value of the parameter + * @param mixed $value + * @param string $openApiType * - * @return string the header string + * @return bool true if $value is empty */ - 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; + 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; } } @@ -246,60 +300,74 @@ public static function toQueryValue( } /** - * Checks if a value is empty, based on its OpenAPI type. + * Convert boolean value to format for query string. * - * @param mixed $value - * @param string $openApiType + * @param bool $value Boolean value * - * @return bool true if $value is empty + * @return int|string Boolean value in format */ - 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; + public static function convertBoolToQueryStringFormat( bool $value ) { + if ( Configuration::BOOLEAN_FORMAT_STRING == + Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() ) { + return $value ? 'true' : 'false'; } - 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; + return (int) $value; + } - case 'number': - case 'float': - return $value !== 0 && $value !== 0.0; + /** + * 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(); + } - # For boolean values, '' is considered empty - case 'bool': - case 'boolean': - return ! in_array( $value, [ false, 0 ], true ); + return self::toString( $value ); + } - # For all the other types, any value at this point can be considered empty. - default: - return true; + /** + * 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 ); } } /** - * Convert boolean value to format for query string. + * 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 bool $value Boolean value + * @param string|bool|\DateTime $value the value of the parameter * - * @return int|string Boolean value in format + * @return string the header string */ - public static function convertBoolToQueryStringFormat( bool $value ) { - if ( Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() ) { + 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; } - - return (int) $value; } /** @@ -338,41 +406,6 @@ public static function serializeCollection( array $collection, $style, $allowCol } } - /** - * 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 ); - } - } - /** * Deserialize a JSON string into an object * @@ -411,7 +444,7 @@ public static function deserialize( $data, $class, $httpHeaders = null ) { $deserialized = []; if ( strrpos( $inner, "," ) !== false ) { $subClass_array = explode( ',', $inner, 2 ); - $subClass = $subClass_array[ 1 ]; + $subClass = $subClass_array[1]; foreach ( $data as $key => $value ) { $deserialized[ $key ] = self::deserialize( $value, $subClass, null ); } @@ -457,11 +490,15 @@ public static function deserialize( $data, $class, $httpHeaders = null ) { /** @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 ) ) { + 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 ] ); + Configuration::getDefaultConfiguration()->getTempFolderPath() . + DIRECTORY_SEPARATOR . + self::sanitizeFilename( $match[1] ); } else { $filename = tempnam( Configuration::getDefaultConfiguration()->getTempFolderPath(), '' ); } @@ -517,7 +554,9 @@ public static function deserialize( $data, $class, $httpHeaders = null ) { // 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} ) ) { + if ( ! empty( $discriminator ) && + isset( $data->{$discriminator} ) && + is_string( $data->{$discriminator} ) ) { $subclass = '\Plausible\Analytics\WP\Client\Model\\' . $data->{$discriminator}; if ( is_subclass_of( $subclass, $class ) ) { $class = $subclass; @@ -551,46 +590,16 @@ public static function deserialize( $data, $class, $httpHeaders = null ) { } } - /** - * 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 ); - } - - /** - * 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; - } - } - /** * 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 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 From 8406aa7c84172b0f13aa083517fb0ea86352659c Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:47:15 +0100 Subject: [PATCH 04/32] Added: get_tracker_id() to Client. --- src/Actions.php | 4 ++-- src/Client.php | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/Actions.php b/src/Actions.php index 54a4040..e88b43b 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -106,9 +106,9 @@ public function maybe_register_assets() { apply_filters( 'plausible_load_js_in_footer', false ) ); - $id = $this->client->get_config_id(); + $id = $this->client->get_tracker_id(); $script = sprintf( - 'window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},window.plausible.init=function(i){window.plausible.o=i||{}};var script=document.createElement("script");script.type="text/javascript",script.defer=!0,script.src="";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(script,r);', + 'window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},window.plausible.init=function(i){window.plausible.o=i||{}};var script=document.createElement("script");script.type="text/javascript",script.defer=!0,script.src="https://plausible.io/js/%s.js";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(script,r);', $id ); $script .= "\nplausible.init();"; diff --git a/src/Client.php b/src/Client.php index f7e64d4..8101794 100644 --- a/src/Client.php +++ b/src/Client.php @@ -86,9 +86,27 @@ public function is_api_token_valid() { return isset( $valid_tokens[ $token ] ) && $valid_tokens[ $token ] === true; } - public function get_config_id() { + /** + * Retrieve the configured Tracker ID. + * + * @return string + */ + public function get_tracker_id() { + $tracker_configuration = $this->get_configuration(); + + return $tracker_configuration->getId(); + } + + /** + * Retrieve the configured Tracker Script Configuration. + * + * @return false|Client\Model\TrackerScriptConfigurationTrackerScriptConfiguration + */ + private function get_configuration() { try { - return ''; + $configuration = $this->api_instance->plausibleWebPluginsAPIControllersTrackerScriptConfigurationGet(); + + return $configuration->getTrackerScriptConfiguration(); } catch ( \Exception $e ) { return false; } From 0bbae819f83fd5136582897cba9829bdb83d879b Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:05:23 +0100 Subject: [PATCH 05/32] Fixed regeneration errors in API client. --- src/Client/lib/Api/DefaultApi.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Client/lib/Api/DefaultApi.php b/src/Client/lib/Api/DefaultApi.php index 5fbdf4d..d40519f 100644 --- a/src/Client/lib/Api/DefaultApi.php +++ b/src/Client/lib/Api/DefaultApi.php @@ -344,7 +344,7 @@ public function customPropDisableBulkRequest( 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( + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $custom_prop_disable_request ) ); } else { @@ -699,7 +699,7 @@ public function customPropGetOrEnableRequest( 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( + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $custom_prop_enable_request ) ); } else { @@ -1050,7 +1050,7 @@ public function funnelGetOrCreateRequest( if ( isset( $funnel_create_request ) ) { if ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode( + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $funnel_create_request ) ); } else { @@ -1274,7 +1274,7 @@ public function goalDeleteBulkRequest( 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( + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $goal_delete_bulk_request ) ); } else { @@ -3918,7 +3918,7 @@ 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 = \GuzzleHttp\Utils::jsonEncode( + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $shared_link_create_request ) ); } else { @@ -5325,7 +5325,7 @@ public function plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdat if ( isset( $tracker_script_configuration_update_request ) ) { if ( stripos( $headers['Content-Type'], 'application/json' ) !== false ) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode( + $httpBody = \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $tracker_script_configuration_update_request ) ); } else { From d19b6900086ddfda4e4af24b7b79fd7ae5033055 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:28:27 +0100 Subject: [PATCH 06/32] Refactored Client wrapper to use new endpoints in API client. --- src/Client.php | 6 +++--- src/Client/lib/Api/DefaultApi.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Client.php b/src/Client.php index 8101794..4e54e33 100644 --- a/src/Client.php +++ b/src/Client.php @@ -296,7 +296,7 @@ private function send_json_error( $e, $error_message ) { */ public function create_goals( $goals ) { try { - return $this->api_instance->plausibleWebPluginsAPIControllersGoalsCreate( $goals ); + return $this->api_instance->goalGetOrCreate( $goals ); } catch ( Exception $e ) { $this->send_json_error( $e, __( 'Something went wrong while creating Custom Event Goal: %s', 'plausible-analytics' ) ); } @@ -313,7 +313,7 @@ public function create_goals( $goals ) { */ public function create_funnel( $funnel ) { try { - return $this->api_instance->plausibleWebPluginsAPIControllersFunnelsCreate( $funnel ); + return $this->api_instance->funnelGetOrCreate( $funnel ); } catch ( Exception $e ) { $this->send_json_error( $e, __( 'Something went wrong while creating Funnel: %s', 'plausible-analytics' ) ); } @@ -351,7 +351,7 @@ public function delete_goal( $id ) { */ public function enable_custom_property( $enable_request ) { try { - $this->api_instance->plausibleWebPluginsAPIControllersCustomPropsEnable( $enable_request ); + $this->api_instance->customPropGetOrEnable( $enable_request ); } catch ( Exception $e ) { $this->send_json_error( $e, diff --git a/src/Client/lib/Api/DefaultApi.php b/src/Client/lib/Api/DefaultApi.php index d40519f..6061ee5 100644 --- a/src/Client/lib/Api/DefaultApi.php +++ b/src/Client/lib/Api/DefaultApi.php @@ -1630,7 +1630,7 @@ public function goalGetOrCreateRequest( 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 ) ); + \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $goal_create_request ) ); } else { $httpBody = $goal_create_request; } From cf2f1367d583823cb668bf8633263b6d906b5376 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:19:08 +0100 Subject: [PATCH 07/32] Improved: store tracker ID in options table. --- src/Client.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Client.php b/src/Client.php index 4e54e33..c38b543 100644 --- a/src/Client.php +++ b/src/Client.php @@ -87,14 +87,21 @@ public function is_api_token_valid() { } /** - * Retrieve the configured Tracker ID. + * Retrieve the configured Tracker ID and stores it in the options table. * * @return string */ public function get_tracker_id() { - $tracker_configuration = $this->get_configuration(); + $id = get_option( 'plausible_analytics_tracker_id' ); - return $tracker_configuration->getId(); + if ( ! $id ) { + $tracker_configuration = $this->get_configuration(); + $id = $tracker_configuration->getId(); + + update_option( 'plausible_analytics_tracker_id', $id ); + } + + return $id; } /** From fda6f956506dd22d2ea6822b22a53cf8a9686809 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:20:43 +0100 Subject: [PATCH 08/32] Improved: file_alias as a proxy resource is no longer needed. Improved: refactored get_filename Helper to get the Tracked ID. --- src/Actions.php | 6 ++--- src/Admin/Module.php | 2 +- src/Admin/Settings/Page.php | 4 +-- src/Helpers.php | 52 +++++++------------------------------ 4 files changed, 14 insertions(+), 50 deletions(-) diff --git a/src/Actions.php b/src/Actions.php index e88b43b..b383d19 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -106,10 +106,10 @@ public function maybe_register_assets() { apply_filters( 'plausible_load_js_in_footer', false ) ); - $id = $this->client->get_tracker_id(); + $url = Helpers::get_js_url(); $script = sprintf( - 'window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},window.plausible.init=function(i){window.plausible.o=i||{}};var script=document.createElement("script");script.type="text/javascript",script.defer=!0,script.src="https://plausible.io/js/%s.js";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(script,r);', - $id + 'window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},window.plausible.init=function(i){window.plausible.o=i||{}};var script=document.createElement("script");script.type="text/javascript",script.defer=!0,script.src="%s";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(script,r);', + $url ); $script .= "\nplausible.init();"; diff --git a/src/Admin/Module.php b/src/Admin/Module.php index 68b7d8d..9d15f29 100644 --- a/src/Admin/Module.php +++ b/src/Admin/Module.php @@ -135,7 +135,7 @@ public function uninstall() { * Clean up generated JS files in /uploads dir. */ $cache_dir = Helpers::get_proxy_resource( 'cache_dir' ); - $js_file = Helpers::get_proxy_resource( 'file_alias' ); + $js_file = Helpers::get_filename(); if ( file_exists( $cache_dir . $js_file . '.js' ) ) { unlink( $cache_dir . $js_file . '.js' ); // @codeCoverageIgnore diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 6a612ee..02c7409 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -302,9 +302,7 @@ public function __construct() { ) ? 'a random directory/file for storing the JS file' : 'a JS file, called ' . str_replace( ABSPATH, '', - Helpers::get_proxy_resource( 'cache_dir' ) . Helpers::get_proxy_resource( - 'file_alias' - ) . '.js' + Helpers::get_proxy_resource( 'cache_dir' ) . Helpers::get_filename() . '.js' ), 'https://plausible.io/wordpress-analytics-plugin#how-to-enable-a-proxy-to-get-more-accurate-stats' ), diff --git a/src/Helpers.php b/src/Helpers.php index 0980125..94e0691 100644 --- a/src/Helpers.php +++ b/src/Helpers.php @@ -18,18 +18,16 @@ class Helpers { * * @since 1.0.0 * - * @param bool $local Return the Local JS file IF proxy is enabled. - * * @return string * @throws Exception */ - public static function get_js_url( $local = false ) { - $file_name = self::get_filename( $local ); + public static function get_js_url() { + $file_name = self::get_filename(); /** * If Avoid ad blockers is enabled, return URL to local file. */ - if ( $local && self::proxy_enabled() ) { + if ( self::proxy_enabled() ) { return esc_url( self::get_proxy_resource( 'cache_url' ) . $file_name . '.js' ); } @@ -43,42 +41,11 @@ public static function get_js_url( $local = false ) { * @return string * @throws Exception */ - public static function get_filename( $local = false ) { - $settings = self::get_settings(); - $file_name = 'plausible'; - - if ( $local && self::proxy_enabled() ) { - return self::get_proxy_resource( 'file_alias' ); - } - - foreach ( [ 'outbound-links', 'file-downloads', 'tagged-events', 'revenue', 'pageview-props', 'compat', 'hash' ] as $extension ) { - if ( self::is_enhanced_measurement_enabled( $extension ) ) { - $file_name .= '.' . $extension; - } - } - - /** - * Custom Events needs to be enabled, if Revenue Tracking is enabled and any of the available integrations are available. - */ - if ( ! self::is_enhanced_measurement_enabled( 'tagged-events' ) && self::is_enhanced_measurement_enabled( 'revenue' ) && ( Integrations::is_wc_active() || Integrations::is_edd_active() ) ) { - $file_name .= '.tagged-events'; - } - - if ( ! self::is_enhanced_measurement_enabled( 'pageview-props' ) && self::is_enhanced_measurement_enabled( 'search' ) ) { - $file_name .= '.pageview-props'; // @codeCoverageIgnore - } - - // Load exclusions.js if any excluded pages are set. - if ( ! empty( $settings[ 'excluded_pages' ] ) ) { - $file_name .= '.exclusions'; - } - - // Add the manual scripts as we need it to track the search parameter. - if ( is_search() && self::is_enhanced_measurement_enabled( 'search' ) ) { - $file_name .= '.manual'; // @codeCoverageIgnore - } + public static function get_filename() { + $client = new ClientFactory(); + $client = $client->build(); - return $file_name; + return $client->get_tracker_id(); } /** @@ -188,7 +155,6 @@ public static function get_proxy_resources() { 'endpoint' => bin2hex( random_bytes( 4 ) ), 'cache_dir' => trailingslashit( $upload_dir[ 'basedir' ] ) . trailingslashit( $cache_dir ), 'cache_url' => trailingslashit( $upload_dir[ 'baseurl' ] ) . trailingslashit( $cache_dir ), - 'file_alias' => bin2hex( random_bytes( 4 ) ), ]; update_option( 'plausible_analytics_proxy_resources', $resources ); @@ -201,7 +167,7 @@ public static function get_proxy_resources() { * Check if a certain Enhanced Measurement is enabled. * * @param string $name Name of the option to check, valid values are - * 404|outbound-links|file-downloads|tagged-events|revenue|pageview-props|hash|compat. + * 404|outbound-links|file-downloads|tagged-events|revenue|pageview-props|hash. * @param array $enhanced_measurements Allows checking against a different set of options. * * @return bool @@ -260,7 +226,7 @@ public static function update_setting( $option_name, $option_value ) { * @throws Exception */ public static function get_js_path() { - return self::get_proxy_resource( 'cache_dir' ) . self::get_filename( true ) . '.js'; + return self::get_proxy_resource( 'cache_dir' ) . self::get_filename() . '.js'; } /** From 4712b50692ff290cdcbe5f862478ece9785e95d5 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:22:05 +0100 Subject: [PATCH 09/32] Improved: rewrite provisioning logic to accomodate file downloads, hash, outbound links and form submissions logic in new JS. --- src/Admin/Provisioning.php | 41 ++++++++++++++++++-- src/Client.php | 23 +++++++++++ tests/integration/Admin/ProvisioningTest.php | 4 +- 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/src/Admin/Provisioning.php b/src/Admin/Provisioning.php index 367f5be..577f9fc 100644 --- a/src/Admin/Provisioning.php +++ b/src/Admin/Provisioning.php @@ -88,9 +88,7 @@ public function __construct( $client = null ) { $this->custom_event_goals = [ '404' => __( '404', 'plausible-analytics' ), 'affiliate-links' => __( 'Cloaked Link: Click', 'plausible-analytics' ), - 'file-downloads' => __( 'File Download', 'plausible-analytics' ), 'form-completions' => __( 'WP Form Completions', 'plausible-analytics' ), - 'outbound-links' => __( 'Outbound Link: Click', 'plausible-analytics' ), 'query-params' => __( 'WP Query Parameters', 'plausible-analytics' ), 'search' => __( 'WP Search Queries', 'plausible-analytics' ), ]; @@ -109,11 +107,12 @@ private function init() { return; // @codeCoverageIgnore } - add_action( 'update_option_plausible_analytics_settings', [ $this, 'create_shared_link' ], 10, 2 ); + add_action( 'update_option_plausible_analytics_settings', [ $this, 'maybe_create_shared_link' ], 10, 2 ); add_action( 'update_option_plausible_analytics_settings', [ $this, 'maybe_create_goals' ], 10, 2 ); add_action( 'update_option_plausible_analytics_settings', [ $this, 'maybe_delete_goals' ], 11, 2 ); add_action( 'update_option_plausible_analytics_settings', [ $this, 'maybe_create_custom_properties' ], 11, 2 ); add_filter( 'pre_update_option_plausible_analytics_settings', [ $this, 'maybe_enable_customer_user_roles' ] ); + add_action( 'update_option_plausible_analytics_settings', [ $this, 'update_tracker_script_config' ], 10, 2 ); } /** @@ -122,7 +121,7 @@ private function init() { * @param $old_settings * @param $settings */ - public function create_shared_link( $old_settings, $settings ) { + public function maybe_create_shared_link( $old_settings, $settings ) { if ( empty( $settings[ 'enable_analytics_dashboard' ] ) ) { return; // @codeCoverageIgnore } @@ -421,4 +420,38 @@ public function maybe_enable_customer_user_roles( $settings ) { return $settings; } + + /** + * Updates the tracker script config based on the enabled enhanced measurements. + */ + public function update_tracker_script_config( $old_settings, $settings ) { + $config = [ + 'file_downloads' => false, + 'form_submissions' => false, + 'hash_based_routing' => false, + 'installation_type' => 'wordpress', + 'outbound_links' => false, + ]; + + if ( Helpers::is_enhanced_measurement_enabled( 'file-downloads', $settings['enhanced_measurements'] ) ) { + $config['file_downloads'] = true; + } + + if ( Helpers::is_enhanced_measurement_enabled( 'form-completions', $settings['enhanced_measurements'] ) ) { + $config['form_submissions'] = true; + } + + if ( Helpers::is_enhanced_measurement_enabled( 'hash', $settings['enhanced_measurements'] ) ) { + $config['hash_based_routing'] = true; + } + + if ( Helpers::is_enhanced_measurement_enabled( 'outbound-links', $settings['enhanced_measurements'] ) ) { + $config['outbound_links'] = true; + } + + $config = [ 'tracker_script_configuration' => $config ]; + $request = new Client\Model\TrackerScriptConfigurationUpdateRequest( $config ); + + $this->client->update_tracker_script_configuration( $request ); + } } diff --git a/src/Client.php b/src/Client.php index c38b543..cba257a 100644 --- a/src/Client.php +++ b/src/Client.php @@ -166,6 +166,29 @@ private function get_data_domain() { return false; } + /** + * Update the configured Tracker Script Configuration. + * + * @param \Plausible\Analytics\WP\Client\Model\TrackerScriptConfigurationUpdateRequest $tracker_script_config_update_request + * + * @codeCoverageIgnore + */ + public function update_tracker_script_configuration( $tracker_script_config_update_request ) { + try { + $this->api_instance->plausibleWebPluginsAPIControllersTrackerScriptConfigurationUpdate( + $tracker_script_config_update_request + ); + } catch ( Exception $e ) { + $this->send_json_error( + $e, + __( + 'Something went wrong while updating tracker script configuration: %s', + 'plausible-analytics' + ) + ); + } + } + /** * Stores the capabilities for the currently entered API token in the DB for later use. * diff --git a/tests/integration/Admin/ProvisioningTest.php b/tests/integration/Admin/ProvisioningTest.php index 71db0c2..44686ef 100644 --- a/tests/integration/Admin/ProvisioningTest.php +++ b/tests/integration/Admin/ProvisioningTest.php @@ -16,7 +16,7 @@ class ProvisioningTest extends TestCase { /** - * @see Provisioning::create_shared_link() + * @see Provisioning::maybe_create_shared_link() * @throws ApiException */ public function testCreateSharedLink() { @@ -38,7 +38,7 @@ public function testCreateSharedLink() { $class = new Provisioning( $mock ); - $class->create_shared_link( [], $settings ); + $class->maybe_create_shared_link( [], $settings ); $sharedLink = Helpers::get_settings()[ 'shared_link' ]; From e22e31937c616e2c3aa6bcd33a5555a9ef2265c7 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:45:17 +0100 Subject: [PATCH 10/32] Refactored Author and Categories (pageview-props) logic to new JS standards. --- src/Actions.php | 9 +++++---- src/Filters.php | 22 +++++++++++----------- src/Integrations/EDD.php | 2 +- src/Integrations/WooCommerce.php | 4 ++-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Actions.php b/src/Actions.php index b383d19..8f30453 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -111,7 +111,8 @@ public function maybe_register_assets() { 'window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},window.plausible.init=function(i){window.plausible.o=i||{}};var script=document.createElement("script");script.type="text/javascript",script.defer=!0,script.src="%s";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(script,r);', $url ); - $script .= "\nplausible.init();"; + $options = wp_json_encode( apply_filters( 'plausible_analytics_init_options', [] ) ); + $script .= "\nplausible.init($options);"; wp_add_inline_script( 'plausible-analytics', $script ); @@ -146,7 +147,7 @@ public function maybe_register_assets() { wp_add_inline_script( 'plausible-analytics', - "document.addEventListener('DOMContentLoaded', () => { plausible( '404', $data ); });" + "document.addEventListener('DOMContentLoaded', () => { track( '404', $data ); });" ); } @@ -168,7 +169,7 @@ public function maybe_register_assets() { ] ); - $script = "plausible('WP Query Parameters', $data );"; + $script = "track('WP Query Parameters', $data );"; wp_add_inline_script( 'plausible-analytics', @@ -192,7 +193,7 @@ public function maybe_register_assets() { ], ] ); - $script = "plausible('WP Search Queries', $data );"; + $script = "track('WP Search Queries', $data );"; wp_add_inline_script( 'plausible-analytics', diff --git a/src/Filters.php b/src/Filters.php index 57d6016..d6a4805 100644 --- a/src/Filters.php +++ b/src/Filters.php @@ -21,7 +21,7 @@ class Filters { */ public function __construct() { add_filter( 'script_loader_tag', [ $this, 'add_plausible_attributes' ], 10, 2 ); - add_filter( 'plausible_analytics_script_params', [ $this, 'maybe_add_pageview_props' ] ); + add_filter( 'plausible_analytics_init_options', [ $this, 'maybe_add_pageview_props' ] ); add_filter( 'plausible_analytics_script_params', [ $this, 'maybe_track_logged_in_users' ] ); } @@ -70,21 +70,21 @@ public function add_plausible_attributes( $tag, $handle ) { /** * Adds custom parameters Author and Category if Custom Pageview Properties is enabled. * - * @param $params + * @param $options array * - * @return mixed|void + * @return array */ - public function maybe_add_pageview_props( $params ) { + public function maybe_add_pageview_props( $options = [] ) { $settings = Helpers::get_settings(); if ( ! is_array( $settings[ 'enhanced_measurements' ] ) || ! in_array( 'pageview-props', $settings[ 'enhanced_measurements' ] ) ) { - return $params; // @codeCoverageIgnore + return $options; // @codeCoverageIgnore } global $post; if ( ! $post instanceof \WP_Post ) { - return $params; // @codeCoverageIgnore + return $options; // @codeCoverageIgnore } $author = $post->post_author; @@ -92,17 +92,17 @@ public function maybe_add_pageview_props( $params ) { if ( $author ) { $author_name = get_the_author_meta( 'display_name', $author ); - $params .= " event-author='$author_name'"; + $options['customProperties']['author'] = $author_name; } - // Add support for post category and tags along with custom taxonomies. + // Add support for the post-category and tags along with custom taxonomies. $taxonomies = get_object_taxonomies( $post->post_type ); // Loop through existing taxonomies. foreach ( $taxonomies as $taxonomy ) { $terms = get_the_terms( $post->ID, $taxonomy ); - // Skip the iteration, if `$terms` is not array. + // Skip the iteration if `$terms` is not an array. if ( ! is_array( $terms ) ) { continue; // @codeCoverageIgnore; } @@ -110,12 +110,12 @@ public function maybe_add_pageview_props( $params ) { // Loop through the terms. foreach ( $terms as $term ) { if ( $term instanceof WP_Term ) { - $params .= " event-{$taxonomy}=\"{$term->name}\""; + $options['customProperties'][ $taxonomy ] = $term->name; } } } - return $params; + return $options; } /** diff --git a/src/Integrations/EDD.php b/src/Integrations/EDD.php index a29bc96..5a85f77 100644 --- a/src/Integrations/EDD.php +++ b/src/Integrations/EDD.php @@ -211,7 +211,7 @@ public function track_purchase() { ); $label = $this->event_goals[ 'purchase' ]; - echo sprintf( Integrations::SCRIPT_WRAPPER, "window.plausible( '$label', $props )" ); + echo sprintf( Integrations::SCRIPT_WRAPPER, "window.track( '$label', $props )" ); edd_add_order_meta( $order->id, Integrations::PURCHASE_TRACKED_META_KEY, true ); } diff --git a/src/Integrations/WooCommerce.php b/src/Integrations/WooCommerce.php index 32eed40..f896e3a 100644 --- a/src/Integrations/WooCommerce.php +++ b/src/Integrations/WooCommerce.php @@ -335,7 +335,7 @@ public function track_entered_checkout() { $props = wp_json_encode( $props ); $label = $this->event_goals[ 'checkout' ]; - echo sprintf( Integrations::SCRIPT_WRAPPER, "window.plausible( '$label', $props )" ); + echo sprintf( Integrations::SCRIPT_WRAPPER, "window.track( '$label', $props )" ); } /** @@ -360,7 +360,7 @@ public function track_purchase( $order_id ) { ); $label = $this->event_goals[ 'purchase' ]; - echo sprintf( Integrations::SCRIPT_WRAPPER, "window.plausible( '$label', $props )" ); + echo sprintf( Integrations::SCRIPT_WRAPPER, "window.track( '$label', $props )" ); $order->add_meta_data( Integrations::PURCHASE_TRACKED_META_KEY, true ); $order->save(); From c544874b79b4a7e64c1d5a04a177988940b3a1e6 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:12:01 +0100 Subject: [PATCH 11/32] Change track() back to plausible(). --- src/Actions.php | 6 +++--- src/Integrations/EDD.php | 2 +- src/Integrations/WooCommerce.php | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Actions.php b/src/Actions.php index 8f30453..45300b2 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -147,7 +147,7 @@ public function maybe_register_assets() { wp_add_inline_script( 'plausible-analytics', - "document.addEventListener('DOMContentLoaded', () => { track( '404', $data ); });" + "document.addEventListener('DOMContentLoaded', () => { plausible( '404', $data ); });" ); } @@ -169,7 +169,7 @@ public function maybe_register_assets() { ] ); - $script = "track('WP Query Parameters', $data );"; + $script = "plausible('WP Query Parameters', $data );"; wp_add_inline_script( 'plausible-analytics', @@ -193,7 +193,7 @@ public function maybe_register_assets() { ], ] ); - $script = "track('WP Search Queries', $data );"; + $script = "plausible('WP Search Queries', $data );"; wp_add_inline_script( 'plausible-analytics', diff --git a/src/Integrations/EDD.php b/src/Integrations/EDD.php index 5a85f77..a29bc96 100644 --- a/src/Integrations/EDD.php +++ b/src/Integrations/EDD.php @@ -211,7 +211,7 @@ public function track_purchase() { ); $label = $this->event_goals[ 'purchase' ]; - echo sprintf( Integrations::SCRIPT_WRAPPER, "window.track( '$label', $props )" ); + echo sprintf( Integrations::SCRIPT_WRAPPER, "window.plausible( '$label', $props )" ); edd_add_order_meta( $order->id, Integrations::PURCHASE_TRACKED_META_KEY, true ); } diff --git a/src/Integrations/WooCommerce.php b/src/Integrations/WooCommerce.php index f896e3a..370d84f 100644 --- a/src/Integrations/WooCommerce.php +++ b/src/Integrations/WooCommerce.php @@ -335,7 +335,7 @@ public function track_entered_checkout() { $props = wp_json_encode( $props ); $label = $this->event_goals[ 'checkout' ]; - echo sprintf( Integrations::SCRIPT_WRAPPER, "window.track( '$label', $props )" ); + echo sprintf( Integrations::SCRIPT_WRAPPER, "window.plausible( '$label', $props )" ); } /** @@ -349,9 +349,9 @@ public function track_purchase( $order_id ) { $order = wc_get_order( $order_id ); $is_tracked = $order->get_meta( Integrations::PURCHASE_TRACKED_META_KEY ); - if ( $is_tracked ) { - return; // @codeCoverageIgnore - } + // if ( $is_tracked ) { + // return; // @codeCoverageIgnore + // } $props = wp_json_encode( [ @@ -360,7 +360,7 @@ public function track_purchase( $order_id ) { ); $label = $this->event_goals[ 'purchase' ]; - echo sprintf( Integrations::SCRIPT_WRAPPER, "window.track( '$label', $props )" ); + echo sprintf( Integrations::SCRIPT_WRAPPER, "window.plausible( '$label', $props )" ); $order->add_meta_data( Integrations::PURCHASE_TRACKED_META_KEY, true ); $order->save(); From 595e4703df1f4b14c44416cb05f2c62bbc8ee09d Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:13:48 +0100 Subject: [PATCH 12/32] Typo. --- src/Integrations/WooCommerce.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Integrations/WooCommerce.php b/src/Integrations/WooCommerce.php index 370d84f..32eed40 100644 --- a/src/Integrations/WooCommerce.php +++ b/src/Integrations/WooCommerce.php @@ -349,9 +349,9 @@ public function track_purchase( $order_id ) { $order = wc_get_order( $order_id ); $is_tracked = $order->get_meta( Integrations::PURCHASE_TRACKED_META_KEY ); - // if ( $is_tracked ) { - // return; // @codeCoverageIgnore - // } + if ( $is_tracked ) { + return; // @codeCoverageIgnore + } $props = wp_json_encode( [ From dffbadc9f62cf9584ea6a1d000d3986510bba706 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:34:44 +0100 Subject: [PATCH 13/32] Fixed: Start Checkout event was tracked on Thank You-page as well. --- src/Integrations/WooCommerce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Integrations/WooCommerce.php b/src/Integrations/WooCommerce.php index 32eed40..dc1a0d1 100644 --- a/src/Integrations/WooCommerce.php +++ b/src/Integrations/WooCommerce.php @@ -315,7 +315,7 @@ public function track_remove_cart_item( $cart_item_key, $cart ) { * @return void */ public function track_entered_checkout() { - if ( ! is_checkout() ) { + if ( ! is_checkout() || is_wc_endpoint_url( 'order-received' ) ) { return; // @codeCoverageIgnore } From f61a42f15a098deabb31a25bafda0c7a1d25e9cc Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Fri, 12 Dec 2025 17:24:47 +0100 Subject: [PATCH 14/32] Typo. --- src/Integrations/WooCommerce.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Integrations/WooCommerce.php b/src/Integrations/WooCommerce.php index dc1a0d1..b57d3cb 100644 --- a/src/Integrations/WooCommerce.php +++ b/src/Integrations/WooCommerce.php @@ -194,7 +194,7 @@ public function track_direct_add_to_cart() { } /** - * Track regular (i.e. interactivity API) add to cart events. + * Track regular (i.e., interactivity API) add to cart events. * * @param WC_Product $product General information about the product added to cart. * @param array $add_to_cart_data Cart data for the product added to the cart, e.g. quantity, variation ID, etc. @@ -248,7 +248,7 @@ private function clean_data( $product ) { } /** - * Track (non-Interactivity API, i.e. AJAX) add to cart events. + * Track (non-Interactivity API i.e., AJAX) add to cart events. * * @param string|int $product_id ID of the product added to the cart. * From f503da00bc5fd11cb84efab81d388271e0c9016b Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Fri, 12 Dec 2025 17:38:00 +0100 Subject: [PATCH 15/32] Re-factored Logged In User Status. --- src/Filters.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Filters.php b/src/Filters.php index d6a4805..680b068 100644 --- a/src/Filters.php +++ b/src/Filters.php @@ -22,7 +22,7 @@ class Filters { public function __construct() { add_filter( 'script_loader_tag', [ $this, 'add_plausible_attributes' ], 10, 2 ); add_filter( 'plausible_analytics_init_options', [ $this, 'maybe_add_pageview_props' ] ); - add_filter( 'plausible_analytics_script_params', [ $this, 'maybe_track_logged_in_users' ] ); + add_filter( 'plausible_analytics_init_options', [ $this, 'maybe_track_logged_in_users' ] ); } /** @@ -119,34 +119,34 @@ public function maybe_add_pageview_props( $options = [] ) { } /** - * Adds custom parameter User Logged In if Custom Properties is enabled. + * Adds a custom parameter User Logged In if Custom Properties is enabled. * - * @since v2.4.0 + * @param $options * - * @param $params + * @return array + * @since v2.4.0 * - * @return mixed|string */ - public function maybe_track_logged_in_users( $params ) { + public function maybe_track_logged_in_users( $options = [] ) { $settings = Helpers::get_settings(); if ( ! is_array( $settings[ 'enhanced_measurements' ] ) || ! in_array( 'pageview-props', $settings[ 'enhanced_measurements' ] ) ) { - return $params; // @codeCoverageIgnore + return $options; // @codeCoverageIgnore } $logged_in = _x( 'no', __( 'Value when user is not logged in.', 'plausible-analytics' ), 'plausible-analytics' ); if ( is_user_logged_in() ) { $user = wp_get_current_user(); - $roles = (array) $user->roles; + $roles = $user->roles; if ( ! empty( $roles ) ) { $logged_in = $roles[ 0 ]; } } - $params .= " event-user_logged_in='$logged_in'"; + $options['customProperties']['user_logged_in'] = $logged_in; - return $params; + return $options; } } From 96ab5805986198bd952d8a63369612a0f917d4d8 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 17 Dec 2025 14:03:06 +0100 Subject: [PATCH 16/32] Custom Events is on by default, so removed the option and logic. IE compatibility is removed. --- src/Admin/Settings/Page.php | 16 ---------------- src/Filters.php | 5 ----- src/Helpers.php | 2 +- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 02c7409..540e124 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -256,14 +256,6 @@ public function __construct() { 'slug' => 'advanced_options', 'type' => 'toggle_group', 'fields' => [ - 'tagged-events' => [ - 'label' => esc_html__( 'Custom events', 'plausible-analytics' ), - 'docs' => 'https://plausible.io/wordpress-analytics-plugin#how-to-setup-custom-events-to-track-goal-conversions', - 'slug' => 'enhanced_measurements', - 'type' => 'checkbox', - 'value' => 'tagged-events', - 'caps' => [ self::CAP_GOALS ], - ], 'hash' => [ 'label' => esc_html__( 'Hash-based routing', 'plausible-analytics' ), 'docs' => 'https://plausible.io/wordpress-analytics-plugin#how-to-enable-hash-based-url-tracking', @@ -272,14 +264,6 @@ public function __construct() { 'value' => 'hash', 'caps' => [], ], - 'compat' => [ - 'label' => esc_html__( 'IE compatibility', 'plausible-analytics' ), - 'docs' => 'https://plausible.io/wordpress-analytics-plugin#how-to-track-visitors-who-use-internet-explorer', - 'slug' => 'enhanced_measurements', - 'type' => 'checkbox', - 'value' => 'compat', - 'caps' => [], - ], ], ], ], diff --git a/src/Filters.php b/src/Filters.php index 680b068..7732301 100644 --- a/src/Filters.php +++ b/src/Filters.php @@ -46,11 +46,6 @@ public function add_plausible_attributes( $tag, $handle ) { $api_url = Helpers::get_data_api_url(); $domain_name = Helpers::get_domain(); - if ( Helpers::is_enhanced_measurement_enabled( 'compat' ) ) { - // We need the correct id attribute for IE compatibility. - $tag = preg_replace( "/\sid=(['\"])plausible-analytics-js(['\"])/", " id=$1plausible$2", $tag ); - } - /** * the data-cfasync ensures this script isn't processed by CF Rocket Loader @see https://developers.cloudflare.com/speed/optimization/content/rocket-loader/ignore-javascripts/ */ diff --git a/src/Helpers.php b/src/Helpers.php index 94e0691..4ca482d 100644 --- a/src/Helpers.php +++ b/src/Helpers.php @@ -167,7 +167,7 @@ public static function get_proxy_resources() { * Check if a certain Enhanced Measurement is enabled. * * @param string $name Name of the option to check, valid values are - * 404|outbound-links|file-downloads|tagged-events|revenue|pageview-props|hash. + * 404|outbound-links|file-downloads|revenue|pageview-props|hash. * @param array $enhanced_measurements Allows checking against a different set of options. * * @return bool From 087f10374f5acccb23be42fb9de533cd704488c3 Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 17 Dec 2025 14:15:24 +0100 Subject: [PATCH 17/32] Moved download_file logic to Cron-class. --- src/Cron.php | 38 ++++++++++++++++++++++++++++--- src/Helpers.php | 32 -------------------------- tests/integration/HelpersTest.php | 12 +--------- 3 files changed, 36 insertions(+), 46 deletions(-) diff --git a/src/Cron.php b/src/Cron.php index 8fb1226..eded425 100644 --- a/src/Cron.php +++ b/src/Cron.php @@ -39,7 +39,7 @@ public function __construct() { * @throws Exception */ private function init() { - $this->download(); + $this->maybe_download(); } /** @@ -49,7 +49,7 @@ private function init() { * @throws InvalidArgument * @throws Exception */ - private function download() { + private function maybe_download() { if ( ! Helpers::proxy_enabled() ) { return false; } @@ -57,6 +57,38 @@ private function download() { $remote = Helpers::get_js_url(); $local = Helpers::get_js_path(); - return Helpers::download_file( $remote, $local ); + return $this->download_file( $remote, $local ); + } + + /** + * Downloads a remote file to this server. + * + * @param string $local_file Absolute path to where to store the $remote_file. + * @param string $remote_file Full URL to file to download. + * + * @return bool True when successful. False if it fails. + * @throws Exception + * @throws InvalidArgument + * + * @since 1.3.0 + */ + private function download_file( $remote_file, $local_file ) { + $file_contents = wp_remote_get( $remote_file ); + + if ( is_wp_error( $file_contents ) ) { + // TODO: add error handling? + return false; // @codeCoverageIgnore + } + + /** + * Some servers don't do a full overwrite if file already exists, so we delete it first. + */ + if ( file_exists( $local_file ) ) { + unlink( $local_file ); + } + + $write = file_put_contents( $local_file, wp_remote_retrieve_body( $file_contents ) ); + + return $write > 0; } } diff --git a/src/Helpers.php b/src/Helpers.php index 4ca482d..adedb2e 100644 --- a/src/Helpers.php +++ b/src/Helpers.php @@ -229,38 +229,6 @@ public static function get_js_path() { return self::get_proxy_resource( 'cache_dir' ) . self::get_filename() . '.js'; } - /** - * Downloads a remote file to this server. - * - * @since 1.3.0 - * - * @param string $local_file Absolute path to where to store the $remote_file. - * @param string $remote_file Full URL to file to download. - * - * @return bool True when successful. False if it fails. - * @throws Exception - * @throws InvalidArgument - */ - public static function download_file( $remote_file, $local_file ) { - $file_contents = wp_remote_get( $remote_file ); - - if ( is_wp_error( $file_contents ) ) { - // TODO: add error handling? - return false; // @codeCoverageIgnore - } - - /** - * Some servers don't do a full overwrite if file already exists, so we delete it first. - */ - if ( file_exists( $local_file ) ) { - unlink( $local_file ); - } - - $write = file_put_contents( $local_file, wp_remote_retrieve_body( $file_contents ) ); - - return $write > 0; - } - /** * Get entered Domain Name or provide alternative if not entered. * diff --git a/tests/integration/HelpersTest.php b/tests/integration/HelpersTest.php index 5aac5d6..77bce74 100644 --- a/tests/integration/HelpersTest.php +++ b/tests/integration/HelpersTest.php @@ -7,6 +7,7 @@ use Exception; use Plausible\Analytics\Tests\TestCase; +use Plausible\Analytics\WP\Cron; use Plausible\Analytics\WP\Helpers; class HelpersTest extends TestCase { @@ -215,17 +216,6 @@ public function testGetJsPath() { $this->assertMatchesRegularExpression( "~$upload_dir/[a-z0-9]{10}/[a-z0-9]{8}\.js~", $path ); } - /** - * @see Helpers::download_file() - * @return void - * @throws Exception - */ - public function testDownloadFile() { - Helpers::download_file( 'https://plausible.io/js/plausible.js', wp_get_upload_dir()[ 'basedir' ] . '/test.js' ); - - $this->assertFileExists( wp_get_upload_dir()[ 'basedir' ] . '/test.js' ); - } - /** * @see Helpers::get_domain() * @return void From ba6aa874661f37cb7b8dbe47a742582ed50cfabe Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 17 Dec 2025 14:16:59 +0100 Subject: [PATCH 18/32] Moved Hash-based-routing out of Advanced Options and removed Advanced Options section. --- src/Admin/Settings/Page.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 540e124..68ddfa4 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -251,20 +251,13 @@ public function __construct() { 'value' => 'search', 'caps' => [ self::CAP_GOALS ], ], - 'advanced-options' => [ - 'label' => esc_html__( 'Advanced options', 'plausible-analytics' ), - 'slug' => 'advanced_options', - 'type' => 'toggle_group', - 'fields' => [ - 'hash' => [ - 'label' => esc_html__( 'Hash-based routing', 'plausible-analytics' ), - 'docs' => 'https://plausible.io/wordpress-analytics-plugin#how-to-enable-hash-based-url-tracking', - 'slug' => 'enhanced_measurements', - 'type' => 'checkbox', - 'value' => 'hash', - 'caps' => [], - ], - ], + 'hash' => [ + 'label' => esc_html__( 'Hash-based routing', 'plausible-analytics' ), + 'docs' => 'https://plausible.io/wordpress-analytics-plugin#how-to-enable-hash-based-url-tracking', + 'slug' => 'enhanced_measurements', + 'type' => 'checkbox', + 'value' => 'hash', + 'caps' => [], ], ], ], From 829345d20545eeb0c4f67dd48c599a7c40c453eb Mon Sep 17 00:00:00 2001 From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 17 Dec 2025 14:27:05 +0100 Subject: [PATCH 19/32] Removed hacks to track addToCart events on product pages, because Fetch Keep-alive is now used. --- src/Integrations/WooCommerce.php | 56 -------------------------------- 1 file changed, 56 deletions(-) diff --git a/src/Integrations/WooCommerce.php b/src/Integrations/WooCommerce.php index b57d3cb..915f3eb 100644 --- a/src/Integrations/WooCommerce.php +++ b/src/Integrations/WooCommerce.php @@ -67,8 +67,6 @@ private function init( $init ) { /** * Trigger tracking events. */ - add_action( 'woocommerce_before_add_to_cart_quantity', [ $this, 'add_cart_form_hidden_input' ] ); - add_action( 'woocommerce_after_add_to_cart_form', [ $this, 'track_add_to_cart_on_product_page' ] ); add_action( 'woocommerce_store_api_validate_add_to_cart', [ $this, 'track_add_to_cart' ], 10, 2 ); add_action( 'woocommerce_ajax_added_to_cart', [ $this, 'track_ajax_add_to_cart' ] ); /** @see \WC_Form_Handler::add_to_cart_action() runs on priority 20. We need to run before that, in case redirect is enabled. */ @@ -120,60 +118,6 @@ public function add_http_referer( $add_to_cart_data, $request ) { return $add_to_cart_data; } - /** - * Adds a hidden input with the same name and value as the add-to-cart button. - * - * TODO: This hack can be removed when the JS library uses sendBeacon to send the event. - * - * @return void - * - * @codeCoverageIgnore Because we can't test JS here. - */ - public function add_cart_form_hidden_input() { - $product = wc_get_product(); - - if ( ! $product ) { - return; - } - ?> - - - - Date: Wed, 17 Dec 2025 16:30:34 +0100 Subject: [PATCH 20/32] Some re-factors and make sure correct endpoint is set when Proxy is enabled. --- src/Actions.php | 2 +- src/Compatibility.php | 38 ++++++++++++++++++++ src/Filters.php | 58 +++++++++++-------------------- src/Helpers.php | 6 ++-- tests/integration/ActionsTest.php | 6 ++-- tests/integration/FiltersTest.php | 6 ++-- tests/integration/HelpersTest.php | 8 ++--- 7 files changed, 72 insertions(+), 52 deletions(-) diff --git a/src/Actions.php b/src/Actions.php index 45300b2..f043a45 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -106,7 +106,7 @@ public function maybe_register_assets() { apply_filters( 'plausible_load_js_in_footer', false ) ); - $url = Helpers::get_js_url(); + $url = Helpers::get_js_url( true ); $script = sprintf( 'window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},window.plausible.init=function(i){window.plausible.o=i||{}};var script=document.createElement("script");script.type="text/javascript",script.defer=!0,script.src="%s";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(script,r);', $url diff --git a/src/Compatibility.php b/src/Compatibility.php index 398371b..0a42f95 100644 --- a/src/Compatibility.php +++ b/src/Compatibility.php @@ -27,6 +27,9 @@ public function __construct() { add_filter( 'autoptimize_filter_js_exclude', [ $this, 'exclude_plausible_js_as_string' ] ); } + // Cloudflare Rocket Loader + add_filter( 'script_loader_tag', [ $this, 'exclude_from_cloudflare_rocket_loader' ], 10, 2 ); + // LiteSpeed Cache if ( defined( 'LSCWP_V' ) ) { add_filter( 'litespeed_optimize_js_excludes', [ $this, 'exclude_plausible_js' ] ); @@ -87,6 +90,41 @@ public function exclude_plausible_js_as_string( $exclude_js ) { return $exclude_js; } + /** + * Add Plausible Analytics attributes. + * + * @param string $handle Script handle. + * @param string $tag Script tag. + * + * @return string + * @since 1.0.0 + * @access public + * + */ + public function exclude_from_cloudflare_rocket_loader( $tag, $handle ) { + // Bail if it's not our script. + if ( 'plausible-analytics' !== $handle ) { + return $tag; // @codeCoverageIgnore + } + + $settings = Helpers::get_settings(); + + /** + * the data-cfasync ensures this script isn't processed by CF Rocket Loader @see https://developers.cloudflare.com/speed/optimization/content/rocket-loader/ignore-javascripts/ + */ + $params = "defer data-cfasync='false'"; + + // Triggered when exclude pages is enabled. + if ( ! empty( $settings['excluded_pages'] ) && $settings['excluded_pages'] ) { + $excluded_pages = $settings['excluded_pages']; // @codeCoverageIgnore + $params .= " data-exclude='{$excluded_pages}'"; // @codeCoverageIgnore + } + + $params = apply_filters( 'plausible_analytics_script_params', $params ); + + return str_replace( ' src', " {$params} src", $tag ); + } + /** * Dear WP Rocket/SG Optimizer/Etc., don't minify/combine our inline JS, please. * diff --git a/src/Filters.php b/src/Filters.php index 7732301..7170c73 100644 --- a/src/Filters.php +++ b/src/Filters.php @@ -20,48 +20,11 @@ class Filters { * @return void */ public function __construct() { - add_filter( 'script_loader_tag', [ $this, 'add_plausible_attributes' ], 10, 2 ); add_filter( 'plausible_analytics_init_options', [ $this, 'maybe_add_pageview_props' ] ); + add_filter( 'plausible_analytics_init_options', [ $this, 'maybe_add_proxy_options' ] ); add_filter( 'plausible_analytics_init_options', [ $this, 'maybe_track_logged_in_users' ] ); } - /** - * Add Plausible Analytics attributes. - * - * @since 1.0.0 - * @access public - * - * @param string $handle Script handle. - * @param string $tag Script tag. - * - * @return string - */ - public function add_plausible_attributes( $tag, $handle ) { - // Bail if it's not our script. - if ( 'plausible-analytics' !== $handle ) { - return $tag; // @codeCoverageIgnore - } - - $settings = Helpers::get_settings(); - $api_url = Helpers::get_data_api_url(); - $domain_name = Helpers::get_domain(); - - /** - * the data-cfasync ensures this script isn't processed by CF Rocket Loader @see https://developers.cloudflare.com/speed/optimization/content/rocket-loader/ignore-javascripts/ - */ - $params = "defer data-domain='{$domain_name}' data-api='{$api_url}' data-cfasync='false'"; - - // Triggered when exclude pages is enabled. - if ( ! empty( $settings[ 'excluded_pages' ] ) && $settings[ 'excluded_pages' ] ) { - $excluded_pages = $settings[ 'excluded_pages' ]; // @codeCoverageIgnore - $params .= " data-exclude='{$excluded_pages}'"; // @codeCoverageIgnore - } - - $params = apply_filters( 'plausible_analytics_script_params', $params ); - - return str_replace( ' src', " {$params} src", $tag ); - } - /** * Adds custom parameters Author and Category if Custom Pageview Properties is enabled. * @@ -113,6 +76,25 @@ public function maybe_add_pageview_props( $options = [] ) { return $options; } + /** + * Modify the endpoint option if Proxy is enabled. + * + * @param array $options + * + * @return array + * + * @throws \Exception + */ + public function maybe_add_proxy_options( $options = [] ) { + if ( ! Helpers::proxy_enabled() ) { + return $options; + } + + $options['endpoint'] = Helpers::get_endpoint_url(); + + return $options; + } + /** * Adds a custom parameter User Logged In if Custom Properties is enabled. * diff --git a/src/Helpers.php b/src/Helpers.php index adedb2e..9d79588 100644 --- a/src/Helpers.php +++ b/src/Helpers.php @@ -21,13 +21,13 @@ class Helpers { * @return string * @throws Exception */ - public static function get_js_url() { + public static function get_js_url( $local = false ) { $file_name = self::get_filename(); /** * If Avoid ad blockers is enabled, return URL to local file. */ - if ( self::proxy_enabled() ) { + if ( $local && self::proxy_enabled() ) { return esc_url( self::get_proxy_resource( 'cache_url' ) . $file_name . '.js' ); } @@ -256,7 +256,7 @@ public static function get_domain() { * @return string * @throws Exception */ - public static function get_data_api_url() { + public static function get_endpoint_url() { if ( self::proxy_enabled() ) { // This will make sure the API endpoint is properly registered when we're testing. $append = isset( $_GET[ 'plausible_proxy' ] ) ? '?plausible_proxy=1' : ''; diff --git a/tests/integration/ActionsTest.php b/tests/integration/ActionsTest.php index 95fe7db..a59b23c 100644 --- a/tests/integration/ActionsTest.php +++ b/tests/integration/ActionsTest.php @@ -13,11 +13,11 @@ class ActionsTest extends TestCase { /** - * @see Actions::maybe_register_assets() - * @see Filters::add_plausible_attributes() - * @see Filters::maybe_add_pageview_props() * @return void * @throws \Exception + * @see Filters::maybe_add_pageview_props() + * @see Actions::maybe_register_assets() + * @see Filters::exclude_from_cloudflare_rocket_loader() */ public function testRegisterAssets() { global $post; diff --git a/tests/integration/FiltersTest.php b/tests/integration/FiltersTest.php index 28cb87c..14ec78d 100644 --- a/tests/integration/FiltersTest.php +++ b/tests/integration/FiltersTest.php @@ -10,11 +10,11 @@ class FiltersTest extends TestCase { /** - * @see Filters::add_plausible_attributes() + * @see Filters::exclude_from_cloudflare_rocket_loader() */ public function testAddPlausibleAttributes() { $class = new Filters(); - $tag = $class->add_plausible_attributes( '