diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..94e9a82 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,21 @@ +name: Publish Docs + +on: + push: + branches: [ "master" ] + +jobs: + docs: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Generate docs + uses: phpDocumentor/phpDocumentor@master + + - uses: EndBug/add-and-commit@v9 + with: + add: 'docs' + message: ':memo: Updating docs' diff --git a/.gitignore b/.gitignore index 1ddf72c..2e0283a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ -build/ *.iws **/.DS_Store -**/node_modules -package-lock.json /vendor -/composer.lock .savant/cache +.phpunit.cache +.phpdoc/cache diff --git a/.phpdoc/template/css/custom.css.twig b/.phpdoc/template/css/custom.css.twig new file mode 100644 index 0000000..f6c1f96 --- /dev/null +++ b/.phpdoc/template/css/custom.css.twig @@ -0,0 +1,7 @@ +.phpdocumentor-title__link { + margin-right: 1em; + white-space: break-spaces; +} +.phpdocumentor-title__link:hover { + transform: none; +} diff --git a/composer.json b/composer.json index 869d7fc..059c075 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "fusionauth/fusionauth-client", "type": "library", + "version": "2.0.0", "description": "FusionAuth Client written in PHP", "keywords": ["rest","api", "fusionauth"], "homepage": "https://github.com/FusionAuth/fusionauth-php-client", @@ -20,11 +21,19 @@ "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "9.*" + "phpunit/phpunit": "^10.5.8" }, "autoload": { "psr-4": { "FusionAuth\\": "src/FusionAuth/" } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/FusionAuth/" + } + }, + "scripts": { + "test": "phpunit" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..e5380d2 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1637 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "94a18de62688fe39c9c7c3715407712c", + "packages": [], + "packages-dev": [ + { + "name": "myclabs/deep-copy", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2023-03-08T13:26:56+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.0.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" + }, + "time": "2024-01-07T17:17:35+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "10.1.11", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "78c3b7625965c2513ee96569a4dbb62601784145" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145", + "reference": "78c3b7625965c2513ee96569a4dbb62601784145", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.1" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-21T15:38:30+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-31T06:24:48+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:56:09+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-31T14:07:24+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:57:52+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "10.5.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "08f4fa74d5fbfff1ef22abffee47aaedcaea227e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/08f4fa74d5fbfff1ef22abffee47aaedcaea227e", + "reference": "08f4fa74d5fbfff1ef22abffee47aaedcaea227e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.5", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.1", + "sebastian/global-state": "^6.0.1", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.5-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.8" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2024-01-19T07:07:27+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:58:15+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:58:43+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:59:15+00:00" + }, + { + "name": "sebastian/comparator", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-14T13:18:12+00:00" + }, + { + "name": "sebastian/complexity", + "version": "3.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "68ff824baeae169ec9f2137158ee529584553799" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-21T08:37:17+00:00" + }, + { + "name": "sebastian/diff", + "version": "5.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T10:55:06+00:00" + }, + { + "name": "sebastian/environment", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951", + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "https://github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-04-11T05:39:26+00:00" + }, + { + "name": "sebastian/exporter", + "version": "5.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-09-24T13:22:09+00:00" + }, + { + "name": "sebastian/global-state", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-07-19T07:19:23+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-21T08:38:20+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:08:32+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:06:18+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:05:40+00:00" + }, + { + "name": "sebastian/type", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:10:45+00:00" + }, + { + "name": "sebastian/version", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-07T11:34:05+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2023-11-20T00:12:19+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "ext-curl": "*", + "ext-json": "*" + }, + "platform-dev": [], + "plugin-api-version": "2.6.0" +} diff --git a/phpdoc.xml b/phpdoc.xml new file mode 100644 index 0000000..bf552d3 --- /dev/null +++ b/phpdoc.xml @@ -0,0 +1,20 @@ + + + FusionAuth PHP Client + + docs/ + + + + + src + tests + + + + + diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..72f2048 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,24 @@ + + + + + tests + + + + + + src + + + diff --git a/src/FusionAuth/ClientResponse.php b/src/FusionAuth/ClientResponse.php index ededdc9..6b4886f 100644 --- a/src/FusionAuth/ClientResponse.php +++ b/src/FusionAuth/ClientResponse.php @@ -1,4 +1,5 @@ status >= 200 && $this->status <= 299 && $this->exception == null; - } + public $status; - public function __construct() - { - } + public function wasSuccessful() + { + return $this->status >= 200 && $this->status <= 299 && $this->exception == null; + } + public function __construct() + { + } } diff --git a/src/FusionAuth/FusionAuthClient.php b/src/FusionAuth/FusionAuthClient.php index 674b98a..9cad796 100644 --- a/src/FusionAuth/FusionAuthClient.php +++ b/src/FusionAuth/FusionAuthClient.php @@ -1,4 +1,5 @@ apiKey = $apiKey; - $this->baseURL = $baseURL; - } + public function __construct($apiKey, $baseURL) + { + include_once 'RESTClient.php'; + $this->apiKey = $apiKey; + $this->baseURL = $baseURL; + } - public function withTenantId($tenantId) { - $this->tenantId = $tenantId; - return $this; - } + public function withTenantId($tenantId) + { + $this->tenantId = $tenantId; + return $this; + } /** * Takes an action on a user. The user being actioned is called the "actionee" and the user taking the action is called the @@ -77,13 +79,13 @@ public function withTenantId($tenantId) { * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function actionUser($request) - { - return $this->start()->uri("/api/user/action") + public function actionUser($request) + { + return $this->start()->uri("/api/user/action") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Activates the FusionAuth Reactor using a license id and optionally a license text (for air-gapped deployments) @@ -93,13 +95,13 @@ public function actionUser($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function activateReactor($request) - { - return $this->start()->uri("/api/reactor") + public function activateReactor($request) + { + return $this->start()->uri("/api/reactor") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Adds a user to an existing family. The family id must be specified. @@ -110,14 +112,14 @@ public function activateReactor($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function addUserToFamily($familyId, $request) - { - return $this->start()->uri("/api/user/family") + public function addUserToFamily($familyId, $request) + { + return $this->start()->uri("/api/user/family") ->urlSegment($familyId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Approve a device grant. @@ -130,19 +132,19 @@ public function addUserToFamily($familyId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function approveDevice($client_id, $client_secret, $token, $user_code) - { - $post_data = array( - 'client_id' => $client_id, - 'client_secret' => $client_secret, - 'token' => $token, - 'user_code' => $user_code - ); - return $this->start()->uri("/oauth2/device/approve") + public function approveDevice($client_id, $client_secret, $token, $user_code) + { + $post_data = array( + 'client_id' => $client_id, + 'client_secret' => $client_secret, + 'token' => $token, + 'user_code' => $user_code + ); + return $this->start()->uri("/oauth2/device/approve") ->bodyHandler(new FormDataBodyHandler($post_data)) ->post() ->go(); - } + } /** * Cancels the user action. @@ -153,19 +155,19 @@ public function approveDevice($client_id, $client_secret, $token, $user_code) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function cancelAction($actionId, $request) - { - return $this->start()->uri("/api/user/action") + public function cancelAction($actionId, $request) + { + return $this->start()->uri("/api/user/action") ->urlSegment($actionId) ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Changes a user's password using the change password Id. This usually occurs after an email has been sent to the user * and they clicked on a link to reset their password. - * + * * As of version 1.32.2, prefer sending the changePasswordId in the request body. To do this, omit the first parameter, and set * the value in the request body. * @@ -175,14 +177,14 @@ public function cancelAction($actionId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function changePassword($changePasswordId, $request) - { - return $this->startAnonymous()->uri("/api/user/change-password") + public function changePassword($changePasswordId, $request) + { + return $this->startAnonymous()->uri("/api/user/change-password") ->urlSegment($changePasswordId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Changes a user's password using their identity (login id and password). Using a loginId instead of the changePasswordId @@ -194,19 +196,19 @@ public function changePassword($changePasswordId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function changePasswordByIdentity($request) - { - return $this->start()->uri("/api/user/change-password") + public function changePasswordByIdentity($request) + { + return $this->start()->uri("/api/user/change-password") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Check to see if the user must obtain a Trust Token Id in order to complete a change password request. * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change * your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication. - * + * * An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API. * * @param string $changePasswordId The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated. @@ -214,19 +216,19 @@ public function changePasswordByIdentity($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function checkChangePasswordUsingId($changePasswordId) - { - return $this->startAnonymous()->uri("/api/user/change-password") + public function checkChangePasswordUsingId($changePasswordId) + { + return $this->startAnonymous()->uri("/api/user/change-password") ->urlSegment($changePasswordId) ->get() ->go(); - } + } /** * Check to see if the user must obtain a Trust Token Id in order to complete a change password request. * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change * your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication. - * + * * An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API. * * @param string $encodedJWT The encoded JWT (access token). @@ -234,19 +236,19 @@ public function checkChangePasswordUsingId($changePasswordId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function checkChangePasswordUsingJWT($encodedJWT) - { - return $this->startAnonymous()->uri("/api/user/change-password") + public function checkChangePasswordUsingJWT($encodedJWT) + { + return $this->startAnonymous()->uri("/api/user/change-password") ->authorization("Bearer " . $encodedJWT) ->get() ->go(); - } + } /** * Check to see if the user must obtain a Trust Request Id in order to complete a change password request. * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change * your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication. - * + * * An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API. * * @param string $loginId The loginId of the User that you intend to change the password for. @@ -254,13 +256,13 @@ public function checkChangePasswordUsingJWT($encodedJWT) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function checkChangePasswordUsingLoginId($loginId) - { - return $this->start()->uri("/api/user/change-password") + public function checkChangePasswordUsingLoginId($loginId) + { + return $this->start()->uri("/api/user/change-password") ->urlParameter("username", $loginId) ->get() ->go(); - } + } /** * Make a Client Credentials grant request to obtain an access token. @@ -274,19 +276,19 @@ public function checkChangePasswordUsingLoginId($loginId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function clientCredentialsGrant($client_id, $client_secret, $scope = NULL) - { - $post_data = array( - 'client_id' => $client_id, - 'client_secret' => $client_secret, - 'grant_type' => 'client_credentials', - 'scope' => $scope - ); - return $this->startAnonymous()->uri("/oauth2/token") + public function clientCredentialsGrant($client_id, $client_secret, $scope = null) + { + $post_data = array( + 'client_id' => $client_id, + 'client_secret' => $client_secret, + 'grant_type' => 'client_credentials', + 'scope' => $scope + ); + return $this->startAnonymous()->uri("/oauth2/token") ->bodyHandler(new FormDataBodyHandler($post_data)) ->post() ->go(); - } + } /** * Adds a comment to the user's account. @@ -296,13 +298,13 @@ public function clientCredentialsGrant($client_id, $client_secret, $scope = NULL * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function commentOnUser($request) - { - return $this->start()->uri("/api/user/comment") + public function commentOnUser($request) + { + return $this->start()->uri("/api/user/comment") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Complete a WebAuthn authentication ceremony by validating the signature against the previously generated challenge without logging the user in @@ -312,13 +314,13 @@ public function commentOnUser($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function completeWebAuthnAssertion($request) - { - return $this->startAnonymous()->uri("/api/webauthn/assert") + public function completeWebAuthnAssertion($request) + { + return $this->startAnonymous()->uri("/api/webauthn/assert") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Complete a WebAuthn authentication ceremony by validating the signature against the previously generated challenge and then login the user in @@ -328,13 +330,13 @@ public function completeWebAuthnAssertion($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function completeWebAuthnLogin($request) - { - return $this->startAnonymous()->uri("/api/webauthn/login") + public function completeWebAuthnLogin($request) + { + return $this->startAnonymous()->uri("/api/webauthn/login") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Complete a WebAuthn registration ceremony by validating the client request and saving the new credential @@ -344,19 +346,19 @@ public function completeWebAuthnLogin($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function completeWebAuthnRegistration($request) - { - return $this->start()->uri("/api/webauthn/register/complete") + public function completeWebAuthnRegistration($request) + { + return $this->start()->uri("/api/webauthn/register/complete") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates an API key. You can optionally specify a unique Id for the key, if not provided one will be generated. - * an API key can only be created with equal or lesser authority. An API key cannot create another API key unless it is granted + * an API key can only be created with equal or lesser authority. An API key cannot create another API key unless it is granted * to that API key. - * + * * If an API key is locked to a tenant, it can only create API Keys for that same tenant. * * @param string $keyId (Optional) The unique Id of the API key. If not provided a secure random Id will be generated. @@ -365,14 +367,14 @@ public function completeWebAuthnRegistration($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createAPIKey($keyId, $request) - { - return $this->start()->uri("/api/api-key") + public function createAPIKey($keyId, $request) + { + return $this->start()->uri("/api/api-key") ->urlSegment($keyId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates an application. You can optionally specify an Id for the application, if not provided one will be generated. @@ -383,14 +385,14 @@ public function createAPIKey($keyId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createApplication($applicationId, $request) - { - return $this->start()->uri("/api/application") + public function createApplication($applicationId, $request) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a new role for an application. You must specify the id of the application you are creating the role for. @@ -403,16 +405,16 @@ public function createApplication($applicationId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createApplicationRole($applicationId, $roleId, $request) - { - return $this->start()->uri("/api/application") + public function createApplicationRole($applicationId, $roleId, $request) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->urlSegment("role") ->urlSegment($roleId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates an audit log with the message and user name (usually an email). Audit logs should be written anytime you @@ -424,13 +426,13 @@ public function createApplicationRole($applicationId, $roleId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createAuditLog($request) - { - return $this->start()->uri("/api/system/audit-log") + public function createAuditLog($request) + { + return $this->start()->uri("/api/system/audit-log") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a connector. You can optionally specify an Id for the connector, if not provided one will be generated. @@ -441,14 +443,14 @@ public function createAuditLog($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createConnector($connectorId, $request) - { - return $this->start()->uri("/api/connector") + public function createConnector($connectorId, $request) + { + return $this->start()->uri("/api/connector") ->urlSegment($connectorId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a user consent type. You can optionally specify an Id for the consent type, if not provided one will be generated. @@ -459,14 +461,14 @@ public function createConnector($connectorId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createConsent($consentId, $request) - { - return $this->start()->uri("/api/consent") + public function createConsent($consentId, $request) + { + return $this->start()->uri("/api/consent") ->urlSegment($consentId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates an email template. You can optionally specify an Id for the template, if not provided one will be generated. @@ -477,14 +479,14 @@ public function createConsent($consentId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createEmailTemplate($emailTemplateId, $request) - { - return $this->start()->uri("/api/email/template") + public function createEmailTemplate($emailTemplateId, $request) + { + return $this->start()->uri("/api/email/template") ->urlSegment($emailTemplateId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates an Entity. You can optionally specify an Id for the Entity. If not provided one will be generated. @@ -495,14 +497,14 @@ public function createEmailTemplate($emailTemplateId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createEntity($entityId, $request) - { - return $this->start()->uri("/api/entity") + public function createEntity($entityId, $request) + { + return $this->start()->uri("/api/entity") ->urlSegment($entityId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a Entity Type. You can optionally specify an Id for the Entity Type, if not provided one will be generated. @@ -513,14 +515,14 @@ public function createEntity($entityId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createEntityType($entityTypeId, $request) - { - return $this->start()->uri("/api/entity/type") + public function createEntityType($entityTypeId, $request) + { + return $this->start()->uri("/api/entity/type") ->urlSegment($entityTypeId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a new permission for an entity type. You must specify the id of the entity type you are creating the permission for. @@ -533,16 +535,16 @@ public function createEntityType($entityTypeId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createEntityTypePermission($entityTypeId, $permissionId, $request) - { - return $this->start()->uri("/api/entity/type") + public function createEntityTypePermission($entityTypeId, $permissionId, $request) + { + return $this->start()->uri("/api/entity/type") ->urlSegment($entityTypeId) ->urlSegment("permission") ->urlSegment($permissionId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a family with the user id in the request as the owner and sole member of the family. You can optionally specify an id for the @@ -554,14 +556,14 @@ public function createEntityTypePermission($entityTypeId, $permissionId, $reques * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createFamily($familyId, $request) - { - return $this->start()->uri("/api/user/family") + public function createFamily($familyId, $request) + { + return $this->start()->uri("/api/user/family") ->urlSegment($familyId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a form. You can optionally specify an Id for the form, if not provided one will be generated. @@ -572,14 +574,14 @@ public function createFamily($familyId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createForm($formId, $request) - { - return $this->start()->uri("/api/form") + public function createForm($formId, $request) + { + return $this->start()->uri("/api/form") ->urlSegment($formId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a form field. You can optionally specify an Id for the form, if not provided one will be generated. @@ -590,14 +592,14 @@ public function createForm($formId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createFormField($fieldId, $request) - { - return $this->start()->uri("/api/form/field") + public function createFormField($fieldId, $request) + { + return $this->start()->uri("/api/form/field") ->urlSegment($fieldId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a group. You can optionally specify an Id for the group, if not provided one will be generated. @@ -608,14 +610,14 @@ public function createFormField($fieldId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createGroup($groupId, $request) - { - return $this->start()->uri("/api/group") + public function createGroup($groupId, $request) + { + return $this->start()->uri("/api/group") ->urlSegment($groupId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a member in a group. @@ -625,13 +627,13 @@ public function createGroup($groupId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createGroupMembers($request) - { - return $this->start()->uri("/api/group/member") + public function createGroupMembers($request) + { + return $this->start()->uri("/api/group/member") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates an IP Access Control List. You can optionally specify an Id on this create request, if one is not provided one will be generated. @@ -642,14 +644,14 @@ public function createGroupMembers($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createIPAccessControlList($accessControlListId, $request) - { - return $this->start()->uri("/api/ip-acl") + public function createIPAccessControlList($accessControlListId, $request) + { + return $this->start()->uri("/api/ip-acl") ->urlSegment($accessControlListId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates an identity provider. You can optionally specify an Id for the identity provider, if not provided one will be generated. @@ -660,14 +662,14 @@ public function createIPAccessControlList($accessControlListId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createIdentityProvider($identityProviderId, $request) - { - return $this->start()->uri("/api/identity-provider") + public function createIdentityProvider($identityProviderId, $request) + { + return $this->start()->uri("/api/identity-provider") ->urlSegment($identityProviderId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a Lambda. You can optionally specify an Id for the lambda, if not provided one will be generated. @@ -678,14 +680,14 @@ public function createIdentityProvider($identityProviderId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createLambda($lambdaId, $request) - { - return $this->start()->uri("/api/lambda") + public function createLambda($lambdaId, $request) + { + return $this->start()->uri("/api/lambda") ->urlSegment($lambdaId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates an message template. You can optionally specify an Id for the template, if not provided one will be generated. @@ -696,14 +698,14 @@ public function createLambda($lambdaId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createMessageTemplate($messageTemplateId, $request) - { - return $this->start()->uri("/api/message/template") + public function createMessageTemplate($messageTemplateId, $request) + { + return $this->start()->uri("/api/message/template") ->urlSegment($messageTemplateId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a messenger. You can optionally specify an Id for the messenger, if not provided one will be generated. @@ -714,14 +716,14 @@ public function createMessageTemplate($messageTemplateId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createMessenger($messengerId, $request) - { - return $this->start()->uri("/api/messenger") + public function createMessenger($messengerId, $request) + { + return $this->start()->uri("/api/messenger") ->urlSegment($messengerId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a tenant. You can optionally specify an Id for the tenant, if not provided one will be generated. @@ -732,14 +734,14 @@ public function createMessenger($messengerId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createTenant($tenantId, $request) - { - return $this->start()->uri("/api/tenant") + public function createTenant($tenantId, $request) + { + return $this->start()->uri("/api/tenant") ->urlSegment($tenantId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a Theme. You can optionally specify an Id for the theme, if not provided one will be generated. @@ -750,14 +752,14 @@ public function createTenant($tenantId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createTheme($themeId, $request) - { - return $this->start()->uri("/api/theme") + public function createTheme($themeId, $request) + { + return $this->start()->uri("/api/theme") ->urlSegment($themeId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a user. You can optionally specify an Id for the user, if not provided one will be generated. @@ -768,14 +770,14 @@ public function createTheme($themeId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createUser($userId, $request) - { - return $this->start()->uri("/api/user") + public function createUser($userId, $request) + { + return $this->start()->uri("/api/user") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a user action. This action cannot be taken on a user until this call successfully returns. Anytime after @@ -787,14 +789,14 @@ public function createUser($userId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createUserAction($userActionId, $request) - { - return $this->start()->uri("/api/user-action") + public function createUserAction($userActionId, $request) + { + return $this->start()->uri("/api/user-action") ->urlSegment($userActionId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a user reason. This user action reason cannot be used when actioning a user until this call completes @@ -806,14 +808,14 @@ public function createUserAction($userActionId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createUserActionReason($userActionReasonId, $request) - { - return $this->start()->uri("/api/user-action-reason") + public function createUserActionReason($userActionReasonId, $request) + { + return $this->start()->uri("/api/user-action-reason") ->urlSegment($userActionReasonId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a single User consent. @@ -824,14 +826,14 @@ public function createUserActionReason($userActionReasonId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createUserConsent($userConsentId, $request) - { - return $this->start()->uri("/api/user/consent") + public function createUserConsent($userConsentId, $request) + { + return $this->start()->uri("/api/user/consent") ->urlSegment($userConsentId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Link an external user from a 3rd party identity provider to a FusionAuth user. @@ -841,13 +843,13 @@ public function createUserConsent($userConsentId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createUserLink($request) - { - return $this->start()->uri("/api/identity-provider/link") + public function createUserLink($request) + { + return $this->start()->uri("/api/identity-provider/link") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Creates a webhook. You can optionally specify an Id for the webhook, if not provided one will be generated. @@ -858,14 +860,14 @@ public function createUserLink($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createWebhook($webhookId, $request) - { - return $this->start()->uri("/api/webhook") + public function createWebhook($webhookId, $request) + { + return $this->start()->uri("/api/webhook") ->urlSegment($webhookId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Deactivates the application with the given Id. @@ -875,13 +877,13 @@ public function createWebhook($webhookId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deactivateApplication($applicationId) - { - return $this->start()->uri("/api/application") + public function deactivateApplication($applicationId) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->delete() ->go(); - } + } /** * Deactivates the FusionAuth Reactor. @@ -890,12 +892,12 @@ public function deactivateApplication($applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deactivateReactor() - { - return $this->start()->uri("/api/reactor") + public function deactivateReactor() + { + return $this->start()->uri("/api/reactor") ->delete() ->go(); - } + } /** * Deactivates the user with the given Id. @@ -905,13 +907,13 @@ public function deactivateReactor() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deactivateUser($userId) - { - return $this->start()->uri("/api/user") + public function deactivateUser($userId) + { + return $this->start()->uri("/api/user") ->urlSegment($userId) ->delete() ->go(); - } + } /** * Deactivates the user action with the given Id. @@ -921,13 +923,13 @@ public function deactivateUser($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deactivateUserAction($userActionId) - { - return $this->start()->uri("/api/user-action") + public function deactivateUserAction($userActionId) + { + return $this->start()->uri("/api/user-action") ->urlSegment($userActionId) ->delete() ->go(); - } + } /** * Deactivates the users with the given ids. @@ -938,15 +940,15 @@ public function deactivateUserAction($userActionId) * @throws \Exception * @deprecated This method has been renamed to deactivateUsersByIds, use that method instead. */ - public function deactivateUsers($userIds) - { - return $this->start()->uri("/api/user/bulk") + public function deactivateUsers($userIds) + { + return $this->start()->uri("/api/user/bulk") ->urlParameter("userId", $userIds) ->urlParameter("dryRun", false) ->urlParameter("hardDelete", false) ->delete() ->go(); - } + } /** * Deactivates the users with the given ids. @@ -956,15 +958,15 @@ public function deactivateUsers($userIds) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deactivateUsersByIds($userIds) - { - return $this->start()->uri("/api/user/bulk") + public function deactivateUsersByIds($userIds) + { + return $this->start()->uri("/api/user/bulk") ->urlParameter("userId", $userIds) ->urlParameter("dryRun", false) ->urlParameter("hardDelete", false) ->delete() ->go(); - } + } /** * Deletes the API key for the given Id. @@ -974,13 +976,13 @@ public function deactivateUsersByIds($userIds) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteAPIKey($keyId) - { - return $this->start()->uri("/api/api-key") + public function deleteAPIKey($keyId) + { + return $this->start()->uri("/api/api-key") ->urlSegment($keyId) ->delete() ->go(); - } + } /** * Hard deletes an application. This is a dangerous operation and should not be used in most circumstances. This will @@ -993,14 +995,14 @@ public function deleteAPIKey($keyId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteApplication($applicationId) - { - return $this->start()->uri("/api/application") + public function deleteApplication($applicationId) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->urlParameter("hardDelete", true) ->delete() ->go(); - } + } /** * Hard deletes an application role. This is a dangerous operation and should not be used in most circumstances. This @@ -1012,15 +1014,15 @@ public function deleteApplication($applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteApplicationRole($applicationId, $roleId) - { - return $this->start()->uri("/api/application") + public function deleteApplicationRole($applicationId, $roleId) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->urlSegment("role") ->urlSegment($roleId) ->delete() ->go(); - } + } /** * Deletes the connector for the given Id. @@ -1030,13 +1032,13 @@ public function deleteApplicationRole($applicationId, $roleId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteConnector($connectorId) - { - return $this->start()->uri("/api/connector") + public function deleteConnector($connectorId) + { + return $this->start()->uri("/api/connector") ->urlSegment($connectorId) ->delete() ->go(); - } + } /** * Deletes the consent for the given Id. @@ -1046,13 +1048,13 @@ public function deleteConnector($connectorId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteConsent($consentId) - { - return $this->start()->uri("/api/consent") + public function deleteConsent($consentId) + { + return $this->start()->uri("/api/consent") ->urlSegment($consentId) ->delete() ->go(); - } + } /** * Deletes the email template for the given Id. @@ -1062,13 +1064,13 @@ public function deleteConsent($consentId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteEmailTemplate($emailTemplateId) - { - return $this->start()->uri("/api/email/template") + public function deleteEmailTemplate($emailTemplateId) + { + return $this->start()->uri("/api/email/template") ->urlSegment($emailTemplateId) ->delete() ->go(); - } + } /** * Deletes the Entity for the given Id. @@ -1078,13 +1080,13 @@ public function deleteEmailTemplate($emailTemplateId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteEntity($entityId) - { - return $this->start()->uri("/api/entity") + public function deleteEntity($entityId) + { + return $this->start()->uri("/api/entity") ->urlSegment($entityId) ->delete() ->go(); - } + } /** * Deletes an Entity Grant for the given User or Entity. @@ -1096,16 +1098,16 @@ public function deleteEntity($entityId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteEntityGrant($entityId, $recipientEntityId, $userId = NULL) - { - return $this->start()->uri("/api/entity") + public function deleteEntityGrant($entityId, $recipientEntityId, $userId = null) + { + return $this->start()->uri("/api/entity") ->urlSegment($entityId) ->urlSegment("grant") ->urlParameter("recipientEntityId", $recipientEntityId) ->urlParameter("userId", $userId) ->delete() ->go(); - } + } /** * Deletes the Entity Type for the given Id. @@ -1115,13 +1117,13 @@ public function deleteEntityGrant($entityId, $recipientEntityId, $userId = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteEntityType($entityTypeId) - { - return $this->start()->uri("/api/entity/type") + public function deleteEntityType($entityTypeId) + { + return $this->start()->uri("/api/entity/type") ->urlSegment($entityTypeId) ->delete() ->go(); - } + } /** * Hard deletes a permission. This is a dangerous operation and should not be used in most circumstances. This @@ -1133,15 +1135,15 @@ public function deleteEntityType($entityTypeId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteEntityTypePermission($entityTypeId, $permissionId) - { - return $this->start()->uri("/api/entity/type") + public function deleteEntityTypePermission($entityTypeId, $permissionId) + { + return $this->start()->uri("/api/entity/type") ->urlSegment($entityTypeId) ->urlSegment("permission") ->urlSegment($permissionId) ->delete() ->go(); - } + } /** * Deletes the form for the given Id. @@ -1151,13 +1153,13 @@ public function deleteEntityTypePermission($entityTypeId, $permissionId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteForm($formId) - { - return $this->start()->uri("/api/form") + public function deleteForm($formId) + { + return $this->start()->uri("/api/form") ->urlSegment($formId) ->delete() ->go(); - } + } /** * Deletes the form field for the given Id. @@ -1167,13 +1169,13 @@ public function deleteForm($formId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteFormField($fieldId) - { - return $this->start()->uri("/api/form/field") + public function deleteFormField($fieldId) + { + return $this->start()->uri("/api/form/field") ->urlSegment($fieldId) ->delete() ->go(); - } + } /** * Deletes the group for the given Id. @@ -1183,13 +1185,13 @@ public function deleteFormField($fieldId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteGroup($groupId) - { - return $this->start()->uri("/api/group") + public function deleteGroup($groupId) + { + return $this->start()->uri("/api/group") ->urlSegment($groupId) ->delete() ->go(); - } + } /** * Removes users as members of a group. @@ -1199,13 +1201,13 @@ public function deleteGroup($groupId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteGroupMembers($request) - { - return $this->start()->uri("/api/group/member") + public function deleteGroupMembers($request) + { + return $this->start()->uri("/api/group/member") ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Deletes the IP Access Control List for the given Id. @@ -1215,13 +1217,13 @@ public function deleteGroupMembers($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteIPAccessControlList($ipAccessControlListId) - { - return $this->start()->uri("/api/ip-acl") + public function deleteIPAccessControlList($ipAccessControlListId) + { + return $this->start()->uri("/api/ip-acl") ->urlSegment($ipAccessControlListId) ->delete() ->go(); - } + } /** * Deletes the identity provider for the given Id. @@ -1231,13 +1233,13 @@ public function deleteIPAccessControlList($ipAccessControlListId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteIdentityProvider($identityProviderId) - { - return $this->start()->uri("/api/identity-provider") + public function deleteIdentityProvider($identityProviderId) + { + return $this->start()->uri("/api/identity-provider") ->urlSegment($identityProviderId) ->delete() ->go(); - } + } /** * Deletes the key for the given Id. @@ -1247,13 +1249,13 @@ public function deleteIdentityProvider($identityProviderId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteKey($keyId) - { - return $this->start()->uri("/api/key") + public function deleteKey($keyId) + { + return $this->start()->uri("/api/key") ->urlSegment($keyId) ->delete() ->go(); - } + } /** * Deletes the lambda for the given Id. @@ -1263,13 +1265,13 @@ public function deleteKey($keyId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteLambda($lambdaId) - { - return $this->start()->uri("/api/lambda") + public function deleteLambda($lambdaId) + { + return $this->start()->uri("/api/lambda") ->urlSegment($lambdaId) ->delete() ->go(); - } + } /** * Deletes the message template for the given Id. @@ -1279,13 +1281,13 @@ public function deleteLambda($lambdaId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteMessageTemplate($messageTemplateId) - { - return $this->start()->uri("/api/message/template") + public function deleteMessageTemplate($messageTemplateId) + { + return $this->start()->uri("/api/message/template") ->urlSegment($messageTemplateId) ->delete() ->go(); - } + } /** * Deletes the messenger for the given Id. @@ -1295,13 +1297,13 @@ public function deleteMessageTemplate($messageTemplateId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteMessenger($messengerId) - { - return $this->start()->uri("/api/messenger") + public function deleteMessenger($messengerId) + { + return $this->start()->uri("/api/messenger") ->urlSegment($messengerId) ->delete() ->go(); - } + } /** * Deletes the user registration for the given user and application. @@ -1312,14 +1314,14 @@ public function deleteMessenger($messengerId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteRegistration($userId, $applicationId) - { - return $this->start()->uri("/api/user/registration") + public function deleteRegistration($userId, $applicationId) + { + return $this->start()->uri("/api/user/registration") ->urlSegment($userId) ->urlSegment($applicationId) ->delete() ->go(); - } + } /** * Deletes the user registration for the given user and application along with the given JSON body that contains the event information. @@ -1331,15 +1333,15 @@ public function deleteRegistration($userId, $applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteRegistrationWithRequest($userId, $applicationId, $request) - { - return $this->start()->uri("/api/user/registration") + public function deleteRegistrationWithRequest($userId, $applicationId, $request) + { + return $this->start()->uri("/api/user/registration") ->urlSegment($userId) ->urlSegment($applicationId) ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Deletes the tenant based on the given Id on the URL. This permanently deletes all information, metrics, reports and data associated @@ -1350,13 +1352,13 @@ public function deleteRegistrationWithRequest($userId, $applicationId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteTenant($tenantId) - { - return $this->start()->uri("/api/tenant") + public function deleteTenant($tenantId) + { + return $this->start()->uri("/api/tenant") ->urlSegment($tenantId) ->delete() ->go(); - } + } /** * Deletes the tenant for the given Id asynchronously. @@ -1367,14 +1369,14 @@ public function deleteTenant($tenantId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteTenantAsync($tenantId) - { - return $this->start()->uri("/api/tenant") + public function deleteTenantAsync($tenantId) + { + return $this->start()->uri("/api/tenant") ->urlSegment($tenantId) ->urlParameter("async", true) ->delete() ->go(); - } + } /** * Deletes the tenant based on the given request (sent to the API as JSON). This permanently deletes all information, metrics, reports and data associated @@ -1386,14 +1388,14 @@ public function deleteTenantAsync($tenantId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteTenantWithRequest($tenantId, $request) - { - return $this->start()->uri("/api/tenant") + public function deleteTenantWithRequest($tenantId, $request) + { + return $this->start()->uri("/api/tenant") ->urlSegment($tenantId) ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Deletes the theme for the given Id. @@ -1403,13 +1405,13 @@ public function deleteTenantWithRequest($tenantId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteTheme($themeId) - { - return $this->start()->uri("/api/theme") + public function deleteTheme($themeId) + { + return $this->start()->uri("/api/theme") ->urlSegment($themeId) ->delete() ->go(); - } + } /** * Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated @@ -1420,14 +1422,14 @@ public function deleteTheme($themeId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteUser($userId) - { - return $this->start()->uri("/api/user") + public function deleteUser($userId) + { + return $this->start()->uri("/api/user") ->urlSegment($userId) ->urlParameter("hardDelete", true) ->delete() ->go(); - } + } /** * Deletes the user action for the given Id. This permanently deletes the user action and also any history and logs of @@ -1438,14 +1440,14 @@ public function deleteUser($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteUserAction($userActionId) - { - return $this->start()->uri("/api/user-action") + public function deleteUserAction($userActionId) + { + return $this->start()->uri("/api/user-action") ->urlSegment($userActionId) ->urlParameter("hardDelete", true) ->delete() ->go(); - } + } /** * Deletes the user action reason for the given Id. @@ -1455,13 +1457,13 @@ public function deleteUserAction($userActionId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteUserActionReason($userActionReasonId) - { - return $this->start()->uri("/api/user-action-reason") + public function deleteUserActionReason($userActionReasonId) + { + return $this->start()->uri("/api/user-action-reason") ->urlSegment($userActionReasonId) ->delete() ->go(); - } + } /** * Remove an existing link that has been made from a 3rd party identity provider to a FusionAuth user. @@ -1473,15 +1475,15 @@ public function deleteUserActionReason($userActionReasonId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteUserLink($identityProviderId, $identityProviderUserId, $userId) - { - return $this->start()->uri("/api/identity-provider/link") + public function deleteUserLink($identityProviderId, $identityProviderUserId, $userId) + { + return $this->start()->uri("/api/identity-provider/link") ->urlParameter("identityProviderId", $identityProviderId) ->urlParameter("identityProviderUserId", $identityProviderUserId) ->urlParameter("userId", $userId) ->delete() ->go(); - } + } /** * Deletes the user based on the given request (sent to the API as JSON). This permanently deletes all information, metrics, reports and data associated @@ -1493,19 +1495,19 @@ public function deleteUserLink($identityProviderId, $identityProviderUserId, $us * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteUserWithRequest($userId, $request) - { - return $this->start()->uri("/api/user") + public function deleteUserWithRequest($userId, $request) + { + return $this->start()->uri("/api/user") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Deletes the users with the given ids, or users matching the provided JSON query or queryString. * The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request. - * + * * This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body. * Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users. * @@ -1515,18 +1517,18 @@ public function deleteUserWithRequest($userId, $request) * @throws \Exception * @deprecated This method has been renamed to deleteUsersByQuery, use that method instead. */ - public function deleteUsers($request) - { - return $this->start()->uri("/api/user/bulk") + public function deleteUsers($request) + { + return $this->start()->uri("/api/user/bulk") ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Deletes the users with the given ids, or users matching the provided JSON query or queryString. * The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request. - * + * * This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body. * Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users. * @@ -1535,13 +1537,13 @@ public function deleteUsers($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteUsersByQuery($request) - { - return $this->start()->uri("/api/user/bulk") + public function deleteUsersByQuery($request) + { + return $this->start()->uri("/api/user/bulk") ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Deletes the WebAuthn credential for the given Id. @@ -1551,13 +1553,13 @@ public function deleteUsersByQuery($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteWebAuthnCredential($id) - { - return $this->start()->uri("/api/webauthn") + public function deleteWebAuthnCredential($id) + { + return $this->start()->uri("/api/webauthn") ->urlSegment($id) ->delete() ->go(); - } + } /** * Deletes the webhook for the given Id. @@ -1567,13 +1569,13 @@ public function deleteWebAuthnCredential($id) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteWebhook($webhookId) - { - return $this->start()->uri("/api/webhook") + public function deleteWebhook($webhookId) + { + return $this->start()->uri("/api/webhook") ->urlSegment($webhookId) ->delete() ->go(); - } + } /** * Disable two-factor authentication for a user. @@ -1585,15 +1587,15 @@ public function deleteWebhook($webhookId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function disableTwoFactor($userId, $methodId, $code) - { - return $this->start()->uri("/api/user/two-factor") + public function disableTwoFactor($userId, $methodId, $code) + { + return $this->start()->uri("/api/user/two-factor") ->urlSegment($userId) ->urlParameter("methodId", $methodId) ->urlParameter("code", $code) ->delete() ->go(); - } + } /** * Disable two-factor authentication for a user using a JSON body rather than URL parameters. @@ -1604,14 +1606,14 @@ public function disableTwoFactor($userId, $methodId, $code) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function disableTwoFactorWithRequest($userId, $request) - { - return $this->start()->uri("/api/user/two-factor") + public function disableTwoFactorWithRequest($userId, $request) + { + return $this->start()->uri("/api/user/two-factor") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Enable two-factor authentication for a user. @@ -1622,14 +1624,14 @@ public function disableTwoFactorWithRequest($userId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function enableTwoFactor($userId, $request) - { - return $this->start()->uri("/api/user/two-factor") + public function enableTwoFactor($userId, $request) + { + return $this->start()->uri("/api/user/two-factor") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Exchanges an OAuth authorization code for an access token. @@ -1644,20 +1646,20 @@ public function enableTwoFactor($userId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function exchangeOAuthCodeForAccessToken($code, $client_id, $client_secret, $redirect_uri) - { - $post_data = array( - 'code' => $code, - 'client_id' => $client_id, - 'client_secret' => $client_secret, - 'grant_type' => 'authorization_code', - 'redirect_uri' => $redirect_uri - ); - return $this->startAnonymous()->uri("/oauth2/token") + public function exchangeOAuthCodeForAccessToken($code, $client_id, $client_secret, $redirect_uri) + { + $post_data = array( + 'code' => $code, + 'client_id' => $client_id, + 'client_secret' => $client_secret, + 'grant_type' => 'authorization_code', + 'redirect_uri' => $redirect_uri + ); + return $this->startAnonymous()->uri("/oauth2/token") ->bodyHandler(new FormDataBodyHandler($post_data)) ->post() ->go(); - } + } /** * Exchanges an OAuth authorization code and code_verifier for an access token. @@ -1673,21 +1675,21 @@ public function exchangeOAuthCodeForAccessToken($code, $client_id, $client_secre * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function exchangeOAuthCodeForAccessTokenUsingPKCE($code, $client_id, $client_secret, $redirect_uri, $code_verifier) - { - $post_data = array( - 'code' => $code, - 'client_id' => $client_id, - 'client_secret' => $client_secret, - 'grant_type' => 'authorization_code', - 'redirect_uri' => $redirect_uri, - 'code_verifier' => $code_verifier - ); - return $this->startAnonymous()->uri("/oauth2/token") + public function exchangeOAuthCodeForAccessTokenUsingPKCE($code, $client_id, $client_secret, $redirect_uri, $code_verifier) + { + $post_data = array( + 'code' => $code, + 'client_id' => $client_id, + 'client_secret' => $client_secret, + 'grant_type' => 'authorization_code', + 'redirect_uri' => $redirect_uri, + 'code_verifier' => $code_verifier + ); + return $this->startAnonymous()->uri("/oauth2/token") ->bodyHandler(new FormDataBodyHandler($post_data)) ->post() ->go(); - } + } /** * Exchange a Refresh Token for an Access Token. @@ -1703,21 +1705,21 @@ public function exchangeOAuthCodeForAccessTokenUsingPKCE($code, $client_id, $cli * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function exchangeRefreshTokenForAccessToken($refresh_token, $client_id, $client_secret, $scope, $user_code = NULL) - { - $post_data = array( - 'refresh_token' => $refresh_token, - 'client_id' => $client_id, - 'client_secret' => $client_secret, - 'grant_type' => 'refresh_token', - 'scope' => $scope, - 'user_code' => $user_code - ); - return $this->startAnonymous()->uri("/oauth2/token") + public function exchangeRefreshTokenForAccessToken($refresh_token, $client_id, $client_secret, $scope, $user_code = null) + { + $post_data = array( + 'refresh_token' => $refresh_token, + 'client_id' => $client_id, + 'client_secret' => $client_secret, + 'grant_type' => 'refresh_token', + 'scope' => $scope, + 'user_code' => $user_code + ); + return $this->startAnonymous()->uri("/oauth2/token") ->bodyHandler(new FormDataBodyHandler($post_data)) ->post() ->go(); - } + } /** * Exchange a refresh token for a new JWT. @@ -1727,13 +1729,13 @@ public function exchangeRefreshTokenForAccessToken($refresh_token, $client_id, $ * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function exchangeRefreshTokenForJWT($request) - { - return $this->startAnonymous()->uri("/api/jwt/refresh") + public function exchangeRefreshTokenForJWT($request) + { + return $this->startAnonymous()->uri("/api/jwt/refresh") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Exchange User Credentials for a Token. @@ -1750,22 +1752,22 @@ public function exchangeRefreshTokenForJWT($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function exchangeUserCredentialsForAccessToken($username, $password, $client_id, $client_secret, $scope, $user_code = NULL) - { - $post_data = array( - 'username' => $username, - 'password' => $password, - 'client_id' => $client_id, - 'client_secret' => $client_secret, - 'grant_type' => 'password', - 'scope' => $scope, - 'user_code' => $user_code - ); - return $this->startAnonymous()->uri("/oauth2/token") + public function exchangeUserCredentialsForAccessToken($username, $password, $client_id, $client_secret, $scope, $user_code = null) + { + $post_data = array( + 'username' => $username, + 'password' => $password, + 'client_id' => $client_id, + 'client_secret' => $client_secret, + 'grant_type' => 'password', + 'scope' => $scope, + 'user_code' => $user_code + ); + return $this->startAnonymous()->uri("/oauth2/token") ->bodyHandler(new FormDataBodyHandler($post_data)) ->post() ->go(); - } + } /** * Begins the forgot password sequence, which kicks off an email to the user so that they can reset their password. @@ -1775,13 +1777,13 @@ public function exchangeUserCredentialsForAccessToken($username, $password, $cli * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function forgotPassword($request) - { - return $this->start()->uri("/api/user/forgot-password") + public function forgotPassword($request) + { + return $this->start()->uri("/api/user/forgot-password") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Generate a new Email Verification Id to be used with the Verify Email API. This API will not attempt to send an @@ -1792,14 +1794,14 @@ public function forgotPassword($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function generateEmailVerificationId($email) - { - return $this->start()->uri("/api/user/verify-email") + public function generateEmailVerificationId($email) + { + return $this->start()->uri("/api/user/verify-email") ->urlParameter("email", $email) ->urlParameter("sendVerifyEmail", false) ->put() ->go(); - } + } /** * Generate a new RSA or EC key pair or an HMAC secret. @@ -1810,14 +1812,14 @@ public function generateEmailVerificationId($email) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function generateKey($keyId, $request) - { - return $this->start()->uri("/api/key/generate") + public function generateKey($keyId, $request) + { + return $this->start()->uri("/api/key/generate") ->urlSegment($keyId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Generate a new Application Registration Verification Id to be used with the Verify Registration API. This API will not attempt to send an @@ -1829,31 +1831,31 @@ public function generateKey($keyId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function generateRegistrationVerificationId($email, $applicationId) - { - return $this->start()->uri("/api/user/verify-registration") + public function generateRegistrationVerificationId($email, $applicationId) + { + return $this->start()->uri("/api/user/verify-registration") ->urlParameter("email", $email) ->urlParameter("sendVerifyPasswordEmail", false) ->urlParameter("applicationId", $applicationId) ->put() ->go(); - } + } /** - * Generate two-factor recovery codes for a user. Generating two-factor recovery codes will invalidate any existing recovery codes. + * Generate two-factor recovery codes for a user. Generating two-factor recovery codes will invalidate any existing recovery codes. * * @param string $userId The Id of the user to generate new Two Factor recovery codes. * * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function generateTwoFactorRecoveryCodes($userId) - { - return $this->start()->uri("/api/user/two-factor/recovery-code") + public function generateTwoFactorRecoveryCodes($userId) + { + return $this->start()->uri("/api/user/two-factor/recovery-code") ->urlSegment($userId) ->post() ->go(); - } + } /** * Generate a Two Factor secret that can be used to enable Two Factor authentication for a User. The response will contain @@ -1864,12 +1866,12 @@ public function generateTwoFactorRecoveryCodes($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function generateTwoFactorSecret() - { - return $this->start()->uri("/api/two-factor/secret") + public function generateTwoFactorSecret() + { + return $this->start()->uri("/api/two-factor/secret") ->get() ->go(); - } + } /** * Generate a Two Factor secret that can be used to enable Two Factor authentication for a User. The response will contain @@ -1881,13 +1883,13 @@ public function generateTwoFactorSecret() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function generateTwoFactorSecretUsingJWT($encodedJWT) - { - return $this->startAnonymous()->uri("/api/two-factor/secret") + public function generateTwoFactorSecretUsingJWT($encodedJWT) + { + return $this->startAnonymous()->uri("/api/two-factor/secret") ->authorization("Bearer " . $encodedJWT) ->get() ->go(); - } + } /** * Handles login via third-parties including Social login, external OAuth and OpenID Connect, and other @@ -1899,13 +1901,13 @@ public function generateTwoFactorSecretUsingJWT($encodedJWT) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function identityProviderLogin($request) - { - return $this->startAnonymous()->uri("/api/identity-provider/login") + public function identityProviderLogin($request) + { + return $this->startAnonymous()->uri("/api/identity-provider/login") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Import an existing RSA or EC key pair or an HMAC secret. @@ -1916,20 +1918,20 @@ public function identityProviderLogin($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function importKey($keyId, $request) - { - return $this->start()->uri("/api/key/import") + public function importKey($keyId, $request) + { + return $this->start()->uri("/api/key/import") ->urlSegment($keyId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Bulk imports refresh tokens. This request performs minimal validation and runs batch inserts of refresh tokens with the * expectation that each token represents a user that already exists and is registered for the corresponding FusionAuth * Application. This is done to increases the insert performance. - * + * * Therefore, if you encounter an error due to a database key violation, the response will likely offer a generic * explanation. If you encounter an error, you may optionally enable additional validation to receive a JSON response * body with specific validation errors. This will slow the request down but will allow you to identify the cause of @@ -1940,19 +1942,19 @@ public function importKey($keyId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function importRefreshTokens($request) - { - return $this->start()->uri("/api/user/refresh-token/import") + public function importRefreshTokens($request) + { + return $this->start()->uri("/api/user/refresh-token/import") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Bulk imports users. This request performs minimal validation and runs batch inserts of users with the expectation * that each user does not yet exist and each registration corresponds to an existing FusionAuth Application. This is done to * increases the insert performance. - * + * * Therefore, if you encounter an error due to a database key violation, the response will likely offer * a generic explanation. If you encounter an error, you may optionally enable additional validation to receive a JSON response * body with specific validation errors. This will slow the request down but will allow you to identify the cause of the failure. See @@ -1963,13 +1965,13 @@ public function importRefreshTokens($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function importUsers($request) - { - return $this->start()->uri("/api/user/import") + public function importUsers($request) + { + return $this->start()->uri("/api/user/import") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Import a WebAuthn credential @@ -1979,13 +1981,13 @@ public function importUsers($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function importWebAuthnCredential($request) - { - return $this->start()->uri("/api/webauthn/import") + public function importWebAuthnCredential($request) + { + return $this->start()->uri("/api/webauthn/import") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Inspect an access token issued as the result of the User based grant such as the Authorization Code Grant, Implicit Grant, the User Credentials Grant or the Refresh Grant. @@ -1996,17 +1998,17 @@ public function importWebAuthnCredential($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function introspectAccessToken($client_id, $token) - { - $post_data = array( - 'client_id' => $client_id, - 'token' => $token - ); - return $this->startAnonymous()->uri("/oauth2/introspect") + public function introspectAccessToken($client_id, $token) + { + $post_data = array( + 'client_id' => $client_id, + 'token' => $token + ); + return $this->startAnonymous()->uri("/oauth2/introspect") ->bodyHandler(new FormDataBodyHandler($post_data)) ->post() ->go(); - } + } /** * Inspect an access token issued as the result of the Client Credentials Grant. @@ -2016,16 +2018,16 @@ public function introspectAccessToken($client_id, $token) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function introspectClientCredentialsAccessToken($token) - { - $post_data = array( - 'token' => $token - ); - return $this->startAnonymous()->uri("/oauth2/introspect") + public function introspectClientCredentialsAccessToken($token) + { + $post_data = array( + 'token' => $token + ); + return $this->startAnonymous()->uri("/oauth2/introspect") ->bodyHandler(new FormDataBodyHandler($post_data)) ->post() ->go(); - } + } /** * Issue a new access token (JWT) for the requested Application after ensuring the provided JWT is valid. A valid @@ -2043,19 +2045,19 @@ public function introspectClientCredentialsAccessToken($token) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function issueJWT($applicationId, $encodedJWT, $refreshToken = NULL) - { - return $this->startAnonymous()->uri("/api/jwt/issue") + public function issueJWT($applicationId, $encodedJWT, $refreshToken = null) + { + return $this->startAnonymous()->uri("/api/jwt/issue") ->authorization("Bearer " . $encodedJWT) ->urlParameter("applicationId", $applicationId) ->urlParameter("refreshToken", $refreshToken) ->get() ->go(); - } + } /** - * Authenticates a user to FusionAuth. - * + * Authenticates a user to FusionAuth. + * * This API optionally requires an API key. See Application.loginConfiguration.requireAuthentication. * * @param array $request The login request that contains the user credentials used to log them in. @@ -2063,13 +2065,13 @@ public function issueJWT($applicationId, $encodedJWT, $refreshToken = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function login($request) - { - return $this->start()->uri("/api/login") + public function login($request) + { + return $this->start()->uri("/api/login") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Sends a ping to FusionAuth indicating that the user was automatically logged into an application. When using @@ -2085,15 +2087,15 @@ public function login($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function loginPing($userId, $applicationId, $callerIPAddress = NULL) - { - return $this->start()->uri("/api/login") + public function loginPing($userId, $applicationId, $callerIPAddress = null) + { + return $this->start()->uri("/api/login") ->urlSegment($userId) ->urlSegment($applicationId) ->urlParameter("ipAddress", $callerIPAddress) ->put() ->go(); - } + } /** * Sends a ping to FusionAuth indicating that the user was automatically logged into an application. When using @@ -2106,13 +2108,13 @@ public function loginPing($userId, $applicationId, $callerIPAddress = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function loginPingWithRequest($request) - { - return $this->start()->uri("/api/login") + public function loginPingWithRequest($request) + { + return $this->start()->uri("/api/login") ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * The Logout API is intended to be used to remove the refresh token and access token cookies if they exist on the @@ -2127,14 +2129,14 @@ public function loginPingWithRequest($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function logout($global, $refreshToken = NULL) - { - return $this->startAnonymous()->uri("/api/logout") + public function logout($global, $refreshToken = null) + { + return $this->startAnonymous()->uri("/api/logout") ->urlParameter("global", $global) ->urlParameter("refreshToken", $refreshToken) ->post() ->go(); - } + } /** * The Logout API is intended to be used to remove the refresh token and access token cookies if they exist on the @@ -2145,13 +2147,13 @@ public function logout($global, $refreshToken = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function logoutWithRequest($request) - { - return $this->startAnonymous()->uri("/api/logout") + public function logoutWithRequest($request) + { + return $this->startAnonymous()->uri("/api/logout") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Retrieves the identity provider for the given domain. A 200 response code indicates the domain is managed @@ -2162,13 +2164,13 @@ public function logoutWithRequest($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function lookupIdentityProvider($domain) - { - return $this->start()->uri("/api/identity-provider/lookup") + public function lookupIdentityProvider($domain) + { + return $this->start()->uri("/api/identity-provider/lookup") ->urlParameter("domain", $domain) ->get() ->go(); - } + } /** * Modifies a temporal user action by changing the expiration of the action and optionally adding a comment to the @@ -2180,14 +2182,14 @@ public function lookupIdentityProvider($domain) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function modifyAction($actionId, $request) - { - return $this->start()->uri("/api/user/action") + public function modifyAction($actionId, $request) + { + return $this->start()->uri("/api/user/action") ->urlSegment($actionId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Complete a login request using a passwordless code @@ -2197,13 +2199,13 @@ public function modifyAction($actionId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function passwordlessLogin($request) - { - return $this->startAnonymous()->uri("/api/passwordless/login") + public function passwordlessLogin($request) + { + return $this->startAnonymous()->uri("/api/passwordless/login") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Updates an authentication API key by given id @@ -2214,14 +2216,14 @@ public function passwordlessLogin($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchAPIKey($keyId, $request) - { - return $this->start()->uri("/api/api-key") + public function patchAPIKey($keyId, $request) + { + return $this->start()->uri("/api/api-key") ->urlSegment($keyId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Updates, via PATCH, the application with the given Id. @@ -2232,14 +2234,14 @@ public function patchAPIKey($keyId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchApplication($applicationId, $request) - { - return $this->start()->uri("/api/application") + public function patchApplication($applicationId, $request) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the application role with the given id for the application. @@ -2251,16 +2253,16 @@ public function patchApplication($applicationId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchApplicationRole($applicationId, $roleId, $request) - { - return $this->start()->uri("/api/application") + public function patchApplicationRole($applicationId, $roleId, $request) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->urlSegment("role") ->urlSegment($roleId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the connector with the given Id. @@ -2271,14 +2273,14 @@ public function patchApplicationRole($applicationId, $roleId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchConnector($connectorId, $request) - { - return $this->start()->uri("/api/connector") + public function patchConnector($connectorId, $request) + { + return $this->start()->uri("/api/connector") ->urlSegment($connectorId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the consent with the given Id. @@ -2289,14 +2291,14 @@ public function patchConnector($connectorId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchConsent($consentId, $request) - { - return $this->start()->uri("/api/consent") + public function patchConsent($consentId, $request) + { + return $this->start()->uri("/api/consent") ->urlSegment($consentId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the email template with the given Id. @@ -2307,14 +2309,14 @@ public function patchConsent($consentId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchEmailTemplate($emailTemplateId, $request) - { - return $this->start()->uri("/api/email/template") + public function patchEmailTemplate($emailTemplateId, $request) + { + return $this->start()->uri("/api/email/template") ->urlSegment($emailTemplateId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the Entity Type with the given Id. @@ -2325,14 +2327,14 @@ public function patchEmailTemplate($emailTemplateId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchEntityType($entityTypeId, $request) - { - return $this->start()->uri("/api/entity/type") + public function patchEntityType($entityTypeId, $request) + { + return $this->start()->uri("/api/entity/type") ->urlSegment($entityTypeId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the group with the given Id. @@ -2343,14 +2345,14 @@ public function patchEntityType($entityTypeId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchGroup($groupId, $request) - { - return $this->start()->uri("/api/group") + public function patchGroup($groupId, $request) + { + return $this->start()->uri("/api/group") ->urlSegment($groupId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the identity provider with the given Id. @@ -2361,14 +2363,14 @@ public function patchGroup($groupId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchIdentityProvider($identityProviderId, $request) - { - return $this->start()->uri("/api/identity-provider") + public function patchIdentityProvider($identityProviderId, $request) + { + return $this->start()->uri("/api/identity-provider") ->urlSegment($identityProviderId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the available integrations. @@ -2378,13 +2380,13 @@ public function patchIdentityProvider($identityProviderId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchIntegrations($request) - { - return $this->start()->uri("/api/integration") + public function patchIntegrations($request) + { + return $this->start()->uri("/api/integration") ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the lambda with the given Id. @@ -2395,14 +2397,14 @@ public function patchIntegrations($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchLambda($lambdaId, $request) - { - return $this->start()->uri("/api/lambda") + public function patchLambda($lambdaId, $request) + { + return $this->start()->uri("/api/lambda") ->urlSegment($lambdaId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the message template with the given Id. @@ -2413,14 +2415,14 @@ public function patchLambda($lambdaId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchMessageTemplate($messageTemplateId, $request) - { - return $this->start()->uri("/api/message/template") + public function patchMessageTemplate($messageTemplateId, $request) + { + return $this->start()->uri("/api/message/template") ->urlSegment($messageTemplateId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the messenger with the given Id. @@ -2431,14 +2433,14 @@ public function patchMessageTemplate($messageTemplateId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchMessenger($messengerId, $request) - { - return $this->start()->uri("/api/messenger") + public function patchMessenger($messengerId, $request) + { + return $this->start()->uri("/api/messenger") ->urlSegment($messengerId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the registration for the user with the given id and the application defined in the request. @@ -2449,14 +2451,14 @@ public function patchMessenger($messengerId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchRegistration($userId, $request) - { - return $this->start()->uri("/api/user/registration") + public function patchRegistration($userId, $request) + { + return $this->start()->uri("/api/user/registration") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the system configuration. @@ -2466,13 +2468,13 @@ public function patchRegistration($userId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchSystemConfiguration($request) - { - return $this->start()->uri("/api/system-configuration") + public function patchSystemConfiguration($request) + { + return $this->start()->uri("/api/system-configuration") ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the tenant with the given Id. @@ -2483,14 +2485,14 @@ public function patchSystemConfiguration($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchTenant($tenantId, $request) - { - return $this->start()->uri("/api/tenant") + public function patchTenant($tenantId, $request) + { + return $this->start()->uri("/api/tenant") ->urlSegment($tenantId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the theme with the given Id. @@ -2501,14 +2503,14 @@ public function patchTenant($tenantId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchTheme($themeId, $request) - { - return $this->start()->uri("/api/theme") + public function patchTheme($themeId, $request) + { + return $this->start()->uri("/api/theme") ->urlSegment($themeId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the user with the given Id. @@ -2519,14 +2521,14 @@ public function patchTheme($themeId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchUser($userId, $request) - { - return $this->start()->uri("/api/user") + public function patchUser($userId, $request) + { + return $this->start()->uri("/api/user") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the user action with the given Id. @@ -2537,14 +2539,14 @@ public function patchUser($userId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchUserAction($userActionId, $request) - { - return $this->start()->uri("/api/user-action") + public function patchUserAction($userActionId, $request) + { + return $this->start()->uri("/api/user-action") ->urlSegment($userActionId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, the user action reason with the given Id. @@ -2555,14 +2557,14 @@ public function patchUserAction($userActionId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchUserActionReason($userActionReasonId, $request) - { - return $this->start()->uri("/api/user-action-reason") + public function patchUserActionReason($userActionReasonId, $request) + { + return $this->start()->uri("/api/user-action-reason") ->urlSegment($userActionReasonId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Updates, via PATCH, a single User consent by Id. @@ -2573,14 +2575,14 @@ public function patchUserActionReason($userActionReasonId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function patchUserConsent($userConsentId, $request) - { - return $this->start()->uri("/api/user/consent") + public function patchUserConsent($userConsentId, $request) + { + return $this->start()->uri("/api/user/consent") ->urlSegment($userConsentId) ->bodyHandler(new JSONBodyHandler($request)) ->patch() ->go(); - } + } /** * Reactivates the application with the given Id. @@ -2590,14 +2592,14 @@ public function patchUserConsent($userConsentId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function reactivateApplication($applicationId) - { - return $this->start()->uri("/api/application") + public function reactivateApplication($applicationId) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->urlParameter("reactivate", true) ->put() ->go(); - } + } /** * Reactivates the user with the given Id. @@ -2607,14 +2609,14 @@ public function reactivateApplication($applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function reactivateUser($userId) - { - return $this->start()->uri("/api/user") + public function reactivateUser($userId) + { + return $this->start()->uri("/api/user") ->urlSegment($userId) ->urlParameter("reactivate", true) ->put() ->go(); - } + } /** * Reactivates the user action with the given Id. @@ -2624,14 +2626,14 @@ public function reactivateUser($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function reactivateUserAction($userActionId) - { - return $this->start()->uri("/api/user-action") + public function reactivateUserAction($userActionId) + { + return $this->start()->uri("/api/user-action") ->urlSegment($userActionId) ->urlParameter("reactivate", true) ->put() ->go(); - } + } /** * Reconcile a User to FusionAuth using JWT issued from another Identity Provider. @@ -2641,17 +2643,17 @@ public function reactivateUserAction($userActionId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function reconcileJWT($request) - { - return $this->startAnonymous()->uri("/api/jwt/reconcile") + public function reconcileJWT($request) + { + return $this->startAnonymous()->uri("/api/jwt/reconcile") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Request a refresh of the Entity search index. This API is not generally necessary and the search index will become consistent in a - * reasonable amount of time. There may be scenarios where you may wish to manually request an index refresh. One example may be + * reasonable amount of time. There may be scenarios where you may wish to manually request an index refresh. One example may be * if you are using the Search API or Delete Tenant API immediately following a Entity Create etc, you may wish to request a refresh to * ensure the index immediately current before making a query request to the search index. * @@ -2659,16 +2661,16 @@ public function reconcileJWT($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function refreshEntitySearchIndex() - { - return $this->start()->uri("/api/entity/search") + public function refreshEntitySearchIndex() + { + return $this->start()->uri("/api/entity/search") ->put() ->go(); - } + } /** * Request a refresh of the User search index. This API is not generally necessary and the search index will become consistent in a - * reasonable amount of time. There may be scenarios where you may wish to manually request an index refresh. One example may be + * reasonable amount of time. There may be scenarios where you may wish to manually request an index refresh. One example may be * if you are using the Search API or Delete Tenant API immediately following a User Create etc, you may wish to request a refresh to * ensure the index immediately current before making a query request to the search index. * @@ -2676,12 +2678,12 @@ public function refreshEntitySearchIndex() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function refreshUserSearchIndex() - { - return $this->start()->uri("/api/user/search") + public function refreshUserSearchIndex() + { + return $this->start()->uri("/api/user/search") ->put() ->go(); - } + } /** * Regenerates any keys that are used by the FusionAuth Reactor. @@ -2690,12 +2692,12 @@ public function refreshUserSearchIndex() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function regenerateReactorKeys() - { - return $this->start()->uri("/api/reactor") + public function regenerateReactorKeys() + { + return $this->start()->uri("/api/reactor") ->put() ->go(); - } + } /** * Registers a user for an application. If you provide the User and the UserRegistration object on this request, it @@ -2710,20 +2712,20 @@ public function regenerateReactorKeys() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function register($userId, $request) - { - return $this->start()->uri("/api/user/registration") + public function register($userId, $request) + { + return $this->start()->uri("/api/user/registration") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** - * Requests Elasticsearch to delete and rebuild the index for FusionAuth users or entities. Be very careful when running this request as it will - * increase the CPU and I/O load on your database until the operation completes. Generally speaking you do not ever need to run this operation unless - * instructed by FusionAuth support, or if you are migrating a database another system and you are not brining along the Elasticsearch index. - * + * Requests Elasticsearch to delete and rebuild the index for FusionAuth users or entities. Be very careful when running this request as it will + * increase the CPU and I/O load on your database until the operation completes. Generally speaking you do not ever need to run this operation unless + * instructed by FusionAuth support, or if you are migrating a database another system and you are not brining along the Elasticsearch index. + * * You have been warned. * * @param array $request The request that contains the index name. @@ -2731,13 +2733,13 @@ public function register($userId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function reindex($request) - { - return $this->start()->uri("/api/system/reindex") + public function reindex($request) + { + return $this->start()->uri("/api/system/reindex") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Removes a user from the family with the given id. @@ -2748,14 +2750,14 @@ public function reindex($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function removeUserFromFamily($familyId, $userId) - { - return $this->start()->uri("/api/user/family") + public function removeUserFromFamily($familyId, $userId) + { + return $this->start()->uri("/api/user/family") ->urlSegment($familyId) ->urlSegment($userId) ->delete() ->go(); - } + } /** * Re-sends the verification email to the user. @@ -2765,13 +2767,13 @@ public function removeUserFromFamily($familyId, $userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function resendEmailVerification($email) - { - return $this->start()->uri("/api/user/verify-email") + public function resendEmailVerification($email) + { + return $this->start()->uri("/api/user/verify-email") ->urlParameter("email", $email) ->put() ->go(); - } + } /** * Re-sends the verification email to the user. If the Application has configured a specific email template this will be used @@ -2783,14 +2785,14 @@ public function resendEmailVerification($email) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function resendEmailVerificationWithApplicationTemplate($applicationId, $email) - { - return $this->start()->uri("/api/user/verify-email") + public function resendEmailVerificationWithApplicationTemplate($applicationId, $email) + { + return $this->start()->uri("/api/user/verify-email") ->urlParameter("applicationId", $applicationId) ->urlParameter("email", $email) ->put() ->go(); - } + } /** * Re-sends the application registration verification email to the user. @@ -2801,14 +2803,14 @@ public function resendEmailVerificationWithApplicationTemplate($applicationId, $ * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function resendRegistrationVerification($email, $applicationId) - { - return $this->start()->uri("/api/user/verify-registration") + public function resendRegistrationVerification($email, $applicationId) + { + return $this->start()->uri("/api/user/verify-registration") ->urlParameter("email", $email) ->urlParameter("applicationId", $applicationId) ->put() ->go(); - } + } /** * Retrieves an authentication API key for the given id @@ -2818,13 +2820,13 @@ public function resendRegistrationVerification($email, $applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveAPIKey($keyId) - { - return $this->start()->uri("/api/api-key") + public function retrieveAPIKey($keyId) + { + return $this->start()->uri("/api/api-key") ->urlSegment($keyId) ->get() ->go(); - } + } /** * Retrieves a single action log (the log of a user action that was taken on a user previously) for the given Id. @@ -2834,13 +2836,13 @@ public function retrieveAPIKey($keyId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveAction($actionId) - { - return $this->start()->uri("/api/user/action") + public function retrieveAction($actionId) + { + return $this->start()->uri("/api/user/action") ->urlSegment($actionId) ->get() ->go(); - } + } /** * Retrieves all the actions for the user with the given Id. This will return all time based actions that are active, @@ -2851,13 +2853,13 @@ public function retrieveAction($actionId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveActions($userId) - { - return $this->start()->uri("/api/user/action") + public function retrieveActions($userId) + { + return $this->start()->uri("/api/user/action") ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Retrieves all the actions for the user with the given Id that are currently preventing the User from logging in. @@ -2867,14 +2869,14 @@ public function retrieveActions($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveActionsPreventingLogin($userId) - { - return $this->start()->uri("/api/user/action") + public function retrieveActionsPreventingLogin($userId) + { + return $this->start()->uri("/api/user/action") ->urlParameter("userId", $userId) ->urlParameter("preventingLogin", true) ->get() ->go(); - } + } /** * Retrieves all the actions for the user with the given Id that are currently active. @@ -2885,14 +2887,14 @@ public function retrieveActionsPreventingLogin($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveActiveActions($userId) - { - return $this->start()->uri("/api/user/action") + public function retrieveActiveActions($userId) + { + return $this->start()->uri("/api/user/action") ->urlParameter("userId", $userId) ->urlParameter("active", true) ->get() ->go(); - } + } /** * Retrieves the application for the given id or all the applications if the id is null. @@ -2902,13 +2904,13 @@ public function retrieveActiveActions($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveApplication($applicationId = NULL) - { - return $this->start()->uri("/api/application") + public function retrieveApplication($applicationId = null) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->get() ->go(); - } + } /** * Retrieves all the applications. @@ -2917,12 +2919,12 @@ public function retrieveApplication($applicationId = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveApplications() - { - return $this->start()->uri("/api/application") + public function retrieveApplications() + { + return $this->start()->uri("/api/application") ->get() ->go(); - } + } /** * Retrieves a single audit log for the given Id. @@ -2932,13 +2934,13 @@ public function retrieveApplications() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveAuditLog($auditLogId) - { - return $this->start()->uri("/api/system/audit-log") + public function retrieveAuditLog($auditLogId) + { + return $this->start()->uri("/api/system/audit-log") ->urlSegment($auditLogId) ->get() ->go(); - } + } /** * Retrieves the connector with the given Id. @@ -2948,13 +2950,13 @@ public function retrieveAuditLog($auditLogId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveConnector($connectorId) - { - return $this->start()->uri("/api/connector") + public function retrieveConnector($connectorId) + { + return $this->start()->uri("/api/connector") ->urlSegment($connectorId) ->get() ->go(); - } + } /** * Retrieves all the connectors. @@ -2963,12 +2965,12 @@ public function retrieveConnector($connectorId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveConnectors() - { - return $this->start()->uri("/api/connector") + public function retrieveConnectors() + { + return $this->start()->uri("/api/connector") ->get() ->go(); - } + } /** * Retrieves the Consent for the given Id. @@ -2978,13 +2980,13 @@ public function retrieveConnectors() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveConsent($consentId) - { - return $this->start()->uri("/api/consent") + public function retrieveConsent($consentId) + { + return $this->start()->uri("/api/consent") ->urlSegment($consentId) ->get() ->go(); - } + } /** * Retrieves all the consent. @@ -2993,12 +2995,12 @@ public function retrieveConsent($consentId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveConsents() - { - return $this->start()->uri("/api/consent") + public function retrieveConsents() + { + return $this->start()->uri("/api/consent") ->get() ->go(); - } + } /** * Retrieves the daily active user report between the two instants. If you specify an application id, it will only @@ -3011,15 +3013,15 @@ public function retrieveConsents() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveDailyActiveReport($applicationId, $start, $end) - { - return $this->start()->uri("/api/report/daily-active-user") + public function retrieveDailyActiveReport($applicationId, $start, $end) + { + return $this->start()->uri("/api/report/daily-active-user") ->urlParameter("applicationId", $applicationId) ->urlParameter("start", $start) ->urlParameter("end", $end) ->get() ->go(); - } + } /** * Retrieves the email template for the given Id. If you don't specify the id, this will return all the email templates. @@ -3029,13 +3031,13 @@ public function retrieveDailyActiveReport($applicationId, $start, $end) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveEmailTemplate($emailTemplateId = NULL) - { - return $this->start()->uri("/api/email/template") + public function retrieveEmailTemplate($emailTemplateId = null) + { + return $this->start()->uri("/api/email/template") ->urlSegment($emailTemplateId) ->get() ->go(); - } + } /** * Creates a preview of the email template provided in the request. This allows you to preview an email template that @@ -3047,13 +3049,13 @@ public function retrieveEmailTemplate($emailTemplateId = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveEmailTemplatePreview($request) - { - return $this->start()->uri("/api/email/template/preview") + public function retrieveEmailTemplatePreview($request) + { + return $this->start()->uri("/api/email/template/preview") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Retrieves all the email templates. @@ -3062,12 +3064,12 @@ public function retrieveEmailTemplatePreview($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveEmailTemplates() - { - return $this->start()->uri("/api/email/template") + public function retrieveEmailTemplates() + { + return $this->start()->uri("/api/email/template") ->get() ->go(); - } + } /** * Retrieves the Entity for the given Id. @@ -3077,13 +3079,13 @@ public function retrieveEmailTemplates() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveEntity($entityId) - { - return $this->start()->uri("/api/entity") + public function retrieveEntity($entityId) + { + return $this->start()->uri("/api/entity") ->urlSegment($entityId) ->get() ->go(); - } + } /** * Retrieves an Entity Grant for the given Entity and User/Entity. @@ -3095,16 +3097,16 @@ public function retrieveEntity($entityId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveEntityGrant($entityId, $recipientEntityId, $userId = NULL) - { - return $this->start()->uri("/api/entity") + public function retrieveEntityGrant($entityId, $recipientEntityId, $userId = null) + { + return $this->start()->uri("/api/entity") ->urlSegment($entityId) ->urlSegment("grant") ->urlParameter("recipientEntityId", $recipientEntityId) ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Retrieves the Entity Type for the given Id. @@ -3114,13 +3116,13 @@ public function retrieveEntityGrant($entityId, $recipientEntityId, $userId = NUL * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveEntityType($entityTypeId) - { - return $this->start()->uri("/api/entity/type") + public function retrieveEntityType($entityTypeId) + { + return $this->start()->uri("/api/entity/type") ->urlSegment($entityTypeId) ->get() ->go(); - } + } /** * Retrieves all the Entity Types. @@ -3129,12 +3131,12 @@ public function retrieveEntityType($entityTypeId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveEntityTypes() - { - return $this->start()->uri("/api/entity/type") + public function retrieveEntityTypes() + { + return $this->start()->uri("/api/entity/type") ->get() ->go(); - } + } /** * Retrieves a single event log for the given Id. @@ -3144,13 +3146,13 @@ public function retrieveEntityTypes() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveEventLog($eventLogId) - { - return $this->start()->uri("/api/system/event-log") + public function retrieveEventLog($eventLogId) + { + return $this->start()->uri("/api/system/event-log") ->urlSegment($eventLogId) ->get() ->go(); - } + } /** * Retrieves all the families that a user belongs to. @@ -3160,13 +3162,13 @@ public function retrieveEventLog($eventLogId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveFamilies($userId) - { - return $this->start()->uri("/api/user/family") + public function retrieveFamilies($userId) + { + return $this->start()->uri("/api/user/family") ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Retrieves all the members of a family by the unique Family Id. @@ -3176,13 +3178,13 @@ public function retrieveFamilies($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveFamilyMembersByFamilyId($familyId) - { - return $this->start()->uri("/api/user/family") + public function retrieveFamilyMembersByFamilyId($familyId) + { + return $this->start()->uri("/api/user/family") ->urlSegment($familyId) ->get() ->go(); - } + } /** * Retrieves the form with the given Id. @@ -3192,13 +3194,13 @@ public function retrieveFamilyMembersByFamilyId($familyId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveForm($formId) - { - return $this->start()->uri("/api/form") + public function retrieveForm($formId) + { + return $this->start()->uri("/api/form") ->urlSegment($formId) ->get() ->go(); - } + } /** * Retrieves the form field with the given Id. @@ -3208,13 +3210,13 @@ public function retrieveForm($formId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveFormField($fieldId) - { - return $this->start()->uri("/api/form/field") + public function retrieveFormField($fieldId) + { + return $this->start()->uri("/api/form/field") ->urlSegment($fieldId) ->get() ->go(); - } + } /** * Retrieves all the forms fields @@ -3223,12 +3225,12 @@ public function retrieveFormField($fieldId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveFormFields() - { - return $this->start()->uri("/api/form/field") + public function retrieveFormFields() + { + return $this->start()->uri("/api/form/field") ->get() ->go(); - } + } /** * Retrieves all the forms. @@ -3237,12 +3239,12 @@ public function retrieveFormFields() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveForms() - { - return $this->start()->uri("/api/form") + public function retrieveForms() + { + return $this->start()->uri("/api/form") ->get() ->go(); - } + } /** * Retrieves the group for the given Id. @@ -3252,13 +3254,13 @@ public function retrieveForms() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveGroup($groupId) - { - return $this->start()->uri("/api/group") + public function retrieveGroup($groupId) + { + return $this->start()->uri("/api/group") ->urlSegment($groupId) ->get() ->go(); - } + } /** * Retrieves all the groups. @@ -3267,12 +3269,12 @@ public function retrieveGroup($groupId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveGroups() - { - return $this->start()->uri("/api/group") + public function retrieveGroups() + { + return $this->start()->uri("/api/group") ->get() ->go(); - } + } /** * Retrieves the IP Access Control List with the given Id. @@ -3282,13 +3284,13 @@ public function retrieveGroups() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveIPAccessControlList($ipAccessControlListId) - { - return $this->start()->uri("/api/ip-acl") + public function retrieveIPAccessControlList($ipAccessControlListId) + { + return $this->start()->uri("/api/ip-acl") ->urlSegment($ipAccessControlListId) ->get() ->go(); - } + } /** * Retrieves the identity provider for the given id or all the identity providers if the id is null. @@ -3298,17 +3300,17 @@ public function retrieveIPAccessControlList($ipAccessControlListId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveIdentityProvider($identityProviderId) - { - return $this->start()->uri("/api/identity-provider") + public function retrieveIdentityProvider($identityProviderId) + { + return $this->start()->uri("/api/identity-provider") ->urlSegment($identityProviderId) ->get() ->go(); - } + } /** - * Retrieves one or more identity provider for the given type. For types such as Google, Facebook, Twitter and LinkedIn, only a single - * identity provider can exist. For types such as OpenID Connect and SAMLv2 more than one identity provider can be configured so this request + * Retrieves one or more identity provider for the given type. For types such as Google, Facebook, Twitter and LinkedIn, only a single + * identity provider can exist. For types such as OpenID Connect and SAMLv2 more than one identity provider can be configured so this request * may return multiple identity providers. * * @param array $type The type of the identity provider. @@ -3316,13 +3318,13 @@ public function retrieveIdentityProvider($identityProviderId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveIdentityProviderByType($type) - { - return $this->start()->uri("/api/identity-provider") + public function retrieveIdentityProviderByType($type) + { + return $this->start()->uri("/api/identity-provider") ->urlParameter("type", $type) ->get() ->go(); - } + } /** * Retrieves all the identity providers. @@ -3331,12 +3333,12 @@ public function retrieveIdentityProviderByType($type) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveIdentityProviders() - { - return $this->start()->uri("/api/identity-provider") + public function retrieveIdentityProviders() + { + return $this->start()->uri("/api/identity-provider") ->get() ->go(); - } + } /** * Retrieves all the actions for the user with the given Id that are currently inactive. @@ -3347,14 +3349,14 @@ public function retrieveIdentityProviders() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveInactiveActions($userId) - { - return $this->start()->uri("/api/user/action") + public function retrieveInactiveActions($userId) + { + return $this->start()->uri("/api/user/action") ->urlParameter("userId", $userId) ->urlParameter("active", false) ->get() ->go(); - } + } /** * Retrieves all the applications that are currently inactive. @@ -3363,13 +3365,13 @@ public function retrieveInactiveActions($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveInactiveApplications() - { - return $this->start()->uri("/api/application") + public function retrieveInactiveApplications() + { + return $this->start()->uri("/api/application") ->urlParameter("inactive", true) ->get() ->go(); - } + } /** * Retrieves all the user actions that are currently inactive. @@ -3378,13 +3380,13 @@ public function retrieveInactiveApplications() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveInactiveUserActions() - { - return $this->start()->uri("/api/user-action") + public function retrieveInactiveUserActions() + { + return $this->start()->uri("/api/user-action") ->urlParameter("inactive", true) ->get() ->go(); - } + } /** * Retrieves the available integrations. @@ -3393,12 +3395,12 @@ public function retrieveInactiveUserActions() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveIntegration() - { - return $this->start()->uri("/api/integration") + public function retrieveIntegration() + { + return $this->start()->uri("/api/integration") ->get() ->go(); - } + } /** * Retrieves the Public Key configured for verifying JSON Web Tokens (JWT) by the key Id (kid). @@ -3408,13 +3410,13 @@ public function retrieveIntegration() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveJWTPublicKey($keyId) - { - return $this->startAnonymous()->uri("/api/jwt/public-key") + public function retrieveJWTPublicKey($keyId) + { + return $this->startAnonymous()->uri("/api/jwt/public-key") ->urlParameter("kid", $keyId) ->get() ->go(); - } + } /** * Retrieves the Public Key configured for verifying the JSON Web Tokens (JWT) issued by the Login API by the Application Id. @@ -3424,13 +3426,13 @@ public function retrieveJWTPublicKey($keyId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveJWTPublicKeyByApplicationId($applicationId) - { - return $this->startAnonymous()->uri("/api/jwt/public-key") + public function retrieveJWTPublicKeyByApplicationId($applicationId) + { + return $this->startAnonymous()->uri("/api/jwt/public-key") ->urlParameter("applicationId", $applicationId) ->get() ->go(); - } + } /** * Retrieves all Public Keys configured for verifying JSON Web Tokens (JWT). @@ -3439,12 +3441,12 @@ public function retrieveJWTPublicKeyByApplicationId($applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveJWTPublicKeys() - { - return $this->startAnonymous()->uri("/api/jwt/public-key") + public function retrieveJWTPublicKeys() + { + return $this->startAnonymous()->uri("/api/jwt/public-key") ->get() ->go(); - } + } /** * Returns public keys used by FusionAuth to cryptographically verify JWTs using the JSON Web Key format. @@ -3453,12 +3455,12 @@ public function retrieveJWTPublicKeys() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveJsonWebKeySet() - { - return $this->startAnonymous()->uri("/.well-known/jwks.json") + public function retrieveJsonWebKeySet() + { + return $this->startAnonymous()->uri("/.well-known/jwks.json") ->get() ->go(); - } + } /** * Retrieves the key for the given Id. @@ -3468,13 +3470,13 @@ public function retrieveJsonWebKeySet() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveKey($keyId) - { - return $this->start()->uri("/api/key") + public function retrieveKey($keyId) + { + return $this->start()->uri("/api/key") ->urlSegment($keyId) ->get() ->go(); - } + } /** * Retrieves all the keys. @@ -3483,12 +3485,12 @@ public function retrieveKey($keyId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveKeys() - { - return $this->start()->uri("/api/key") + public function retrieveKeys() + { + return $this->start()->uri("/api/key") ->get() ->go(); - } + } /** * Retrieves the lambda for the given Id. @@ -3498,13 +3500,13 @@ public function retrieveKeys() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveLambda($lambdaId) - { - return $this->start()->uri("/api/lambda") + public function retrieveLambda($lambdaId) + { + return $this->start()->uri("/api/lambda") ->urlSegment($lambdaId) ->get() ->go(); - } + } /** * Retrieves all the lambdas. @@ -3513,12 +3515,12 @@ public function retrieveLambda($lambdaId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveLambdas() - { - return $this->start()->uri("/api/lambda") + public function retrieveLambdas() + { + return $this->start()->uri("/api/lambda") ->get() ->go(); - } + } /** * Retrieves all the lambdas for the provided type. @@ -3528,13 +3530,13 @@ public function retrieveLambdas() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveLambdasByType($type) - { - return $this->start()->uri("/api/lambda") + public function retrieveLambdasByType($type) + { + return $this->start()->uri("/api/lambda") ->urlParameter("type", $type) ->get() ->go(); - } + } /** * Retrieves the login report between the two instants. If you specify an application id, it will only return the @@ -3547,15 +3549,15 @@ public function retrieveLambdasByType($type) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveLoginReport($applicationId, $start, $end) - { - return $this->start()->uri("/api/report/login") + public function retrieveLoginReport($applicationId, $start, $end) + { + return $this->start()->uri("/api/report/login") ->urlParameter("applicationId", $applicationId) ->urlParameter("start", $start) ->urlParameter("end", $end) ->get() ->go(); - } + } /** * Retrieves the message template for the given Id. If you don't specify the id, this will return all the message templates. @@ -3565,13 +3567,13 @@ public function retrieveLoginReport($applicationId, $start, $end) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveMessageTemplate($messageTemplateId = NULL) - { - return $this->start()->uri("/api/message/template") + public function retrieveMessageTemplate($messageTemplateId = null) + { + return $this->start()->uri("/api/message/template") ->urlSegment($messageTemplateId) ->get() ->go(); - } + } /** * Creates a preview of the message template provided in the request, normalized to a given locale. @@ -3581,13 +3583,13 @@ public function retrieveMessageTemplate($messageTemplateId = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveMessageTemplatePreview($request) - { - return $this->start()->uri("/api/message/template/preview") + public function retrieveMessageTemplatePreview($request) + { + return $this->start()->uri("/api/message/template/preview") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Retrieves all the message templates. @@ -3596,12 +3598,12 @@ public function retrieveMessageTemplatePreview($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveMessageTemplates() - { - return $this->start()->uri("/api/message/template") + public function retrieveMessageTemplates() + { + return $this->start()->uri("/api/message/template") ->get() ->go(); - } + } /** * Retrieves the messenger with the given Id. @@ -3611,13 +3613,13 @@ public function retrieveMessageTemplates() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveMessenger($messengerId) - { - return $this->start()->uri("/api/messenger") + public function retrieveMessenger($messengerId) + { + return $this->start()->uri("/api/messenger") ->urlSegment($messengerId) ->get() ->go(); - } + } /** * Retrieves all the messengers. @@ -3626,12 +3628,12 @@ public function retrieveMessenger($messengerId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveMessengers() - { - return $this->start()->uri("/api/messenger") + public function retrieveMessengers() + { + return $this->start()->uri("/api/messenger") ->get() ->go(); - } + } /** * Retrieves the monthly active user report between the two instants. If you specify an application id, it will only @@ -3644,15 +3646,15 @@ public function retrieveMessengers() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveMonthlyActiveReport($applicationId, $start, $end) - { - return $this->start()->uri("/api/report/monthly-active-user") + public function retrieveMonthlyActiveReport($applicationId, $start, $end) + { + return $this->start()->uri("/api/report/monthly-active-user") ->urlParameter("applicationId", $applicationId) ->urlParameter("start", $start) ->urlParameter("end", $end) ->get() ->go(); - } + } /** * Retrieves the Oauth2 configuration for the application for the given Application Id. @@ -3662,14 +3664,14 @@ public function retrieveMonthlyActiveReport($applicationId, $start, $end) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveOauthConfiguration($applicationId) - { - return $this->start()->uri("/api/application") + public function retrieveOauthConfiguration($applicationId) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->urlSegment("oauth-configuration") ->get() ->go(); - } + } /** * Returns the well known OpenID Configuration JSON document @@ -3678,33 +3680,33 @@ public function retrieveOauthConfiguration($applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveOpenIdConfiguration() - { - return $this->startAnonymous()->uri("/.well-known/openid-configuration") + public function retrieveOpenIdConfiguration() + { + return $this->startAnonymous()->uri("/.well-known/openid-configuration") ->get() ->go(); - } + } /** - * Retrieves the password validation rules for a specific tenant. This method requires a tenantId to be provided + * Retrieves the password validation rules for a specific tenant. This method requires a tenantId to be provided * through the use of a Tenant scoped API key or an HTTP header X-FusionAuth-TenantId to specify the Tenant Id. - * + * * This API does not require an API key. * * * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrievePasswordValidationRules() - { - return $this->startAnonymous()->uri("/api/tenant/password-validation-rules") + public function retrievePasswordValidationRules() + { + return $this->startAnonymous()->uri("/api/tenant/password-validation-rules") ->get() ->go(); - } + } /** * Retrieves the password validation rules for a specific tenant. - * + * * This API does not require an API key. * * @param string $tenantId The Id of the tenant. @@ -3712,13 +3714,13 @@ public function retrievePasswordValidationRules() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrievePasswordValidationRulesWithTenantId($tenantId) - { - return $this->startAnonymous()->uri("/api/tenant/password-validation-rules") + public function retrievePasswordValidationRulesWithTenantId($tenantId) + { + return $this->startAnonymous()->uri("/api/tenant/password-validation-rules") ->urlSegment($tenantId) ->get() ->go(); - } + } /** * Retrieves all the children for the given parent email address. @@ -3728,13 +3730,13 @@ public function retrievePasswordValidationRulesWithTenantId($tenantId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrievePendingChildren($parentEmail) - { - return $this->start()->uri("/api/user/family/pending") + public function retrievePendingChildren($parentEmail) + { + return $this->start()->uri("/api/user/family/pending") ->urlParameter("parentEmail", $parentEmail) ->get() ->go(); - } + } /** * Retrieve a pending identity provider link. This is useful to validate a pending link and retrieve meta-data about the identity provider link. @@ -3745,14 +3747,14 @@ public function retrievePendingChildren($parentEmail) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrievePendingLink($pendingLinkId, $userId) - { - return $this->start()->uri("/api/identity-provider/link/pending") + public function retrievePendingLink($pendingLinkId, $userId) + { + return $this->start()->uri("/api/identity-provider/link/pending") ->urlSegment($pendingLinkId) ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Retrieves the FusionAuth Reactor metrics. @@ -3761,12 +3763,12 @@ public function retrievePendingLink($pendingLinkId, $userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveReactorMetrics() - { - return $this->start()->uri("/api/reactor/metrics") + public function retrieveReactorMetrics() + { + return $this->start()->uri("/api/reactor/metrics") ->get() ->go(); - } + } /** * Retrieves the FusionAuth Reactor status. @@ -3775,12 +3777,12 @@ public function retrieveReactorMetrics() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveReactorStatus() - { - return $this->start()->uri("/api/reactor") + public function retrieveReactorStatus() + { + return $this->start()->uri("/api/reactor") ->get() ->go(); - } + } /** * Retrieves the last number of login records. @@ -3791,14 +3793,14 @@ public function retrieveReactorStatus() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveRecentLogins($offset, $limit) - { - return $this->start()->uri("/api/user/recent-login") + public function retrieveRecentLogins($offset, $limit) + { + return $this->start()->uri("/api/user/recent-login") ->urlParameter("offset", $offset) ->urlParameter("limit", $limit) ->get() ->go(); - } + } /** * Retrieves a single refresh token by unique Id. This is not the same thing as the string value of the refresh token. If you have that, you already have what you need. @@ -3808,13 +3810,13 @@ public function retrieveRecentLogins($offset, $limit) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveRefreshTokenById($tokenId) - { - return $this->start()->uri("/api/jwt/refresh") + public function retrieveRefreshTokenById($tokenId) + { + return $this->start()->uri("/api/jwt/refresh") ->urlSegment($tokenId) ->get() ->go(); - } + } /** * Retrieves the refresh tokens that belong to the user with the given Id. @@ -3824,13 +3826,13 @@ public function retrieveRefreshTokenById($tokenId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveRefreshTokens($userId) - { - return $this->start()->uri("/api/jwt/refresh") + public function retrieveRefreshTokens($userId) + { + return $this->start()->uri("/api/jwt/refresh") ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Retrieves the user registration for the user with the given id and the given application id. @@ -3841,14 +3843,14 @@ public function retrieveRefreshTokens($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveRegistration($userId, $applicationId) - { - return $this->start()->uri("/api/user/registration") + public function retrieveRegistration($userId, $applicationId) + { + return $this->start()->uri("/api/user/registration") ->urlSegment($userId) ->urlSegment($applicationId) ->get() ->go(); - } + } /** * Retrieves the registration report between the two instants. If you specify an application id, it will only return @@ -3861,30 +3863,30 @@ public function retrieveRegistration($userId, $applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveRegistrationReport($applicationId, $start, $end) - { - return $this->start()->uri("/api/report/registration") + public function retrieveRegistrationReport($applicationId, $start, $end) + { + return $this->start()->uri("/api/report/registration") ->urlParameter("applicationId", $applicationId) ->urlParameter("start", $start) ->urlParameter("end", $end) ->get() ->go(); - } + } /** - * Retrieve the status of a re-index process. A status code of 200 indicates the re-index is in progress, a status code of + * Retrieve the status of a re-index process. A status code of 200 indicates the re-index is in progress, a status code of * 404 indicates no re-index is in progress. * * * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveReindexStatus() - { - return $this->start()->uri("/api/system/reindex") + public function retrieveReindexStatus() + { + return $this->start()->uri("/api/system/reindex") ->get() ->go(); - } + } /** * Retrieves the system configuration. @@ -3893,12 +3895,12 @@ public function retrieveReindexStatus() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveSystemConfiguration() - { - return $this->start()->uri("/api/system-configuration") + public function retrieveSystemConfiguration() + { + return $this->start()->uri("/api/system-configuration") ->get() ->go(); - } + } /** * Retrieves the tenant for the given Id. @@ -3908,13 +3910,13 @@ public function retrieveSystemConfiguration() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveTenant($tenantId) - { - return $this->start()->uri("/api/tenant") + public function retrieveTenant($tenantId) + { + return $this->start()->uri("/api/tenant") ->urlSegment($tenantId) ->get() ->go(); - } + } /** * Retrieves all the tenants. @@ -3923,12 +3925,12 @@ public function retrieveTenant($tenantId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveTenants() - { - return $this->start()->uri("/api/tenant") + public function retrieveTenants() + { + return $this->start()->uri("/api/tenant") ->get() ->go(); - } + } /** * Retrieves the theme for the given Id. @@ -3938,13 +3940,13 @@ public function retrieveTenants() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveTheme($themeId) - { - return $this->start()->uri("/api/theme") + public function retrieveTheme($themeId) + { + return $this->start()->uri("/api/theme") ->urlSegment($themeId) ->get() ->go(); - } + } /** * Retrieves all the themes. @@ -3953,12 +3955,12 @@ public function retrieveTheme($themeId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveThemes() - { - return $this->start()->uri("/api/theme") + public function retrieveThemes() + { + return $this->start()->uri("/api/theme") ->get() ->go(); - } + } /** * Retrieves the totals report. This contains all the total counts for each application and the global registration @@ -3968,12 +3970,12 @@ public function retrieveThemes() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveTotalReport() - { - return $this->start()->uri("/api/report/totals") + public function retrieveTotalReport() + { + return $this->start()->uri("/api/report/totals") ->get() ->go(); - } + } /** * Retrieve two-factor recovery codes for a user. @@ -3983,17 +3985,17 @@ public function retrieveTotalReport() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveTwoFactorRecoveryCodes($userId) - { - return $this->start()->uri("/api/user/two-factor/recovery-code") + public function retrieveTwoFactorRecoveryCodes($userId) + { + return $this->start()->uri("/api/user/two-factor/recovery-code") ->urlSegment($userId) ->get() ->go(); - } + } /** * Retrieve a user's two-factor status. - * + * * This can be used to see if a user will need to complete a two-factor challenge to complete a login, * and optionally identify the state of the two-factor trust across various applications. * @@ -4004,15 +4006,15 @@ public function retrieveTwoFactorRecoveryCodes($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveTwoFactorStatus($userId, $applicationId, $twoFactorTrustId) - { - return $this->start()->uri("/api/two-factor/status") + public function retrieveTwoFactorStatus($userId, $applicationId, $twoFactorTrustId) + { + return $this->start()->uri("/api/two-factor/status") ->urlParameter("userId", $userId) ->urlParameter("applicationId", $applicationId) ->urlSegment($twoFactorTrustId) ->get() ->go(); - } + } /** * Retrieves the user for the given Id. @@ -4022,13 +4024,13 @@ public function retrieveTwoFactorStatus($userId, $applicationId, $twoFactorTrust * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUser($userId) - { - return $this->start()->uri("/api/user") + public function retrieveUser($userId) + { + return $this->start()->uri("/api/user") ->urlSegment($userId) ->get() ->go(); - } + } /** * Retrieves the user action for the given Id. If you pass in null for the id, this will return all the user @@ -4039,13 +4041,13 @@ public function retrieveUser($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserAction($userActionId = NULL) - { - return $this->start()->uri("/api/user-action") + public function retrieveUserAction($userActionId = null) + { + return $this->start()->uri("/api/user-action") ->urlSegment($userActionId) ->get() ->go(); - } + } /** * Retrieves the user action reason for the given Id. If you pass in null for the id, this will return all the user @@ -4056,13 +4058,13 @@ public function retrieveUserAction($userActionId = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserActionReason($userActionReasonId = NULL) - { - return $this->start()->uri("/api/user-action-reason") + public function retrieveUserActionReason($userActionReasonId = null) + { + return $this->start()->uri("/api/user-action-reason") ->urlSegment($userActionReasonId) ->get() ->go(); - } + } /** * Retrieves all the user action reasons. @@ -4071,12 +4073,12 @@ public function retrieveUserActionReason($userActionReasonId = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserActionReasons() - { - return $this->start()->uri("/api/user-action-reason") + public function retrieveUserActionReasons() + { + return $this->start()->uri("/api/user-action-reason") ->get() ->go(); - } + } /** * Retrieves all the user actions. @@ -4085,12 +4087,12 @@ public function retrieveUserActionReasons() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserActions() - { - return $this->start()->uri("/api/user-action") + public function retrieveUserActions() + { + return $this->start()->uri("/api/user-action") ->get() ->go(); - } + } /** * Retrieves the user by a change password Id. The intended use of this API is to retrieve a user after the forgot @@ -4101,13 +4103,13 @@ public function retrieveUserActions() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserByChangePasswordId($changePasswordId) - { - return $this->start()->uri("/api/user") + public function retrieveUserByChangePasswordId($changePasswordId) + { + return $this->start()->uri("/api/user") ->urlParameter("changePasswordId", $changePasswordId) ->get() ->go(); - } + } /** * Retrieves the user for the given email. @@ -4117,13 +4119,13 @@ public function retrieveUserByChangePasswordId($changePasswordId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserByEmail($email) - { - return $this->start()->uri("/api/user") + public function retrieveUserByEmail($email) + { + return $this->start()->uri("/api/user") ->urlParameter("email", $email) ->get() ->go(); - } + } /** * Retrieves the user for the loginId. The loginId can be either the username or the email. @@ -4133,13 +4135,13 @@ public function retrieveUserByEmail($email) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserByLoginId($loginId) - { - return $this->start()->uri("/api/user") + public function retrieveUserByLoginId($loginId) + { + return $this->start()->uri("/api/user") ->urlParameter("loginId", $loginId) ->get() ->go(); - } + } /** * Retrieves the user for the given username. @@ -4149,13 +4151,13 @@ public function retrieveUserByLoginId($loginId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserByUsername($username) - { - return $this->start()->uri("/api/user") + public function retrieveUserByUsername($username) + { + return $this->start()->uri("/api/user") ->urlParameter("username", $username) ->get() ->go(); - } + } /** * Retrieves the user by a verificationId. The intended use of this API is to retrieve a user after the forgot @@ -4166,17 +4168,17 @@ public function retrieveUserByUsername($username) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserByVerificationId($verificationId) - { - return $this->start()->uri("/api/user") + public function retrieveUserByVerificationId($verificationId) + { + return $this->start()->uri("/api/user") ->urlParameter("verificationId", $verificationId) ->get() ->go(); - } + } /** * Retrieve a user_code that is part of an in-progress Device Authorization Grant. - * + * * This API is useful if you want to build your own login workflow to complete a device grant. * * @param string $client_id The client id. @@ -4186,24 +4188,24 @@ public function retrieveUserByVerificationId($verificationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserCode($client_id, $client_secret, $user_code) - { - $post_data = array( - 'client_id' => $client_id, - 'client_secret' => $client_secret, - 'user_code' => $user_code - ); - return $this->startAnonymous()->uri("/oauth2/device/user-code") + public function retrieveUserCode($client_id, $client_secret, $user_code) + { + $post_data = array( + 'client_id' => $client_id, + 'client_secret' => $client_secret, + 'user_code' => $user_code + ); + return $this->startAnonymous()->uri("/oauth2/device/user-code") ->bodyHandler(new FormDataBodyHandler($post_data)) ->get() ->go(); - } + } /** * Retrieve a user_code that is part of an in-progress Device Authorization Grant. - * + * * This API is useful if you want to build your own login workflow to complete a device grant. - * + * * This request will require an API key. * * @param string $user_code The end-user verification code. @@ -4211,16 +4213,16 @@ public function retrieveUserCode($client_id, $client_secret, $user_code) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserCodeUsingAPIKey($user_code) - { - $post_data = array( - 'user_code' => $user_code - ); - return $this->startAnonymous()->uri("/oauth2/device/user-code") + public function retrieveUserCodeUsingAPIKey($user_code) + { + $post_data = array( + 'user_code' => $user_code + ); + return $this->startAnonymous()->uri("/oauth2/device/user-code") ->bodyHandler(new FormDataBodyHandler($post_data)) ->get() ->go(); - } + } /** * Retrieves all the comments for the user with the given Id. @@ -4230,13 +4232,13 @@ public function retrieveUserCodeUsingAPIKey($user_code) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserComments($userId) - { - return $this->start()->uri("/api/user/comment") + public function retrieveUserComments($userId) + { + return $this->start()->uri("/api/user/comment") ->urlSegment($userId) ->get() ->go(); - } + } /** * Retrieve a single User consent by Id. @@ -4246,13 +4248,13 @@ public function retrieveUserComments($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserConsent($userConsentId) - { - return $this->start()->uri("/api/user/consent") + public function retrieveUserConsent($userConsentId) + { + return $this->start()->uri("/api/user/consent") ->urlSegment($userConsentId) ->get() ->go(); - } + } /** * Retrieves all the consents for a User. @@ -4262,13 +4264,13 @@ public function retrieveUserConsent($userConsentId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserConsents($userId) - { - return $this->start()->uri("/api/user/consent") + public function retrieveUserConsents($userId) + { + return $this->start()->uri("/api/user/consent") ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Call the UserInfo endpoint to retrieve User Claims from the access token issued by FusionAuth. @@ -4278,13 +4280,13 @@ public function retrieveUserConsents($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserInfoFromAccessToken($encodedJWT) - { - return $this->startAnonymous()->uri("/oauth2/userinfo") + public function retrieveUserInfoFromAccessToken($encodedJWT) + { + return $this->startAnonymous()->uri("/oauth2/userinfo") ->authorization("Bearer " . $encodedJWT) ->get() ->go(); - } + } /** * Retrieve a single Identity Provider user (link). @@ -4296,15 +4298,15 @@ public function retrieveUserInfoFromAccessToken($encodedJWT) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserLink($identityProviderId, $identityProviderUserId, $userId) - { - return $this->start()->uri("/api/identity-provider/link") + public function retrieveUserLink($identityProviderId, $identityProviderUserId, $userId) + { + return $this->start()->uri("/api/identity-provider/link") ->urlParameter("identityProviderId", $identityProviderId) ->urlParameter("identityProviderUserId", $identityProviderUserId) ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Retrieve all Identity Provider users (links) for the user. Specify the optional identityProviderId to retrieve links for a particular IdP. @@ -4315,14 +4317,14 @@ public function retrieveUserLink($identityProviderId, $identityProviderUserId, $ * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserLinksByUserId($identityProviderId, $userId) - { - return $this->start()->uri("/api/identity-provider/link") + public function retrieveUserLinksByUserId($identityProviderId, $userId) + { + return $this->start()->uri("/api/identity-provider/link") ->urlParameter("identityProviderId", $identityProviderId) ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Retrieves the login report between the two instants for a particular user by Id. If you specify an application id, it will only return the @@ -4336,16 +4338,16 @@ public function retrieveUserLinksByUserId($identityProviderId, $userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserLoginReport($applicationId, $userId, $start, $end) - { - return $this->start()->uri("/api/report/login") + public function retrieveUserLoginReport($applicationId, $userId, $start, $end) + { + return $this->start()->uri("/api/report/login") ->urlParameter("applicationId", $applicationId) ->urlParameter("userId", $userId) ->urlParameter("start", $start) ->urlParameter("end", $end) ->get() ->go(); - } + } /** * Retrieves the login report between the two instants for a particular user by login Id. If you specify an application id, it will only return the @@ -4359,16 +4361,16 @@ public function retrieveUserLoginReport($applicationId, $userId, $start, $end) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserLoginReportByLoginId($applicationId, $loginId, $start, $end) - { - return $this->start()->uri("/api/report/login") + public function retrieveUserLoginReportByLoginId($applicationId, $loginId, $start, $end) + { + return $this->start()->uri("/api/report/login") ->urlParameter("applicationId", $applicationId) ->urlParameter("loginId", $loginId) ->urlParameter("start", $start) ->urlParameter("end", $end) ->get() ->go(); - } + } /** * Retrieves the last number of login records for a user. @@ -4380,15 +4382,15 @@ public function retrieveUserLoginReportByLoginId($applicationId, $loginId, $star * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserRecentLogins($userId, $offset, $limit) - { - return $this->start()->uri("/api/user/recent-login") + public function retrieveUserRecentLogins($userId, $offset, $limit) + { + return $this->start()->uri("/api/user/recent-login") ->urlParameter("userId", $userId) ->urlParameter("offset", $offset) ->urlParameter("limit", $limit) ->get() ->go(); - } + } /** * Retrieves the user for the given Id. This method does not use an API key, instead it uses a JSON Web Token (JWT) for authentication. @@ -4398,13 +4400,13 @@ public function retrieveUserRecentLogins($userId, $offset, $limit) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUserUsingJWT($encodedJWT) - { - return $this->startAnonymous()->uri("/api/user") + public function retrieveUserUsingJWT($encodedJWT) + { + return $this->startAnonymous()->uri("/api/user") ->authorization("Bearer " . $encodedJWT) ->get() ->go(); - } + } /** * Retrieves the FusionAuth version string. @@ -4413,12 +4415,12 @@ public function retrieveUserUsingJWT($encodedJWT) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveVersion() - { - return $this->start()->uri("/api/system/version") + public function retrieveVersion() + { + return $this->start()->uri("/api/system/version") ->get() ->go(); - } + } /** * Retrieves the WebAuthn credential for the given Id. @@ -4428,13 +4430,13 @@ public function retrieveVersion() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveWebAuthnCredential($id) - { - return $this->start()->uri("/api/webauthn") + public function retrieveWebAuthnCredential($id) + { + return $this->start()->uri("/api/webauthn") ->urlSegment($id) ->get() ->go(); - } + } /** * Retrieves all WebAuthn credentials for the given user. @@ -4444,13 +4446,13 @@ public function retrieveWebAuthnCredential($id) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveWebAuthnCredentialsForUser($userId) - { - return $this->start()->uri("/api/webauthn") + public function retrieveWebAuthnCredentialsForUser($userId) + { + return $this->start()->uri("/api/webauthn") ->urlParameter("userId", $userId) ->get() ->go(); - } + } /** * Retrieves the webhook for the given Id. If you pass in null for the id, this will return all the webhooks. @@ -4460,13 +4462,13 @@ public function retrieveWebAuthnCredentialsForUser($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveWebhook($webhookId = NULL) - { - return $this->start()->uri("/api/webhook") + public function retrieveWebhook($webhookId = null) + { + return $this->start()->uri("/api/webhook") ->urlSegment($webhookId) ->get() ->go(); - } + } /** * Retrieves all the webhooks. @@ -4475,33 +4477,33 @@ public function retrieveWebhook($webhookId = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveWebhooks() - { - return $this->start()->uri("/api/webhook") + public function retrieveWebhooks() + { + return $this->start()->uri("/api/webhook") ->get() ->go(); - } + } /** * Revokes refresh tokens. - * + * * Usage examples: * - Delete a single refresh token, pass in only the token. * revokeRefreshToken(token) - * + * * - Delete all refresh tokens for a user, pass in only the userId. * revokeRefreshToken(null, userId) - * + * * - Delete all refresh tokens for a user for a specific application, pass in both the userId and the applicationId. * revokeRefreshToken(null, userId, applicationId) - * + * * - Delete all refresh tokens for an application * revokeRefreshToken(null, null, applicationId) - * + * * Note: null may be handled differently depending upon the programming language. - * + * * See also: (method names may vary by language... but you'll figure it out) - * + * * - revokeRefreshTokenById * - revokeRefreshTokenByToken * - revokeRefreshTokensByUserId @@ -4515,15 +4517,15 @@ public function retrieveWebhooks() * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function revokeRefreshToken($token, $userId, $applicationId = NULL) - { - return $this->start()->uri("/api/jwt/refresh") + public function revokeRefreshToken($token, $userId, $applicationId = null) + { + return $this->start()->uri("/api/jwt/refresh") ->urlParameter("token", $token) ->urlParameter("userId", $userId) ->urlParameter("applicationId", $applicationId) ->delete() ->go(); - } + } /** * Revokes a single refresh token by the unique Id. The unique Id is not sensitive as it cannot be used to obtain another JWT. @@ -4533,13 +4535,13 @@ public function revokeRefreshToken($token, $userId, $applicationId = NULL) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function revokeRefreshTokenById($tokenId) - { - return $this->start()->uri("/api/jwt/refresh") + public function revokeRefreshTokenById($tokenId) + { + return $this->start()->uri("/api/jwt/refresh") ->urlSegment($tokenId) ->delete() ->go(); - } + } /** * Revokes a single refresh token by using the actual refresh token value. This refresh token value is sensitive, so be careful with this API request. @@ -4549,13 +4551,13 @@ public function revokeRefreshTokenById($tokenId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function revokeRefreshTokenByToken($token) - { - return $this->start()->uri("/api/jwt/refresh") + public function revokeRefreshTokenByToken($token) + { + return $this->start()->uri("/api/jwt/refresh") ->urlParameter("token", $token) ->delete() ->go(); - } + } /** * Revoke all refresh tokens that belong to an application by applicationId. @@ -4565,13 +4567,13 @@ public function revokeRefreshTokenByToken($token) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function revokeRefreshTokensByApplicationId($applicationId) - { - return $this->start()->uri("/api/jwt/refresh") + public function revokeRefreshTokensByApplicationId($applicationId) + { + return $this->start()->uri("/api/jwt/refresh") ->urlParameter("applicationId", $applicationId) ->delete() ->go(); - } + } /** * Revoke all refresh tokens that belong to a user by user Id. @@ -4581,13 +4583,13 @@ public function revokeRefreshTokensByApplicationId($applicationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function revokeRefreshTokensByUserId($userId) - { - return $this->start()->uri("/api/jwt/refresh") + public function revokeRefreshTokensByUserId($userId) + { + return $this->start()->uri("/api/jwt/refresh") ->urlParameter("userId", $userId) ->delete() ->go(); - } + } /** * Revoke all refresh tokens that belong to a user by user Id for a specific application by applicationId. @@ -4598,14 +4600,14 @@ public function revokeRefreshTokensByUserId($userId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function revokeRefreshTokensByUserIdForApplication($userId, $applicationId) - { - return $this->start()->uri("/api/jwt/refresh") + public function revokeRefreshTokensByUserIdForApplication($userId, $applicationId) + { + return $this->start()->uri("/api/jwt/refresh") ->urlParameter("userId", $userId) ->urlParameter("applicationId", $applicationId) ->delete() ->go(); - } + } /** * Revokes refresh tokens using the information in the JSON body. The handling for this method is the same as the revokeRefreshToken method @@ -4616,13 +4618,13 @@ public function revokeRefreshTokensByUserIdForApplication($userId, $applicationI * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function revokeRefreshTokensWithRequest($request) - { - return $this->start()->uri("/api/jwt/refresh") + public function revokeRefreshTokensWithRequest($request) + { + return $this->start()->uri("/api/jwt/refresh") ->bodyHandler(new JSONBodyHandler($request)) ->delete() ->go(); - } + } /** * Revokes a single User consent by Id. @@ -4632,13 +4634,13 @@ public function revokeRefreshTokensWithRequest($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function revokeUserConsent($userConsentId) - { - return $this->start()->uri("/api/user/consent") + public function revokeUserConsent($userConsentId) + { + return $this->start()->uri("/api/user/consent") ->urlSegment($userConsentId) ->delete() ->go(); - } + } /** * Searches applications with the specified criteria and pagination. @@ -4648,13 +4650,13 @@ public function revokeUserConsent($userConsentId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchApplications($request) - { - return $this->start()->uri("/api/application/search") + public function searchApplications($request) + { + return $this->start()->uri("/api/application/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches the audit logs with the specified criteria and pagination. @@ -4664,13 +4666,13 @@ public function searchApplications($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchAuditLogs($request) - { - return $this->start()->uri("/api/system/audit-log/search") + public function searchAuditLogs($request) + { + return $this->start()->uri("/api/system/audit-log/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches consents with the specified criteria and pagination. @@ -4680,13 +4682,13 @@ public function searchAuditLogs($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchConsents($request) - { - return $this->start()->uri("/api/consent/search") + public function searchConsents($request) + { + return $this->start()->uri("/api/consent/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches email templates with the specified criteria and pagination. @@ -4696,13 +4698,13 @@ public function searchConsents($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchEmailTemplates($request) - { - return $this->start()->uri("/api/email/template/search") + public function searchEmailTemplates($request) + { + return $this->start()->uri("/api/email/template/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches entities with the specified criteria and pagination. @@ -4712,13 +4714,13 @@ public function searchEmailTemplates($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchEntities($request) - { - return $this->start()->uri("/api/entity/search") + public function searchEntities($request) + { + return $this->start()->uri("/api/entity/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Retrieves the entities for the given ids. If any id is invalid, it is ignored. @@ -4728,13 +4730,13 @@ public function searchEntities($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchEntitiesByIds($ids) - { - return $this->start()->uri("/api/entity/search") + public function searchEntitiesByIds($ids) + { + return $this->start()->uri("/api/entity/search") ->urlParameter("ids", $ids) ->get() ->go(); - } + } /** * Searches Entity Grants with the specified criteria and pagination. @@ -4744,13 +4746,13 @@ public function searchEntitiesByIds($ids) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchEntityGrants($request) - { - return $this->start()->uri("/api/entity/grant/search") + public function searchEntityGrants($request) + { + return $this->start()->uri("/api/entity/grant/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches the entity types with the specified criteria and pagination. @@ -4760,13 +4762,13 @@ public function searchEntityGrants($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchEntityTypes($request) - { - return $this->start()->uri("/api/entity/type/search") + public function searchEntityTypes($request) + { + return $this->start()->uri("/api/entity/type/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches the event logs with the specified criteria and pagination. @@ -4776,13 +4778,13 @@ public function searchEntityTypes($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchEventLogs($request) - { - return $this->start()->uri("/api/system/event-log/search") + public function searchEventLogs($request) + { + return $this->start()->uri("/api/system/event-log/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches group members with the specified criteria and pagination. @@ -4792,13 +4794,13 @@ public function searchEventLogs($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchGroupMembers($request) - { - return $this->start()->uri("/api/group/member/search") + public function searchGroupMembers($request) + { + return $this->start()->uri("/api/group/member/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches groups with the specified criteria and pagination. @@ -4808,13 +4810,13 @@ public function searchGroupMembers($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchGroups($request) - { - return $this->start()->uri("/api/group/search") + public function searchGroups($request) + { + return $this->start()->uri("/api/group/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches the IP Access Control Lists with the specified criteria and pagination. @@ -4824,13 +4826,13 @@ public function searchGroups($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchIPAccessControlLists($request) - { - return $this->start()->uri("/api/ip-acl/search") + public function searchIPAccessControlLists($request) + { + return $this->start()->uri("/api/ip-acl/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches identity providers with the specified criteria and pagination. @@ -4840,13 +4842,13 @@ public function searchIPAccessControlLists($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchIdentityProviders($request) - { - return $this->start()->uri("/api/identity-provider/search") + public function searchIdentityProviders($request) + { + return $this->start()->uri("/api/identity-provider/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches keys with the specified criteria and pagination. @@ -4856,13 +4858,13 @@ public function searchIdentityProviders($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchKeys($request) - { - return $this->start()->uri("/api/key/search") + public function searchKeys($request) + { + return $this->start()->uri("/api/key/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches lambdas with the specified criteria and pagination. @@ -4872,13 +4874,13 @@ public function searchKeys($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchLambdas($request) - { - return $this->start()->uri("/api/lambda/search") + public function searchLambdas($request) + { + return $this->start()->uri("/api/lambda/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches the login records with the specified criteria and pagination. @@ -4888,13 +4890,13 @@ public function searchLambdas($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchLoginRecords($request) - { - return $this->start()->uri("/api/system/login-record/search") + public function searchLoginRecords($request) + { + return $this->start()->uri("/api/system/login-record/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches tenants with the specified criteria and pagination. @@ -4904,13 +4906,13 @@ public function searchLoginRecords($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchTenants($request) - { - return $this->start()->uri("/api/tenant/search") + public function searchTenants($request) + { + return $this->start()->uri("/api/tenant/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches themes with the specified criteria and pagination. @@ -4920,13 +4922,13 @@ public function searchTenants($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchThemes($request) - { - return $this->start()->uri("/api/theme/search") + public function searchThemes($request) + { + return $this->start()->uri("/api/theme/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches user comments with the specified criteria and pagination. @@ -4936,13 +4938,13 @@ public function searchThemes($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchUserComments($request) - { - return $this->start()->uri("/api/user/comment/search") + public function searchUserComments($request) + { + return $this->start()->uri("/api/user/comment/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Retrieves the users for the given ids. If any id is invalid, it is ignored. @@ -4953,13 +4955,13 @@ public function searchUserComments($request) * @throws \Exception * @deprecated This method has been renamed to searchUsersByIds, use that method instead. */ - public function searchUsers($ids) - { - return $this->start()->uri("/api/user/search") + public function searchUsers($ids) + { + return $this->start()->uri("/api/user/search") ->urlParameter("ids", $ids) ->get() ->go(); - } + } /** * Retrieves the users for the given ids. If any id is invalid, it is ignored. @@ -4969,13 +4971,13 @@ public function searchUsers($ids) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchUsersByIds($ids) - { - return $this->start()->uri("/api/user/search") + public function searchUsersByIds($ids) + { + return $this->start()->uri("/api/user/search") ->urlParameter("ids", $ids) ->get() ->go(); - } + } /** * Retrieves the users for the given search criteria and pagination. @@ -4986,13 +4988,13 @@ public function searchUsersByIds($ids) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchUsersByQuery($request) - { - return $this->start()->uri("/api/user/search") + public function searchUsersByQuery($request) + { + return $this->start()->uri("/api/user/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Retrieves the users for the given search criteria and pagination. @@ -5004,13 +5006,13 @@ public function searchUsersByQuery($request) * @throws \Exception * @deprecated This method has been renamed to searchUsersByQuery, use that method instead. */ - public function searchUsersByQueryString($request) - { - return $this->start()->uri("/api/user/search") + public function searchUsersByQueryString($request) + { + return $this->start()->uri("/api/user/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Searches webhooks with the specified criteria and pagination. @@ -5020,13 +5022,13 @@ public function searchUsersByQueryString($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function searchWebhooks($request) - { - return $this->start()->uri("/api/webhook/search") + public function searchWebhooks($request) + { + return $this->start()->uri("/api/webhook/search") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Send an email using an email template id. You can optionally provide requestData to access key value @@ -5038,14 +5040,14 @@ public function searchWebhooks($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function sendEmail($emailTemplateId, $request) - { - return $this->start()->uri("/api/email/send") + public function sendEmail($emailTemplateId, $request) + { + return $this->start()->uri("/api/email/send") ->urlSegment($emailTemplateId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Sends out an email to a parent that they need to register and create a family or need to log in and add a child to their existing family. @@ -5055,13 +5057,13 @@ public function sendEmail($emailTemplateId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function sendFamilyRequestEmail($request) - { - return $this->start()->uri("/api/user/family/request") + public function sendFamilyRequestEmail($request) + { + return $this->start()->uri("/api/user/family/request") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Send a passwordless authentication code in an email to complete login. @@ -5071,13 +5073,13 @@ public function sendFamilyRequestEmail($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function sendPasswordlessCode($request) - { - return $this->startAnonymous()->uri("/api/passwordless/send") + public function sendPasswordlessCode($request) + { + return $this->startAnonymous()->uri("/api/passwordless/send") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Send a Two Factor authentication code to assist in setting up Two Factor authentication or disabling. @@ -5088,13 +5090,13 @@ public function sendPasswordlessCode($request) * @throws \Exception * @deprecated This method has been renamed to sendTwoFactorCodeForEnableDisable, use that method instead. */ - public function sendTwoFactorCode($request) - { - return $this->start()->uri("/api/two-factor/send") + public function sendTwoFactorCode($request) + { + return $this->start()->uri("/api/two-factor/send") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Send a Two Factor authentication code to assist in setting up Two Factor authentication or disabling. @@ -5104,13 +5106,13 @@ public function sendTwoFactorCode($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function sendTwoFactorCodeForEnableDisable($request) - { - return $this->start()->uri("/api/two-factor/send") + public function sendTwoFactorCodeForEnableDisable($request) + { + return $this->start()->uri("/api/two-factor/send") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Send a Two Factor authentication code to allow the completion of Two Factor authentication. @@ -5121,13 +5123,13 @@ public function sendTwoFactorCodeForEnableDisable($request) * @throws \Exception * @deprecated This method has been renamed to sendTwoFactorCodeForLoginUsingMethod, use that method instead. */ - public function sendTwoFactorCodeForLogin($twoFactorId) - { - return $this->startAnonymous()->uri("/api/two-factor/send") + public function sendTwoFactorCodeForLogin($twoFactorId) + { + return $this->startAnonymous()->uri("/api/two-factor/send") ->urlSegment($twoFactorId) ->post() ->go(); - } + } /** * Send a Two Factor authentication code to allow the completion of Two Factor authentication. @@ -5138,14 +5140,14 @@ public function sendTwoFactorCodeForLogin($twoFactorId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function sendTwoFactorCodeForLoginUsingMethod($twoFactorId, $request) - { - return $this->startAnonymous()->uri("/api/two-factor/send") + public function sendTwoFactorCodeForLoginUsingMethod($twoFactorId, $request) + { + return $this->startAnonymous()->uri("/api/two-factor/send") ->urlSegment($twoFactorId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Begins a login request for a 3rd party login that requires user interaction such as HYPR. @@ -5156,13 +5158,13 @@ public function sendTwoFactorCodeForLoginUsingMethod($twoFactorId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function startIdentityProviderLogin($request) - { - return $this->start()->uri("/api/identity-provider/start") + public function startIdentityProviderLogin($request) + { + return $this->start()->uri("/api/identity-provider/start") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Start a passwordless login request by generating a passwordless code. This code can be sent to the User using the Send @@ -5173,20 +5175,20 @@ public function startIdentityProviderLogin($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function startPasswordlessLogin($request) - { - return $this->start()->uri("/api/passwordless/start") + public function startPasswordlessLogin($request) + { + return $this->start()->uri("/api/passwordless/start") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** - * Start a Two-Factor login request by generating a two-factor identifier. This code can then be sent to the Two Factor Send - * API (/api/two-factor/send)in order to send a one-time use code to a user. You can also use one-time use code returned - * to send the code out-of-band. The Two-Factor login is completed by making a request to the Two-Factor Login + * Start a Two-Factor login request by generating a two-factor identifier. This code can then be sent to the Two Factor Send + * API (/api/two-factor/send)in order to send a one-time use code to a user. You can also use one-time use code returned + * to send the code out-of-band. The Two-Factor login is completed by making a request to the Two-Factor Login * API (/api/two-factor/login). with the two-factor identifier and the one-time use code. - * + * * This API is intended to allow you to begin a Two-Factor login outside a normal login that originated from the Login API (/api/login). * * @param array $request The Two-Factor start request that contains all the information used to begin the Two-Factor login request. @@ -5194,13 +5196,13 @@ public function startPasswordlessLogin($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function startTwoFactorLogin($request) - { - return $this->start()->uri("/api/two-factor/start") + public function startTwoFactorLogin($request) + { + return $this->start()->uri("/api/two-factor/start") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Start a WebAuthn authentication ceremony by generating a new challenge for the user @@ -5210,13 +5212,13 @@ public function startTwoFactorLogin($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function startWebAuthnLogin($request) - { - return $this->start()->uri("/api/webauthn/start") + public function startWebAuthnLogin($request) + { + return $this->start()->uri("/api/webauthn/start") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Start a WebAuthn registration ceremony by generating a new challenge for the user @@ -5226,13 +5228,13 @@ public function startWebAuthnLogin($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function startWebAuthnRegistration($request) - { - return $this->start()->uri("/api/webauthn/register/start") + public function startWebAuthnRegistration($request) + { + return $this->start()->uri("/api/webauthn/register/start") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Complete login using a 2FA challenge @@ -5242,13 +5244,13 @@ public function startWebAuthnRegistration($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function twoFactorLogin($request) - { - return $this->startAnonymous()->uri("/api/two-factor/login") + public function twoFactorLogin($request) + { + return $this->startAnonymous()->uri("/api/two-factor/login") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Updates an API key by given id @@ -5259,14 +5261,14 @@ public function twoFactorLogin($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateAPIKey($apiKeyId, $request) - { - return $this->start()->uri("/api/api-key") + public function updateAPIKey($apiKeyId, $request) + { + return $this->start()->uri("/api/api-key") ->urlSegment($apiKeyId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the application with the given Id. @@ -5277,14 +5279,14 @@ public function updateAPIKey($apiKeyId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateApplication($applicationId, $request) - { - return $this->start()->uri("/api/application") + public function updateApplication($applicationId, $request) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the application role with the given id for the application. @@ -5296,16 +5298,16 @@ public function updateApplication($applicationId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateApplicationRole($applicationId, $roleId, $request) - { - return $this->start()->uri("/api/application") + public function updateApplicationRole($applicationId, $roleId, $request) + { + return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->urlSegment("role") ->urlSegment($roleId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the connector with the given Id. @@ -5316,14 +5318,14 @@ public function updateApplicationRole($applicationId, $roleId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateConnector($connectorId, $request) - { - return $this->start()->uri("/api/connector") + public function updateConnector($connectorId, $request) + { + return $this->start()->uri("/api/connector") ->urlSegment($connectorId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the consent with the given Id. @@ -5334,14 +5336,14 @@ public function updateConnector($connectorId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateConsent($consentId, $request) - { - return $this->start()->uri("/api/consent") + public function updateConsent($consentId, $request) + { + return $this->start()->uri("/api/consent") ->urlSegment($consentId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the email template with the given Id. @@ -5352,14 +5354,14 @@ public function updateConsent($consentId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateEmailTemplate($emailTemplateId, $request) - { - return $this->start()->uri("/api/email/template") + public function updateEmailTemplate($emailTemplateId, $request) + { + return $this->start()->uri("/api/email/template") ->urlSegment($emailTemplateId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the Entity with the given Id. @@ -5370,14 +5372,14 @@ public function updateEmailTemplate($emailTemplateId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateEntity($entityId, $request) - { - return $this->start()->uri("/api/entity") + public function updateEntity($entityId, $request) + { + return $this->start()->uri("/api/entity") ->urlSegment($entityId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the Entity Type with the given Id. @@ -5388,14 +5390,14 @@ public function updateEntity($entityId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateEntityType($entityTypeId, $request) - { - return $this->start()->uri("/api/entity/type") + public function updateEntityType($entityTypeId, $request) + { + return $this->start()->uri("/api/entity/type") ->urlSegment($entityTypeId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the permission with the given id for the entity type. @@ -5407,16 +5409,16 @@ public function updateEntityType($entityTypeId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateEntityTypePermission($entityTypeId, $permissionId, $request) - { - return $this->start()->uri("/api/entity/type") + public function updateEntityTypePermission($entityTypeId, $permissionId, $request) + { + return $this->start()->uri("/api/entity/type") ->urlSegment($entityTypeId) ->urlSegment("permission") ->urlSegment($permissionId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the form with the given Id. @@ -5427,14 +5429,14 @@ public function updateEntityTypePermission($entityTypeId, $permissionId, $reques * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateForm($formId, $request) - { - return $this->start()->uri("/api/form") + public function updateForm($formId, $request) + { + return $this->start()->uri("/api/form") ->urlSegment($formId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the form field with the given Id. @@ -5445,14 +5447,14 @@ public function updateForm($formId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateFormField($fieldId, $request) - { - return $this->start()->uri("/api/form/field") + public function updateFormField($fieldId, $request) + { + return $this->start()->uri("/api/form/field") ->urlSegment($fieldId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the group with the given Id. @@ -5463,14 +5465,14 @@ public function updateFormField($fieldId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateGroup($groupId, $request) - { - return $this->start()->uri("/api/group") + public function updateGroup($groupId, $request) + { + return $this->start()->uri("/api/group") ->urlSegment($groupId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Creates a member in a group. @@ -5480,13 +5482,13 @@ public function updateGroup($groupId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateGroupMembers($request) - { - return $this->start()->uri("/api/group/member") + public function updateGroupMembers($request) + { + return $this->start()->uri("/api/group/member") ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the IP Access Control List with the given Id. @@ -5497,14 +5499,14 @@ public function updateGroupMembers($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateIPAccessControlList($accessControlListId, $request) - { - return $this->start()->uri("/api/ip-acl") + public function updateIPAccessControlList($accessControlListId, $request) + { + return $this->start()->uri("/api/ip-acl") ->urlSegment($accessControlListId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the identity provider with the given Id. @@ -5515,14 +5517,14 @@ public function updateIPAccessControlList($accessControlListId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateIdentityProvider($identityProviderId, $request) - { - return $this->start()->uri("/api/identity-provider") + public function updateIdentityProvider($identityProviderId, $request) + { + return $this->start()->uri("/api/identity-provider") ->urlSegment($identityProviderId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the available integrations. @@ -5532,13 +5534,13 @@ public function updateIdentityProvider($identityProviderId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateIntegrations($request) - { - return $this->start()->uri("/api/integration") + public function updateIntegrations($request) + { + return $this->start()->uri("/api/integration") ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the key with the given Id. @@ -5549,14 +5551,14 @@ public function updateIntegrations($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateKey($keyId, $request) - { - return $this->start()->uri("/api/key") + public function updateKey($keyId, $request) + { + return $this->start()->uri("/api/key") ->urlSegment($keyId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the lambda with the given Id. @@ -5567,14 +5569,14 @@ public function updateKey($keyId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateLambda($lambdaId, $request) - { - return $this->start()->uri("/api/lambda") + public function updateLambda($lambdaId, $request) + { + return $this->start()->uri("/api/lambda") ->urlSegment($lambdaId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the message template with the given Id. @@ -5585,14 +5587,14 @@ public function updateLambda($lambdaId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateMessageTemplate($messageTemplateId, $request) - { - return $this->start()->uri("/api/message/template") + public function updateMessageTemplate($messageTemplateId, $request) + { + return $this->start()->uri("/api/message/template") ->urlSegment($messageTemplateId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the messenger with the given Id. @@ -5603,14 +5605,14 @@ public function updateMessageTemplate($messageTemplateId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateMessenger($messengerId, $request) - { - return $this->start()->uri("/api/messenger") + public function updateMessenger($messengerId, $request) + { + return $this->start()->uri("/api/messenger") ->urlSegment($messengerId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the registration for the user with the given id and the application defined in the request. @@ -5621,14 +5623,14 @@ public function updateMessenger($messengerId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateRegistration($userId, $request) - { - return $this->start()->uri("/api/user/registration") + public function updateRegistration($userId, $request) + { + return $this->start()->uri("/api/user/registration") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the system configuration. @@ -5638,13 +5640,13 @@ public function updateRegistration($userId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateSystemConfiguration($request) - { - return $this->start()->uri("/api/system-configuration") + public function updateSystemConfiguration($request) + { + return $this->start()->uri("/api/system-configuration") ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the tenant with the given Id. @@ -5655,14 +5657,14 @@ public function updateSystemConfiguration($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateTenant($tenantId, $request) - { - return $this->start()->uri("/api/tenant") + public function updateTenant($tenantId, $request) + { + return $this->start()->uri("/api/tenant") ->urlSegment($tenantId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the theme with the given Id. @@ -5673,14 +5675,14 @@ public function updateTenant($tenantId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateTheme($themeId, $request) - { - return $this->start()->uri("/api/theme") + public function updateTheme($themeId, $request) + { + return $this->start()->uri("/api/theme") ->urlSegment($themeId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the user with the given Id. @@ -5691,14 +5693,14 @@ public function updateTheme($themeId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateUser($userId, $request) - { - return $this->start()->uri("/api/user") + public function updateUser($userId, $request) + { + return $this->start()->uri("/api/user") ->urlSegment($userId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the user action with the given Id. @@ -5709,14 +5711,14 @@ public function updateUser($userId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateUserAction($userActionId, $request) - { - return $this->start()->uri("/api/user-action") + public function updateUserAction($userActionId, $request) + { + return $this->start()->uri("/api/user-action") ->urlSegment($userActionId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the user action reason with the given Id. @@ -5727,14 +5729,14 @@ public function updateUserAction($userActionId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateUserActionReason($userActionReasonId, $request) - { - return $this->start()->uri("/api/user-action-reason") + public function updateUserActionReason($userActionReasonId, $request) + { + return $this->start()->uri("/api/user-action-reason") ->urlSegment($userActionReasonId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates a single User consent by Id. @@ -5745,14 +5747,14 @@ public function updateUserActionReason($userActionReasonId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateUserConsent($userConsentId, $request) - { - return $this->start()->uri("/api/user/consent") + public function updateUserConsent($userConsentId, $request) + { + return $this->start()->uri("/api/user/consent") ->urlSegment($userConsentId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Updates the webhook with the given Id. @@ -5763,14 +5765,14 @@ public function updateUserConsent($userConsentId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function updateWebhook($webhookId, $request) - { - return $this->start()->uri("/api/webhook") + public function updateWebhook($webhookId, $request) + { + return $this->start()->uri("/api/webhook") ->urlSegment($webhookId) ->bodyHandler(new JSONBodyHandler($request)) ->put() ->go(); - } + } /** * Creates or updates an Entity Grant. This is when a User/Entity is granted permissions to an Entity. @@ -5781,15 +5783,15 @@ public function updateWebhook($webhookId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function upsertEntityGrant($entityId, $request) - { - return $this->start()->uri("/api/entity") + public function upsertEntityGrant($entityId, $request) + { + return $this->start()->uri("/api/entity") ->urlSegment($entityId) ->urlSegment("grant") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Validates the end-user provided user_code from the user-interaction of the Device Authorization Grant. @@ -5801,14 +5803,14 @@ public function upsertEntityGrant($entityId, $request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function validateDevice($user_code, $client_id) - { - return $this->startAnonymous()->uri("/oauth2/device/validate") + public function validateDevice($user_code, $client_id) + { + return $this->startAnonymous()->uri("/oauth2/device/validate") ->urlParameter("user_code", $user_code) ->urlParameter("client_id", $client_id) ->get() ->go(); - } + } /** * Validates the provided JWT (encoded JWT string) to ensure the token is valid. A valid access token is properly @@ -5821,23 +5823,23 @@ public function validateDevice($user_code, $client_id) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function validateJWT($encodedJWT) - { - return $this->startAnonymous()->uri("/api/jwt/validate") + public function validateJWT($encodedJWT) + { + return $this->startAnonymous()->uri("/api/jwt/validate") ->authorization("Bearer " . $encodedJWT) ->get() ->go(); - } + } /** * It's a JWT vending machine! - * - * Issue a new access token (JWT) with the provided claims in the request. This JWT is not scoped to a tenant or user, it is a free form + * + * Issue a new access token (JWT) with the provided claims in the request. This JWT is not scoped to a tenant or user, it is a free form * token that will contain what claims you provide. *

* The iat, exp and jti claims will be added by FusionAuth, all other claims must be provided by the caller. - * - * If a TTL is not provided in the request, the TTL will be retrieved from the default Tenant or the Tenant specified on the request either + * + * If a TTL is not provided in the request, the TTL will be retrieved from the default Tenant or the Tenant specified on the request either * by way of the X-FusionAuth-TenantId request header, or a tenant scoped API key. * * @param array $request The request that contains all the claims for this JWT. @@ -5845,13 +5847,13 @@ public function validateJWT($encodedJWT) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function vendJWT($request) - { - return $this->start()->uri("/api/jwt/vend") + public function vendJWT($request) + { + return $this->start()->uri("/api/jwt/vend") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Confirms a email verification. The Id given is usually from an email sent to the user. @@ -5862,20 +5864,20 @@ public function vendJWT($request) * @throws \Exception * @deprecated This method has been renamed to verifyEmailAddress and changed to take a JSON request body, use that method instead. */ - public function verifyEmail($verificationId) - { - return $this->startAnonymous()->uri("/api/user/verify-email") + public function verifyEmail($verificationId) + { + return $this->startAnonymous()->uri("/api/user/verify-email") ->urlSegment($verificationId) ->post() ->go(); - } + } /** - * Confirms a user's email address. - * - * The request body will contain the verificationId. You may also be required to send a one-time use code based upon your configuration. When - * the tenant is configured to gate a user until their email address is verified, this procedures requires two values instead of one. - * The verificationId is a high entropy value and the one-time use code is a low entropy value that is easily entered in a user interactive form. The + * Confirms a user's email address. + * + * The request body will contain the verificationId. You may also be required to send a one-time use code based upon your configuration. When + * the tenant is configured to gate a user until their email address is verified, this procedures requires two values instead of one. + * The verificationId is a high entropy value and the one-time use code is a low entropy value that is easily entered in a user interactive form. The * two values together are able to confirm a user's email address and mark the user's email address as verified. * * @param array $request The request that contains the verificationId and optional one-time use code paired with the verificationId. @@ -5883,17 +5885,17 @@ public function verifyEmail($verificationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function verifyEmailAddress($request) - { - return $this->startAnonymous()->uri("/api/user/verify-email") + public function verifyEmailAddress($request) + { + return $this->startAnonymous()->uri("/api/user/verify-email") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Administratively verify a user's email address. Use this method to bypass email verification for the user. - * + * * The request body will contain the userId to be verified. An API key is required when sending the userId in the request body. * * @param array $request The request that contains the userId to verify. @@ -5901,13 +5903,13 @@ public function verifyEmailAddress($request) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function verifyEmailAddressByUserId($request) - { - return $this->start()->uri("/api/user/verify-email") + public function verifyEmailAddressByUserId($request) + { + return $this->start()->uri("/api/user/verify-email") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } + } /** * Confirms an application registration. The Id given is usually from an email sent to the user. @@ -5918,20 +5920,20 @@ public function verifyEmailAddressByUserId($request) * @throws \Exception * @deprecated This method has been renamed to verifyUserRegistration and changed to take a JSON request body, use that method instead. */ - public function verifyRegistration($verificationId) - { - return $this->startAnonymous()->uri("/api/user/verify-registration") + public function verifyRegistration($verificationId) + { + return $this->startAnonymous()->uri("/api/user/verify-registration") ->urlSegment($verificationId) ->post() ->go(); - } + } /** - * Confirms a user's registration. - * - * The request body will contain the verificationId. You may also be required to send a one-time use code based upon your configuration. When - * the application is configured to gate a user until their registration is verified, this procedures requires two values instead of one. - * The verificationId is a high entropy value and the one-time use code is a low entropy value that is easily entered in a user interactive form. The + * Confirms a user's registration. + * + * The request body will contain the verificationId. You may also be required to send a one-time use code based upon your configuration. When + * the application is configured to gate a user until their registration is verified, this procedures requires two values instead of one. + * The verificationId is a high entropy value and the one-time use code is a low entropy value that is easily entered in a user interactive form. The * two values together are able to confirm a user's registration and mark the user's registration as verified. * * @param array $request The request that contains the verificationId and optional one-time use code paired with the verificationId. @@ -5939,30 +5941,30 @@ public function verifyRegistration($verificationId) * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function verifyUserRegistration($request) - { - return $this->startAnonymous()->uri("/api/user/verify-registration") + public function verifyUserRegistration($request) + { + return $this->startAnonymous()->uri("/api/user/verify-registration") ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); - } - + } - private function start() - { - return $this->startAnonymous()->authorization($this->apiKey); - } - private function startAnonymous() - { - $rest = new RESTClient(); - if (isset($this->tenantId)) { - $rest->header("X-FusionAuth-TenantId", $this->tenantId); + private function start() + { + return $this->startAnonymous()->authorization($this->apiKey); } - return $rest->url($this->baseURL) + + private function startAnonymous() + { + $rest = new RESTClient(); + if (isset($this->tenantId)) { + $rest->header("X-FusionAuth-TenantId", $this->tenantId); + } + return $rest->url($this->baseURL) ->connectTimeout($this->connectTimeout) ->readTimeout($this->readTimeout) ->successResponseHandler(new JSONResponseHandler()) ->errorResponseHandler(new JSONResponseHandler()); - } -} \ No newline at end of file + } +} diff --git a/src/FusionAuth/RESTClient.php b/src/FusionAuth/RESTClient.php index 562fe9f..84f649e 100644 --- a/src/FusionAuth/RESTClient.php +++ b/src/FusionAuth/RESTClient.php @@ -1,4 +1,5 @@ resetAuthorizationHeaders(); + public function authorization($key) + { + // Remove any Authorization headers before adding a new one. + $this->resetAuthorizationHeaders(); + + // Add the Authorization header. + $this->headers[] = 'Authorization: ' . $key; - // Add the Authorization header. - $this->headers[] = 'Authorization: ' . $key; + return $this; + } - return $this; - } + public function basicAuthorization($username, $password) + { + if (!is_null($username) && !is_null($password)) { + // Remove any Authorization headers before adding a new one. + $this->resetAuthorizationHeaders(); - public function basicAuthorization($username, $password) - { - if (!is_null($username) && !is_null($password)) { - // Remove any Authorization headers before adding a new one. - $this->resetAuthorizationHeaders(); + // Add the Authorization header. + $credentials = $username . ':' . $password; + $encoded = base64_encode($credentials); + $this->headers[] = 'Authorization: ' . 'Basic ' . $encoded; + } - // Add the Authorization header. - $credentials = $username . ':' . $password; - $encoded = base64_encode($credentials); - $this->headers[] = 'Authorization: ' . 'Basic ' . $encoded; + return $this; } - return $this; - } + protected function resetAuthorizationHeaders() + { + $headers = []; + foreach ($this->headers as $value) { + if (stripos($value, "Authorization:") !== 0) { + $headers[] = $value; + } + } + $this->headers = $headers; + } - protected function resetAuthorizationHeaders() - { - $headers = []; - foreach ($this->headers as $value) { - if (stripos($value, "Authorization:") !== 0) { - $headers[] = $value; - } + public function bodyHandler($bodyHandler) + { + $this->bodyHandler = $bodyHandler; + return $this; } - $this->headers = $headers; - } - - public function bodyHandler($bodyHandler) - { - $this->bodyHandler = $bodyHandler; - return $this; - } - - public function certificate($certificate) - { - $this->certificate = $certificate; - return $this; - } - - public function connectTimeout($connectTimeout) - { - $this->connectTimeout = $connectTimeout; - return $this; - } - - public function delete() - { - $this->method = 'DELETE'; - return $this; - } - - public function errorResponseHandler($errorResponseHandler) - { - $this->errorResponseHandler = $errorResponseHandler; - return $this; - } - - public function get() - { - $this->method = 'GET'; - return $this; - } - - public function go() - { - if (!$this->url || (bool)parse_url($this->url, PHP_URL_HOST) === FALSE) { - throw new \Exception('You must specify a URL'); + + public function certificate($certificate) + { + $this->certificate = $certificate; + return $this; } - if (!$this->method) { - throw new \Exception('You must specify a HTTP method'); + public function connectTimeout($connectTimeout) + { + $this->connectTimeout = $connectTimeout; + return $this; } - $response = new ClientResponse(); - $response->request = ($this->bodyHandler != NULL) ? $this->bodyHandler->bodyObject() : NULL; - $response->method = $this->method; + public function delete() + { + $this->method = 'DELETE'; + return $this; + } - try { - if ($this->parameters) { - if (substr($this->url, -1) != '?') { - $this->url = $this->url . '?'; - } + public function errorResponseHandler($errorResponseHandler) + { + $this->errorResponseHandler = $errorResponseHandler; + return $this; + } - $parts = array(); - foreach ($this->parameters as $key => $value) { - if (is_array($value)) { - foreach ($value as $value2) { - $parts[] = http_build_query(array($key => $value2)); - } - } else { - $parts[] = http_build_query(array($key => $value)); - } - } - $params = join('&', $parts); - $this->url = $this->url . $params; - } - - $curl = curl_init(); - if (substr($this->url, 0, 5) == 'https' && $this->certificate) { - if ($this->certificate) { - curl_setopt($curl, CURLOPT_SSLCERT, $this->certificate); - } + public function get() + { + $this->method = 'GET'; + return $this; + } - if ($this->key) { - curl_setopt($curl, CURLOPT_SSLKEY, $this->key); + public function go() + { + if (!$this->url || (bool)parse_url($this->url, PHP_URL_HOST) === false) { + throw new \Exception('You must specify a URL'); } - } - if ($this->proxy) { - curl_setopt($curl, CURLOPT_PROXY, $this->proxy['url']); - if (isset($this->proxy['auth'])) { - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxy['auth']); + if (!$this->method) { + throw new \Exception('You must specify a HTTP method'); } - } - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout); - curl_setopt($curl, CURLOPT_TIMEOUT_MS, $this->readTimeout); - curl_setopt($curl, CURLOPT_URL, $this->url); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_POST, false); - curl_setopt($curl, CURLOPT_FAILONERROR, false); + $response = new ClientResponse(); + $response->request = ($this->bodyHandler != null) ? $this->bodyHandler->bodyObject() : null; + $response->method = $this->method; + + try { + if ($this->parameters) { + if (substr($this->url, -1) != '?') { + $this->url = $this->url . '?'; + } + + $parts = array(); + foreach ($this->parameters as $key => $value) { + if (is_array($value)) { + foreach ($value as $value2) { + $parts[] = http_build_query(array($key => $value2)); + } + } else { + $parts[] = http_build_query(array($key => $value)); + } + } + $params = join('&', $parts); + $this->url = $this->url . $params; + } - if ($this->method == 'POST') { - curl_setopt($curl, CURLOPT_POST, true); - } elseif ($this->method != 'GET') { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $this->method); - } + $curl = curl_init(); + if (str_starts_with($this->url, 'https') && !empty($this->certificate)) { + curl_setopt($curl, CURLOPT_SSLCERT, $this->certificate); + if (!empty($this->key)) { + curl_setopt($curl, CURLOPT_SSLKEY, $this->key); + } + } - if ($this->bodyHandler) { - $this->bodyHandler->setHeaders($this->headers); - } + if ($this->proxy) { + curl_setopt($curl, CURLOPT_PROXY, $this->proxy['url']); + if (isset($this->proxy['auth'])) { + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxy['auth']); + } + } - curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers); + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout); + curl_setopt($curl, CURLOPT_TIMEOUT_MS, $this->readTimeout); + curl_setopt($curl, CURLOPT_URL, $this->url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_POST, false); + curl_setopt($curl, CURLOPT_FAILONERROR, false); + + if ($this->method === 'POST') { + curl_setopt($curl, CURLOPT_POST, true); + } elseif ($this->method !== 'GET') { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $this->method); + } - if ($this->bodyHandler) { - curl_setopt($curl, CURLOPT_POSTFIELDS, $this->bodyHandler->body()); - } + if ($this->bodyHandler) { + $this->bodyHandler->setHeaders($this->headers); + } - $result = curl_exec($curl); + if ($this->bodyHandler) { + $body = $this->bodyHandler->body(); + if (!empty($body)) { + curl_setopt($curl, CURLOPT_POSTFIELDS, $body); + } + } elseif (!\in_array('Content-Type: application/json', $this->headers)) { + // Making sure we have 'application/json' set + $this->headers[] = 'Content-Type: application/json'; + } + if (($this->method === 'POST') && (empty($body))) { + // Making sure we always have a body + curl_setopt($curl, CURLOPT_POSTFIELDS, ''); + } - $response->status = curl_getinfo($curl, CURLINFO_HTTP_CODE); - if ($response->status < 200 || $response->status > 299) { - if ($result) { - $response->errorResponse = $this->errorResponseHandler->call($result); - } - } else { - if ($result) { - $response->successResponse = $this->successResponseHandler->call($result); + // https://www.php.net/manual/pt_BR/function.curl-setopt.php#108137 + if (empty($body)) { + if (!\in_array('Expect:', $this->headers)) { + $this->headers[] = 'Expect:'; + } + } + + curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers); + + $result = curl_exec($curl); + + $response->status = curl_getinfo($curl, CURLINFO_HTTP_CODE); + if ($response->status < 200 || $response->status > 299) { + if ($result) { + $response->errorResponse = $this->errorResponseHandler->call($result); + } + } else { + if ($result) { + $response->successResponse = $this->successResponseHandler->call($result); + } + } + + curl_close($curl); + return $response; + } catch (\Exception $e) { + if (isset($curl)) { + curl_close($curl); + } + + $response->exception = $e; + return $response; } - } + } - curl_close($curl); - return $response; - } catch (\Exception $e) { - if (isset($curl)) { - curl_close($curl); - } + public function header($name, $value) + { + $this->headers[] = $name . ': ' . $value; + return $this; + } - $response->exception = $e; - return $response; + public function headers($headers) + { + $this->headers = $headers; + return $this; } - } - - public function header($name, $value) - { - $this->headers[] = $name . ': ' . $value; - return $this; - } - - public function headers($headers) - { - $this->headers = $headers; - return $this; - } - - public function patch() - { - $this->method = 'PATCH'; - return $this; - } - - public function post() - { - $this->method = 'POST'; - return $this; - } - - public function put() - { - $this->method = 'PUT'; - return $this; - } - - public function readTimeout($readTimeout) - { - $this->readTimeout = $readTimeout; - return $this; - } - - public function successResponseHandler($successResponseHandler) - { - $this->successResponseHandler = $successResponseHandler; - return $this; - } - - public function uri($uri) - { - if (!$this->url) { - return $this; + + public function patch() + { + $this->method = 'PATCH'; + return $this; + } + + public function post() + { + $this->method = 'POST'; + return $this; + } + + public function put() + { + $this->method = 'PUT'; + return $this; } - if (substr($this->url, -1) == '/' && substr($uri, 1, 1) == '/') { - $this->url = $this->url . ltrim($uri, '/'); - } else if (substr($this->url, -1) != '/' && substr($uri, 0, 1) != '/') { - $this->url = $this->url . '/' . $uri; - } else { - $this->url = $this->url . $uri; + public function readTimeout($readTimeout) + { + $this->readTimeout = $readTimeout; + return $this; } - return $this; - } + public function successResponseHandler($successResponseHandler) + { + $this->successResponseHandler = $successResponseHandler; + return $this; + } - public function url($url) - { - $this->url = $url; - return $this; - } + public function uri($uri) + { + if (!$this->url) { + return $this; + } - public function urlParameter($name, $value) - { - if (!isset($value)) { - return $this; + if (substr($this->url, -1) == '/' && substr($uri, 1, 1) == '/') { + $this->url = $this->url . ltrim($uri, '/'); + } elseif (substr($this->url, -1) != '/' && substr($uri, 0, 1) != '/') { + $this->url = $this->url . '/' . $uri; + } else { + $this->url = $this->url . $uri; + } + + return $this; } - if (is_array($value)) { - $this->parameters[$name] = $value; - } else { - if (!isset($this->parameters[$name])) { - $this->parameters[$name] = array(); - } - - if (is_bool($value)) { - $this->parameters[$name][] = var_export($value, true); - } else { - $this->parameters[$name][] = $value; - } + public function url($url) + { + $this->url = $url; + return $this; } - return $this; - } + public function urlParameter($name, $value) + { + if (!isset($value)) { + return $this; + } - public function urlSegment($value) - { - if (isset($value)) { - if (substr($this->url, -1) != '/') { - $this->url = $this->url . '/'; - } - $this->url = $this->url . $value; + if (is_array($value)) { + $this->parameters[$name] = $value; + } else { + if (!isset($this->parameters[$name])) { + $this->parameters[$name] = array(); + } + + if (is_bool($value)) { + $this->parameters[$name][] = var_export($value, true); + } else { + $this->parameters[$name][] = $value; + } + } + + return $this; + } + + public function urlSegment($value) + { + if (isset($value)) { + if (substr($this->url, -1) != '/') { + $this->url = $this->url . '/'; + } + $this->url = $this->url . $value; + } + return $this; } - return $this; - } } interface BodyHandler @@ -362,86 +379,86 @@ interface BodyHandler /** * @return string The body as a string. */ - public function body(); + public function body(); /** * @return mixed The body as an object (usually an array). */ - public function bodyObject(); + public function bodyObject(); /** * Sets body handler specific headers (like Content-Type). * * @param array $headers The headers array to add headers to. */ - public function setHeaders(&$headers); + public function setHeaders(&$headers); } class FormDataBodyHandler implements BodyHandler { - private $body; - - private $bodyObject; - - public function __construct(&$bodyObject) - { - $this->bodyObject = $bodyObject; - $this->body = http_build_query($bodyObject); - } - - public function body() - { - return $this->body; - } - - public function bodyObject() - { - return $this->bodyObject; - } - - public function setHeaders(&$headers) - { - /* body() will return a URL encoded body, CURLOPT_POSTFIELDS will then set the header - to ContentType: application/x-www-form-urlencoded - */ - } + private $body; + + private $bodyObject; + + public function __construct(&$bodyObject) + { + $this->bodyObject = $bodyObject; + $this->body = http_build_query($bodyObject); + } + + public function body() + { + return $this->body; + } + + public function bodyObject() + { + return $this->bodyObject; + } + + public function setHeaders(&$headers) + { + /* body() will return a URL encoded body, CURLOPT_POSTFIELDS will then set the header + to ContentType: application/x-www-form-urlencoded + */ + } } class JSONBodyHandler implements BodyHandler { - private $body; + private $body; - private $bodyObject; + private $bodyObject; - public function __construct(&$bodyObject) - { - $this->bodyObject = $bodyObject; + public function __construct(&$bodyObject) + { + $this->bodyObject = $bodyObject; - if (is_string($bodyObject)) { - $bodyObject = json_decode($bodyObject); - } - if (is_object($bodyObject)) { - $bodyObject = (array) $bodyObject; - } + if (is_string($bodyObject)) { + $bodyObject = json_decode($bodyObject); + } + if (is_object($bodyObject)) { + $bodyObject = (array) $bodyObject; + } - $this->body = json_encode(array_filter($bodyObject)); - } + $this->body = json_encode(array_filter($bodyObject)); + } - public function body() - { - return $this->body; - } + public function body() + { + return $this->body; + } - public function bodyObject() - { - return $this->bodyObject; - } + public function bodyObject() + { + return $this->bodyObject; + } - public function setHeaders(&$headers) - { - $headers[] = 'Content-Length: ' . strlen($this->body); - $headers[] = 'Content-Type: application/json'; - } + public function setHeaders(&$headers) + { + $headers[] = 'Content-Length: ' . strlen($this->body); + $headers[] = 'Content-Type: application/json'; + } } interface ResponseHandler @@ -452,13 +469,13 @@ interface ResponseHandler * @param string $response The HTTP response as a String. * @return mixed The response as an object. */ - public function call(&$response); + public function call(&$response); } class JSONResponseHandler implements ResponseHandler { - public function call(&$response) - { - return json_decode($response); - } + public function call(&$response) + { + return json_decode($response); + } } diff --git a/tests/FusionAuth/FusionAuthClientTest.php b/tests/FusionAuth/FusionAuthClientTest.php index abad760..27fc9b2 100644 --- a/tests/FusionAuth/FusionAuthClientTest.php +++ b/tests/FusionAuth/FusionAuthClientTest.php @@ -1,176 +1,209 @@ client = new FusionAuthClient($fusionauthApiKey, $fusionauthURL); - } - - protected function tearDown(): void - { - $this->client->deleteApplication($this->applicationId); - $this->client->deleteUser($this->userId); - } - - public function test_applications() - { - // Create it - $response = $this->client->createApplication(null, ["application" => ["name" => "PHP Client Application"]]); - $this->handleResponse($response); - $this->applicationId = $response->successResponse->application->id; - - // Retrieve it - $response = $this->client->retrieveApplication($this->applicationId); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->application->name, "PHP Client Application"); - - // Update it - $response = $this->client->updateApplication($this->applicationId, [ "application" => ["name" => "PHP Client Application Updated"]]); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->application->name, "PHP Client Application Updated"); - - // Retrieve it again - $response = $this->client->retrieveApplication($this->applicationId); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->application->name, "PHP Client Application Updated"); - - // Deactivate it - $response = $this->client->deactivateApplication($this->applicationId); - $this->handleResponse($response); - - // Retrieve it again - $response = $this->client->retrieveApplication($this->applicationId); - $this->handleResponse($response); - $this->assertFalse($response->successResponse->application->active); - - // Retrieve inactive - $response = $this->client->retrieveInactiveApplications(); - $this->assertEquals($response->successResponse->applications[0]->name, "PHP Client Application Updated"); - - // Reactivate it - $response = $this->client->reactivateApplication($this->applicationId); - $this->handleResponse($response); - - // Retrieve it again - $response = $this->client->retrieveApplication($this->applicationId); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->application->name, "PHP Client Application Updated"); - $this->assertTrue($response->successResponse->application->active); - - // Delete it - $response = $this->client->deleteApplication($this->applicationId); - $this->handleResponse($response); - - // Retrieve it again - $response = $this->client->retrieveApplication($this->applicationId); - $this->assertEquals($response->status, 404); - - // Retrieve inactive - $response = $this->client->retrieveInactiveApplications(); - $this->assertFalse(isset($response->successResponse->applications)); - } - - public function test_users() - { - // Create it - $response = $this->client->createUser(null, ["user" => ["email" => "test@fusionauth.io", "password" => "password", "firstName" => "Jäne"]]); - $this->handleResponse($response); - $this->userId = $response->successResponse->user->id; - - // Retrieve it - $response = $this->client->retrieveUser($this->userId); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->user->email, "test@fusionauth.io"); - - // Login - $response = $this->client->login(["loginId" => "test@fusionauth.io", "password" => "password"]); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->user->email, "test@fusionauth.io"); - - // Update it - $response = $this->client->updateUser($this->userId, [ "user" => ["email" => "test+2@fusionauth.io"]]); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->user->email, "test+2@fusionauth.io"); - - // Retrieve it again - $response = $this->client->retrieveUser($this->userId); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->user->email, "test+2@fusionauth.io"); - - // Deactivate it - $response = $this->client->deactivateUser($this->userId); - $this->handleResponse($response); - - // Retrieve it again - $response = $this->client->retrieveUser($this->userId); - $this->handleResponse($response); - $this->assertFalse($response->successResponse->user->active); - - // Reactivate it - $response = $this->client->reactivateUser($this->userId); - $this->handleResponse($response); - - // Retrieve it again - $response = $this->client->retrieveUser($this->userId); - $this->handleResponse($response); - $this->assertEquals($response->successResponse->user->email, "test+2@fusionauth.io"); - $this->assertTrue($response->successResponse->user->active); - - // Delete it - $response = $this->client->deleteUser($this->userId); - $this->handleResponse($response); - - // Retrieve it again - $response = $this->client->retrieveUser($this->userId); - $this->assertEquals($response->status, 404); - } - - public function test_logout() { - // Without parameter - $response = $this->client->logout(true); - $this->handleResponse($response); - - // With NULL - $response = $this->client->logout(true, NULL); - $this->handleResponse($response); - - // With bogus token - $response = $this->client->logout(false, "token"); - $this->handleResponse($response); - } - - /** - * @param $response ClientResponse - */ - private function handleResponse($response) - { - if (!$response->wasSuccessful()) { - print "Status: " . $response->status . "\n"; - print json_encode($response->errorResponse, JSON_PRETTY_PRINT); + private string $applicationId; + + private string $userId; + + private FusionAuthClient $client; + + protected function setUp(): void + { + $fusionauthURL = getenv('FUSIONAUTH_URL') ?: 'http://localhost:9011'; + $fusionauthApiKey = getenv('FUSIONAUTH_API_KEY') ?: 'bf69486b-4733-4470-a592-f1bfce7af580'; + $this->client = new FusionAuthClient($fusionauthApiKey, $fusionauthURL); + } + + protected function tearDown(): void + { + if (isset($this->applicationId)) { + $this->client->deleteApplication($this->applicationId); + } + if (isset($this->userId)) { + $this->client->deleteUser($this->userId); + } + } + + /** + * @throws \Exception + */ + public function testCanHandleApplications(): void + { + // Create it + $response = $this->client->createApplication(null, ["application" => ["name" => "PHP Client Application"]]); + $this->handleResponse($response); + $this->applicationId = $response->successResponse->application->id; + + // Retrieve it + $response = $this->client->retrieveApplication($this->applicationId); + $this->handleResponse($response); + $this->assertEquals("PHP Client Application", $response->successResponse->application->name); + + // Update it + $response = $this->client->updateApplication( + $this->applicationId, + ["application" => ["name" => "PHP Client Application Updated"]] + ); + $this->handleResponse($response); + $this->assertEquals("PHP Client Application Updated", $response->successResponse->application->name); + + // Retrieve it again + $response = $this->client->retrieveApplication($this->applicationId); + $this->handleResponse($response); + $this->assertEquals("PHP Client Application Updated", $response->successResponse->application->name); + + // Deactivate it + $response = $this->client->deactivateApplication($this->applicationId); + $this->handleResponse($response); + + // Retrieve it again + $response = $this->client->retrieveApplication($this->applicationId); + $this->handleResponse($response); + $this->assertFalse($response->successResponse->application->active); + + // Retrieve inactive + $response = $this->client->retrieveInactiveApplications(); + $this->assertEquals("PHP Client Application Updated", $response->successResponse->applications[0]->name); + + // Reactivate it + $response = $this->client->reactivateApplication($this->applicationId); + $this->handleResponse($response); + + // Retrieve it again + $response = $this->client->retrieveApplication($this->applicationId); + $this->handleResponse($response); + $this->assertEquals("PHP Client Application Updated", $response->successResponse->application->name); + $this->assertTrue($response->successResponse->application->active); + + // Delete it + $response = $this->client->deleteApplication($this->applicationId); + $this->handleResponse($response); + + // Retrieve it again + $response = $this->client->retrieveApplication($this->applicationId); + $this->assertEquals(404, $response->status); + + // Retrieve inactive + $response = $this->client->retrieveInactiveApplications(); + $this->assertEmpty($response->successResponse->applications); } - $this->assertTrue($response->wasSuccessful(), "Expected success. Status: " . $response->status); - } -} \ No newline at end of file + /** + * @throws \Exception + */ + public function testCanHandleUsers(): void + { + // Create it + $response = $this->client->createUser( + null, + ["user" => ["email" => "test@fusionauth.io", "password" => "password", "firstName" => "Jäne"]] + ); + $this->handleResponse($response); + $this->userId = $response->successResponse->user->id; + + // Retrieve it + $response = $this->client->retrieveUser($this->userId); + $this->handleResponse($response); + $this->assertEquals("test@fusionauth.io", $response->successResponse->user->email); + + // Login + $response = $this->client->login(["loginId" => "test@fusionauth.io", "password" => "password"]); + $this->handleResponse($response); + $this->assertEquals("test@fusionauth.io", $response->successResponse->user->email); + + // Update it + $response = $this->client->updateUser($this->userId, ["user" => ["email" => "test+2@fusionauth.io"]]); + $this->handleResponse($response); + $this->assertEquals("test+2@fusionauth.io", $response->successResponse->user->email); + + // Retrieve it again + $response = $this->client->retrieveUser($this->userId); + $this->handleResponse($response); + $this->assertEquals("test+2@fusionauth.io", $response->successResponse->user->email); + + // Deactivate it + $response = $this->client->deactivateUser($this->userId); + $this->handleResponse($response); + + // Retrieve it again + $response = $this->client->retrieveUser($this->userId); + $this->handleResponse($response); + $this->assertFalse($response->successResponse->user->active); + + // Reactivate it + $response = $this->client->reactivateUser($this->userId); + $this->handleResponse($response); + + // Retrieve it again + $response = $this->client->retrieveUser($this->userId); + $this->handleResponse($response); + $this->assertEquals($response->successResponse->user->email, "test+2@fusionauth.io"); + $this->assertTrue($response->successResponse->user->active); + + // Delete it + $response = $this->client->deleteUser($this->userId); + $this->handleResponse($response); + + // Retrieve it again + $response = $this->client->retrieveUser($this->userId); + $this->assertEquals(404, $response->status); + } + + /** + * @throws \Exception + */ + public function testCanLogoutWithoutRefreshToken(): void + { + // Without parameter + $response = $this->client->logout(true, null); + $this->handleResponse($response); + } + + /** + * @throws \Exception + */ + public function testCanLogoutWithRefreshToken(): void + { + // With NULL + $response = $this->client->logout(true, 'refresh_token'); + $this->handleResponse($response); + } + + /** + * @throws \Exception + */ + public function testCanLogoutWithBogusToken(): void + { + // With bogus token + $response = $this->client->logout(false, "token"); + $this->handleResponse($response); + } + + /** + * @param $response ClientResponse + */ + private function handleResponse(ClientResponse $response): void + { + if (!$response->wasSuccessful()) { + fwrite(STDERR, "Status: " . $response->status . PHP_EOL); + fwrite(STDERR, json_encode($response->errorResponse, JSON_PRETTY_PRINT) . PHP_EOL); + } + + $this->assertTrue( + $response->wasSuccessful(), + "Expected success. Status: {$response->status}" + ); + } +}