From 402adbe4c7e2d177c8953b6957b250c582615434 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 3 Dec 2023 07:35:41 +0100 Subject: [PATCH 01/81] Ported EmailLinks and SMSCodes --- examples/test.php | 18 +- examples/validation.php | 28 ++ src/Classes/Apis/EmailLinks.php | 138 +++------ src/Classes/Apis/EmailLinksInterface.php | 13 + src/Classes/Apis/SMSCodes.php | 127 +++----- src/Classes/Apis/SMSCodesInterface.php | 13 + src/Classes/Apis/Validation.php | 152 ---------- src/Classes/Apis/Validations.php | 87 ++++++ src/Classes/Apis/ValidationsInterface.php | 13 + src/Classes/Apis/WebAuthn.php | 280 ------------------ src/Classes/Apis/Widget.php | 68 ----- src/Classes/Assert.php | 26 +- src/Classes/Exceptions/Assert.php | 6 - ...{Configuration.php => AssertException.php} | 2 +- .../Exceptions/ConfigurationException.php | 6 + .../{Http.php => ServerException.php} | 2 +- .../{Standard.php => StandardException.php} | 2 +- src/Classes/Helper.php | 41 ++- src/Classes/Session.php | 10 +- src/Classes/User.php | 18 +- src/Classes/Webhook.php | 40 +-- src/Configuration.php | 32 +- src/SDK.php | 95 +++--- tests/Classes/SessionTest.php | 4 +- tests/Classes/UserTest.php | 2 +- 25 files changed, 402 insertions(+), 821 deletions(-) create mode 100644 examples/validation.php create mode 100644 src/Classes/Apis/EmailLinksInterface.php create mode 100644 src/Classes/Apis/SMSCodesInterface.php delete mode 100644 src/Classes/Apis/Validation.php create mode 100644 src/Classes/Apis/Validations.php create mode 100644 src/Classes/Apis/ValidationsInterface.php delete mode 100644 src/Classes/Apis/WebAuthn.php delete mode 100644 src/Classes/Apis/Widget.php delete mode 100644 src/Classes/Exceptions/Assert.php rename src/Classes/Exceptions/{Configuration.php => AssertException.php} (52%) create mode 100644 src/Classes/Exceptions/ConfigurationException.php rename src/Classes/Exceptions/{Http.php => ServerException.php} (96%) rename src/Classes/Exceptions/{Standard.php => StandardException.php} (51%) diff --git a/examples/test.php b/examples/test.php index f7e5ad0..8ac010c 100644 --- a/examples/test.php +++ b/examples/test.php @@ -1,25 +1,31 @@ setToken($corbadoAuthToken); - $request->setClientInfo(\Corbado\SDK::createClientInfo($remoteAddress, $userAgent)); + $request->setClientInfo(SDK::createClientInfo($remoteAddress, $userAgent)); - /** @var \Corbado\Generated\Model\AuthTokenValidateRsp $response */ + /** @var AuthTokenValidateRsp $response */ $response = $corbado->authTokens()->authTokenValidate($request); echo $response->getData()->getUserId(); -} catch (\Corbado\Generated\ApiException $e) { +} catch (ApiException $e) { echo $e->getMessage(); echo "\n"; diff --git a/examples/validation.php b/examples/validation.php new file mode 100644 index 0000000..8df683a --- /dev/null +++ b/examples/validation.php @@ -0,0 +1,28 @@ +setEmail('s@s.de'); + $request->setClientInfo(SDK::createClientInfo('127.0.0.1', 'PHP CLI')); + + $response = $corbado->validations()->validateEmail($request); + + echo $response->getData()->getIsValid() ? 'Valid' : 'Invalid'; + +} catch (ServerException $e) { + print_r($e->getMessage()); + print_r($e->getRuntime()); + print_r($e->getError()); +} catch (Throwable $e) { + echo 'Throwable:' . $e->getMessage(); +} \ No newline at end of file diff --git a/src/Classes/Apis/EmailLinks.php b/src/Classes/Apis/EmailLinks.php index c1283af..bcbff6f 100644 --- a/src/Classes/Apis/EmailLinks.php +++ b/src/Classes/Apis/EmailLinks.php @@ -3,133 +3,73 @@ namespace Corbado\Classes\Apis; use Corbado\Classes\Assert; -use Corbado\Classes\Exceptions\Http; -use Corbado\Classes\Exceptions\Standard; +use Corbado\Classes\Exceptions\AssertException; +use Corbado\Classes\Exceptions\ServerException; +use Corbado\Classes\Exceptions\StandardException; use Corbado\Classes\Helper; +use Corbado\Generated\Api\EmailMagicLinksApi; +use Corbado\Generated\ApiException; use Corbado\Generated\Model\EmailLinkSendReq; use Corbado\Generated\Model\EmailLinkSendRsp; -use Corbado\Generated\Model\EmailLinkSendRspAllOfData; use Corbado\Generated\Model\EmailLinksValidateReq; use Corbado\Generated\Model\EmailLinkValidateRsp; -use Corbado\SDK; -use GuzzleHttp\Exception\GuzzleException; -use GuzzleHttp\Psr7\Request; -use Psr\Http\Client\ClientExceptionInterface; -use Psr\Http\Client\ClientInterface; +use Corbado\Generated\Model\ErrorRsp; -class EmailLinks +class EmailLinks implements EmailLinksInterface { - private ClientInterface $client; - - public function __construct(ClientInterface $client) - { - $this->client = $client; - } + private EmailMagicLinksApi $api; /** - * @param string $projectID - * @return string[] + * @throws AssertException */ - private function generateHeaders(string $projectID): array + public function __construct(EmailMagicLinksApi $api) { - return ['X-Corbado-ProjectID' => $projectID]; + Assert::notNull($api); + $this->api = $api; } /** - * @throws Http - * @throws GuzzleException - * @throws ClientExceptionInterface - * @throws Standard - * @throws \Corbado\Classes\Exceptions\Assert + * @throws AssertException + * @throws ServerException + * @throws StandardException */ - public function send(string $projectID, string $email, string $templateName, string $redirect, string $remoteAddress, string $userAgent, bool $create = false, string $additionalPayload = "", ?string $requestID = ''): EmailLinkSendRsp + public function send(EmailLinkSendReq $req): EmailLinkSendRsp { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($email); - Assert::stringNotEmpty($templateName); - Assert::stringNotEmpty($redirect); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new EmailLinkSendReq(); - $request->setEmail($email); - $request->setTemplateName($templateName); - $request->setRedirect($redirect); - $request->setRequestId($requestID); - $request->setCreate($create); - $request->setAdditionalPayload($additionalPayload); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'POST', - '/v1/emailLinks', - ['body' => Helper::jsonEncode($request->jsonSerialize()), 'headers' => $this->generateHeaders($projectID)] - ) - ); + Assert::notNull($req); - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); + try { + $rsp = $this->api->emailLinkSend($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); } - $data = new EmailLinkSendRspAllOfData(); - $data->setEmailLinkId($json['data']['emailLinkID']); - - $response = new EmailLinkSendRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setData($data); + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } - return $response; + return $rsp; } /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws GuzzleException - * @throws ClientExceptionInterface - * @throws Standard + * @throws AssertException + * @throws ServerException + * @throws StandardException */ - public function validate(string $projectID, string $emailLinkID, string $token, string $remoteAddress, string $userAgent, ?string $requestID = ''): EmailLinkValidateRsp + public function validate(string $id, EmailLinksValidateReq $req): EmailLinkValidateRsp { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($emailLinkID); - Assert::stringNotEmpty($token); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new EmailLinksValidateReq(); - $request->setToken($token); - $request->setRequestId($requestID); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); + Assert::stringNotEmpty($id); + Assert::notNull($req); - $httpResponse = $this->client->sendRequest( - new Request( - 'PUT', - '/v1/emailLinks/' . $emailLinkID . '/validate', - ['body' => Helper::jsonEncode($request->jsonSerialize()), 'headers' => $this->generateHeaders($projectID)] - ) - ); - - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); + try { + $rsp = $this->api->emailLinkValidate($id, $req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); } - $response = new EmailLinkValidateRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setAdditionalPayload($json['additionalPayload']); + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } - return $response; + return $rsp; } } diff --git a/src/Classes/Apis/EmailLinksInterface.php b/src/Classes/Apis/EmailLinksInterface.php new file mode 100644 index 0000000..65adf1e --- /dev/null +++ b/src/Classes/Apis/EmailLinksInterface.php @@ -0,0 +1,13 @@ + $projectId]; - } - - public function __construct(ClientInterface $client) - { - $this->client = $client; + Assert::notNull($api); + $this->api = $api; } /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws ClientExceptionInterface - * @throws Standard + * @throws AssertException + * @throws ServerException + * @throws StandardException */ - public function send(string $projectID, string $phoneNumber, string $remoteAddress, string $userAgent, bool $create = false, ?string $requestID = ''): SmsCodeSendRsp + public function send(SmsCodeSendReq $req): SmsCodeSendRsp { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($phoneNumber); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new SmsCodeSendReq(); - $request->setPhoneNumber($phoneNumber); - $request->setRequestId($requestID); - $request->setCreate($create); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'POST', - '/v1/smsCodes', - ['body' => Helper::jsonEncode($request->jsonSerialize()), 'headers' => $this->generateHeaders($projectID)] - ) - ); + Assert::notNull($req); - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); + try { + $rsp = $this->api->smsCodeSend($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); } - $data = new SmsCodeSendRspAllOfData(); - $data->setSmsCodeId($json['data']['smsCodeID']); - - $response = new SmsCodeSendRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setData($data); + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } - return $response; + return $rsp; } /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws ClientExceptionInterface - * @throws GuzzleException - * @throws Standard + * @throws StandardException + * @throws AssertException + * @throws ServerException */ - public function validate(string $projectID, string $smsCodeID, string $smsCode, string $remoteAddress, string $userAgent, ?string $requestID = ''): GenericRsp + public function validate(string $id, SmsCodeValidateReq $req): SmsCodeValidateRsp { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($smsCodeID); - Assert::stringNotEmpty($smsCode); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); + Assert::stringNotEmpty($id); + Assert::notNull($req); - $request = new SmsCodeValidateReq(); - $request->setSmsCode($smsCode); - $request->setRequestId($requestID); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'PUT', - '/v1/smsCodes/' . $smsCodeID . '/validate', - ['body' => Helper::jsonEncode($request->jsonSerialize()), 'headers' => $this->generateHeaders($projectID)] - ) - ); + try { + $rsp = $this->api->smsCodeValidate($id, $req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); } - return Helper::hydrateResponse($json); + return $rsp; } } diff --git a/src/Classes/Apis/SMSCodesInterface.php b/src/Classes/Apis/SMSCodesInterface.php new file mode 100644 index 0000000..5a2178d --- /dev/null +++ b/src/Classes/Apis/SMSCodesInterface.php @@ -0,0 +1,13 @@ +client = $client; - } - - /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws ClientExceptionInterface - * @throws Standard - */ - public function validateEmail(string $email, string $remoteAddress, string $userAgent, bool $smtpCheck = false, bool $suggestDomain = false, ?string $requestID = ''): ValidateEmailRsp - { - Assert::stringNotEmpty($email); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new ValidateEmailReq(); - $request->setEmail($email); - $request->setSmtpCheck($smtpCheck); - $request->setSuggestDomain($suggestDomain); - $request->setRequestId($requestID); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'PUT', - '/v1/validate/email', - ['body' => Helper::jsonEncode($request->jsonSerialize())] - ) - ); - - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); - } - - $data = new EmailValidationResult(); - $data->setIsValid($json['data']['isValid']); - $data->setValidationCode($json['data']['validationCode']); - - if (array_key_exists('email', $json['data'])) { - $email = new ValidationEmail(); - $email->setUsername($json['data']['email']['username']); - $email->setDomain($json['data']['email']['domain']); - $email->setReachable($json['data']['email']['reachable']); - $email->setDisposable($json['data']['email']['disposable']); - $email->setFree($json['data']['email']['free']); - $email->setHasMxRecords($json['data']['email']['hasMxRecords']); - - $data->setEmail($email); - } - - if (array_key_exists('suggestion', $json['data'])) { - $data->setSuggestion($json['data']['suggestion']); - } - - $response = new ValidateEmailRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setData($data); - - return $response; - } - - /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws ClientExceptionInterface - * @throws Standard - */ - public function validatePhoneNumber(string $phoneNumber, string $remoteAddress, string $userAgent, ?string $regionCode = '', ?string $requestID = ''): ValidatePhoneNumberRsp - { - Assert::stringNotEmpty($phoneNumber); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new ValidatePhoneNumberReq(); - $request->setPhoneNumber($phoneNumber); - $request->setRegionCode($regionCode); - $request->setRequestId($requestID); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'PUT', - '/v1/validate/phoneNumber', - ['body' => Helper::jsonEncode($request->jsonSerialize())] - ) - ); - - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); - } - - $data = new PhoneNumberValidationResult(); - $data->setIsValid($json['data']['isValid']); - $data->setValidationCode($json['data']['validationCode']); - - if (array_key_exists('phoneNumber', $json['data'])) { - $phoneNumber = new ValidationPhoneNumber(); - $phoneNumber->setNationalNumber($json['data']['phoneNumber']['nationalNumber']); - $phoneNumber->setCountryCode($json['data']['phoneNumber']['countryCode']); - $phoneNumber->setRegionCode($json['data']['phoneNumber']['regionCode']); - $phoneNumber->setNationalFormatted($json['data']['phoneNumber']['nationalFormatted']); - $phoneNumber->setInternationalFormatted($json['data']['phoneNumber']['internationalFormatted']); - - $data->setPhoneNumber($phoneNumber); - } - - $response = new ValidatePhoneNumberRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setData($data); - - return $response; - } -} diff --git a/src/Classes/Apis/Validations.php b/src/Classes/Apis/Validations.php new file mode 100644 index 0000000..c518096 --- /dev/null +++ b/src/Classes/Apis/Validations.php @@ -0,0 +1,87 @@ +api = $api; + } + + /** + * Validates email address + * + * @throws AssertException + * @throws ServerException + * @throws StandardException + */ + public function validateEmail(ValidateEmailReq $req): ValidateEmailRsp + { + Assert::notNull($req); + + try { + $rsp = $this->api->validateEmail($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } + + /** + * Validates phone number + * + * @throws AssertException + * @throws StandardException + * @throws ServerException + */ + public function validatePhoneNumber(ValidatePhoneNumberReq $req): ValidatePhoneNumberRsp + { + Assert::notNull($req); + + try { + $rsp = $this->api->validatePhoneNumber($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } +} diff --git a/src/Classes/Apis/ValidationsInterface.php b/src/Classes/Apis/ValidationsInterface.php new file mode 100644 index 0000000..8836928 --- /dev/null +++ b/src/Classes/Apis/ValidationsInterface.php @@ -0,0 +1,13 @@ +client = $client; - } - - /** - * @param string $projectId - * @return string[] - */ - private function generateHeaders(string $projectId): array - { - return ['X-Corbado-ProjectID' => $projectId]; - } - - /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws ClientExceptionInterface - * @throws Standard - */ - public function registerStart(string $projectID, string $origin, string $credentialStatus, string $username, string $remoteAddress, string $userAgent, ?string $requestID = null): WebAuthnRegisterStartRsp - { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($origin); - Assert::stringNotEmpty($credentialStatus); - Assert::stringNotEmpty($username); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new WebAuthnRegisterStartReq(); - $request->setOrigin($origin); - $request->setUsername($username); - $request->setCredentialStatus($credentialStatus); - $request->setRequestId($requestID); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'POST', - '/v1/webauthn/register/start', - ['body' => Helper::jsonEncode($request->jsonSerialize()), 'headers' => $this->generateHeaders($projectID)] - ) - ); - - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); - } - - $response = new WebAuthnRegisterStartRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setPublicKeyCredentialCreationOptions( - $json['publicKeyCredentialCreationOptions'] - ); - $response->setStatus( - $json['status'] - ); - - return $response; - } - - public function registerFinish(string $projectID, string $origin, string $publicKeyCredential, string $remoteAddress, string $userAgent, string $requestID = ''): WebAuthnRegisterFinishRsp - { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($origin); - Assert::stringNotEmpty($publicKeyCredential); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $json = $this->finish( - '/v1/webauthn/register/finish', - $projectID, - $origin, - $publicKeyCredential, - $remoteAddress, - $userAgent, - $requestID - ); - - $response = new WebAuthnRegisterFinishRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setUsername($json['username']); - $response->setCredentialId($json['credentialID']); - $response->setStatus($json['status']); - - return $response; - } - - /** - * @return array - *@throws ClientExceptionInterface - * @throws Http - * @throws Standard - * @throws \Corbado\Classes\Exceptions\Assert - */ - protected function finish(string $endPoint, string $projectID, string $origin, string $publicKeyCredential, string $remoteAddress, string $userAgent, string $requestID = ''): array - { - $request = new WebAuthnFinishReq(); - $request->setOrigin($origin); - $request->setPublicKeyCredential($publicKeyCredential); - $request->setRequestId($requestID); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'POST', - $endPoint, - ['body' => Helper::jsonEncode($request->jsonSerialize()), 'headers' => $this->generateHeaders($projectID)] - ) - ); - - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); - } - - return $json; - } - - /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws ClientExceptionInterface - * @throws Standard - */ - public function authenticateStart(string $projectID, string $origin, string $username, string $remoteAddress, string $userAgent, string $requestID = ''): WebAuthnAuthenticateStartRsp - { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($origin); - Assert::stringNotEmpty($username); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new WebAuthnAuthenticateStartReq(); - $request->setOrigin($origin); - $request->setRequestId($requestID); - $request->setUsername($username); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'POST', - '/v1/webauthn/authenticate/start', - ['body' => Helper::jsonEncode($request->jsonSerialize()), 'headers' => $this->generateHeaders($projectID)] - ) - ); - - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); - } - - $response = new WebAuthnAuthenticateStartRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setPublicKeyCredentialRequestOptions($json['publicKeyCredentialRequestOptions']); - $response->setStatus($json['status']); - - return $response; - } - - /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws ClientExceptionInterface - * @throws Standard - */ - public function authenticateFinish(string $projectID, string $origin, string $publicKeyCredential, string $remoteAddress, string $userAgent, string $requestID = ''): WebAuthnAuthenticateFinishRsp - { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($origin); - Assert::stringNotEmpty($publicKeyCredential); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $json = $this->finish( - '/v1/webauthn/authenticate/finish', - $projectID, - $origin, - $publicKeyCredential, - $remoteAddress, - $userAgent, - $requestID - ); - - $response = new WebAuthnAuthenticateFinishRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setUsername($json['username']); - $response->setCredentialId($json['credentialID']); - $response->setStatus($json['status']); - - return $response; - } - - /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws ClientExceptionInterface - * @throws Standard - */ - public function credentialUpdate(string $credentialId, string $projectID, string $status, string $remoteAddress, string $userAgent, string $requestID = ''): WebAuthnCredentialRsp - { - Assert::stringNotEmpty($projectID); - Assert::stringNotEmpty($status); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new WebAuthnCredentialReq(); - $request->setRequestId($requestID); - $request->setStatus($status); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'PUT', - '/v1/webauthn/credential/' . $credentialId, - ['body' => Helper::jsonEncode($request->jsonSerialize()), 'headers' => $this->generateHeaders($projectID)] - ) - ); - - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); - } - - $response = new WebAuthnCredentialRsp(); - $response->setHttpStatusCode($json['httpStatusCode']); - $response->setMessage($json['message']); - $response->setRequestData(Helper::hydrateRequestData($json['requestData'])); - $response->setRuntime($json['runtime']); - $response->setStatus($json['status']); - - return $response; - } -} diff --git a/src/Classes/Apis/Widget.php b/src/Classes/Apis/Widget.php deleted file mode 100644 index 1ea595a..0000000 --- a/src/Classes/Apis/Widget.php +++ /dev/null @@ -1,68 +0,0 @@ -client = $client; - } - - /** - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http - * @throws GuzzleException - * @throws Standard - */ - public function sessionVerify(string $sessionToken, string $remoteAddress, string $userAgent, string $requestID = ''): SessionTokenVerifyRsp - { - Assert::stringNotEmpty($sessionToken); - Assert::stringNotEmpty($remoteAddress); - Assert::stringNotEmpty($userAgent); - - $request = new SessionTokenVerifyReq(); - $request->setToken($sessionToken); - $request->setRequestId($requestID); - $request->setClientInfo( - SDK::createClientInfo($remoteAddress, $userAgent) - ); - - $httpResponse = $this->client->sendRequest( - new Request( - 'POST', - '/v1/smsCodes', - ['body' => Helper::jsonEncode($request->jsonSerialize())] - ) - ); - - $json = Helper::jsonDecode($httpResponse->getBody()->getContents()); - if (Helper::isErrorHttpStatusCode($json['httpStatusCode'])) { - Helper::throwException($json); - } - - $data = new SessionTokenVerifyRspAllOfData(); - $data->setUserId($json['data']['userID']); - $data->setUserData($json['data']['userData']); - - $response = new SessionTokenVerifyRsp(); - $response->setData($data); - - return $response; - } -} diff --git a/src/Classes/Assert.php b/src/Classes/Assert.php index d1879ba..6531492 100644 --- a/src/Classes/Assert.php +++ b/src/Classes/Assert.php @@ -3,16 +3,30 @@ namespace Corbado\Classes; class Assert { + + /** + * Checks if given data is not null + * + * @param mixed $data + * @return void + * @throws \Corbado\Classes\Exceptions\AssertException + */ + public static function notNull(mixed $data) : void { + if ($data === null) { + throw new Exceptions\AssertException('Assert failed: Given data is null'); + } + } + /** * Checks if string is not empty * * @param string $data * @return void - * @throws \Corbado\Classes\Exceptions\Assert + * @throws \Corbado\Classes\Exceptions\AssertException */ public static function stringNotEmpty(string $data) : void { if ($data == '') { - throw new Exceptions\Assert('Assert failed: Given string is empty'); + throw new Exceptions\AssertException('Assert failed: Given string is empty'); } } @@ -22,7 +36,7 @@ public static function stringNotEmpty(string $data) : void { * @param string $data * @param array $possibleValues * @return void - * @throws \Corbado\Classes\Exceptions\Assert + * @throws \Corbado\Classes\Exceptions\AssertException */ public static function stringEquals(string $data, array $possibleValues) : void { self::stringNotEmpty($data); @@ -31,7 +45,7 @@ public static function stringEquals(string $data, array $possibleValues) : void return; } - throw new Exceptions\Assert('Assert failed: Invalid value "' . $data . '" given, only the following are allowed: ' . implode(', ', $possibleValues)); + throw new Exceptions\AssertException('Assert failed: Invalid value "' . $data . '" given, only the following are allowed: ' . implode(', ', $possibleValues)); } /** @@ -40,12 +54,12 @@ public static function stringEquals(string $data, array $possibleValues) : void * @param array $data * @param array $keys * @return void - * @throws \Corbado\Classes\Exceptions\Assert + * @throws \Corbado\Classes\Exceptions\AssertException */ public static function arrayKeysExist(array $data, array $keys) : void { foreach ($keys as $key) { if (!array_key_exists($key, $data)) { - throw new Exceptions\Assert('Assert failed: Given array has no key "' . $key . '"'); + throw new Exceptions\AssertException('Assert failed: Given array has no key "' . $key . '"'); } } } diff --git a/src/Classes/Exceptions/Assert.php b/src/Classes/Exceptions/Assert.php deleted file mode 100644 index 4c00ef4..0000000 --- a/src/Classes/Exceptions/Assert.php +++ /dev/null @@ -1,6 +0,0 @@ - - * @throws Standard + * @throws StandardException */ public static function jsonDecode(string $data): array { @@ -39,7 +41,7 @@ public static function jsonDecode(string $data): array $json = \json_decode($data, true); if (json_last_error() !== JSON_ERROR_NONE) { - throw new Standard('json_decode() failed: ' . json_last_error_msg()); + throw new StandardException('json_decode() failed: ' . json_last_error_msg()); } return $json; @@ -56,10 +58,10 @@ public static function isErrorHttpStatusCode(int $statusCode): bool /** * @param array $data - * @throws \Corbado\Classes\Exceptions\Assert - * @throws Http + * @throws AssertException + * @throws ServerException */ - public static function throwException(array $data) : void + public static function throwServerExceptionOld(array $data) : void { Assert::arrayKeysExist($data, ['httpStatusCode', 'message', 'requestData', 'runtime']); @@ -68,13 +70,28 @@ public static function throwException(array $data) : void $data['error'] = []; } - throw new Http($data['httpStatusCode'], $data['message'], $data['requestData'], $data['runtime'], $data['error']); + throw new ServerException($data['httpStatusCode'], $data['message'], $data['requestData'], $data['runtime'], $data['error']); + } + + /** + * @throws StandardException + */ + public static function convertToServerException(ApiException $e) : ServerException + { + $body = $e->getResponseBody(); + if (!is_string($body)) { + throw new StandardException('Response body is not a string'); + } + + $data = self::jsonDecode($body); + + return new ServerException($data['httpStatusCode'], $data['message'], $data['requestData'], $data['runtime'], $data['error']); } /** * @param array $data * @return RequestData - *@throws \Corbado\Classes\Exceptions\Assert + * @throws AssertException */ public static function hydrateRequestData(array $data): RequestData { @@ -89,7 +106,7 @@ public static function hydrateRequestData(array $data): RequestData /** * @param array $data - * @throws \Corbado\Classes\Exceptions\Assert + * @throws AssertException */ public static function hydrateResponse(array $data): GenericRsp { diff --git a/src/Classes/Session.php b/src/Classes/Session.php index c4fc9d7..58ca091 100644 --- a/src/Classes/Session.php +++ b/src/Classes/Session.php @@ -27,7 +27,7 @@ class Session * @param string $issuer * @param string $jwksURI * @param CacheItemPoolInterface $jwksCachePool - * @throws Exceptions\Assert + * @throws Exceptions\AssertException */ public function __construct(ClientInterface $client, string $shortSessionCookieName, string $issuer, string $jwksURI, CacheItemPoolInterface $jwksCachePool) { @@ -46,7 +46,7 @@ public function __construct(ClientInterface $client, string $shortSessionCookieN * Returns the short-term session (represented as JWT) value from the cookie or the Authorization header * * @return string - * @throws Exceptions\Assert + * @throws Exceptions\AssertException */ public function getShortSessionValue() : string { @@ -66,7 +66,7 @@ public function getShortSessionValue() : string * * @param string $value Value (JWT) * @return stdClass|null Returns stdClass on success, otherwise null - * @throws Exceptions\Assert + * @throws Exceptions\AssertException */ public function validateShortSessionValue(string $value) : ?stdClass { @@ -122,7 +122,7 @@ public function getLastShortSessionValidationResult() : string * authenticated ("guest"). * * @return User - * @throws Exceptions\Assert + * @throws Exceptions\AssertException */ public function getCurrentUser() : User { @@ -167,7 +167,7 @@ public function getCurrentUser() : User * * @param string $authorizationHeader * @return string - * @throws Exceptions\Assert + * @throws Exceptions\AssertException */ private function extractBearerToken(string $authorizationHeader) : string { Assert::stringNotEmpty($authorizationHeader); diff --git a/src/Classes/User.php b/src/Classes/User.php index 582742f..151b32f 100644 --- a/src/Classes/User.php +++ b/src/Classes/User.php @@ -2,7 +2,7 @@ namespace Corbado\Classes; -use Corbado\Classes\Exceptions\Standard; +use Corbado\Classes\Exceptions\StandardException; class User { private bool $authenticated; @@ -24,44 +24,44 @@ public function isAuthenticated() : bool { } /** - * @throws Standard + * @throws StandardException */ public function getID() : string { if ($this->isAuthenticated() === false) { - throw new Standard('User is not authenticated'); + throw new StandardException('User is not authenticated'); } return $this->id; } /** - * @throws Standard + * @throws StandardException */ public function getName() : string { if ($this->isAuthenticated() === false) { - throw new Standard('User is not authenticated'); + throw new StandardException('User is not authenticated'); } return $this->name; } /** - * @throws Standard + * @throws StandardException */ public function getEmail() : string { if ($this->isAuthenticated() === false) { - throw new Standard('User is not authenticated'); + throw new StandardException('User is not authenticated'); } return $this->email; } /** - * @throws Standard + * @throws StandardException */ public function getPhoneNumber() : string { if ($this->isAuthenticated() === false) { - throw new Standard('User is not authenticated'); + throw new StandardException('User is not authenticated'); } return $this->phoneNumber; diff --git a/src/Classes/Webhook.php b/src/Classes/Webhook.php index 707759a..e8c87d4 100644 --- a/src/Classes/Webhook.php +++ b/src/Classes/Webhook.php @@ -3,7 +3,7 @@ namespace Corbado\Classes; use Corbado\Classes; -use Corbado\Classes\Exceptions\Standard; +use Corbado\Classes\Exceptions\StandardException; use Corbado\Model; class Webhook @@ -41,7 +41,7 @@ class Webhook * * @param string $username * @param string $password - * @throws Classes\Exceptions\Assert + * @throws Classes\Exceptions\AssertException */ public function __construct(string $username, string $password) { @@ -107,12 +107,12 @@ public function sendUnauthorizedResponse(bool $exit = true) : void * Handles authentication * * @return void - * @throws Standard + * @throws StandardException */ public function handleAuthentication() : void { if ($this->authenticated) { - throw new Standard("Already authenticated, something is wrong"); + throw new StandardException("Already authenticated, something is wrong"); } if ($this->checkAuthentication() === true) { @@ -128,7 +128,7 @@ public function handleAuthentication() : void * Checks automatic authentication * * @return void - * @throws Standard + * @throws StandardException */ private function checkAutomaticAuthentication() : void { @@ -140,14 +140,14 @@ private function checkAutomaticAuthentication() : void return; } - throw new Standard("Missing authentication, call handleAuthentication() first"); + throw new StandardException("Missing authentication, call handleAuthentication() first"); } /** * Checks if request method is POST (the only supported method from Corbado) * * @return bool - * @throws Standard + * @throws StandardException */ public function isPost() : bool { @@ -160,14 +160,14 @@ public function isPost() : bool * Returns webhook action (by reading the header field X-Corbado-Action) * * @return string - * @throws Standard + * @throws StandardException */ public function getAction() : string { $this->checkAutomaticAuthentication(); if (empty($_SERVER['HTTP_X_CORBADO_ACTION'])) { - throw new Standard('Missing action header (X-CORBADO-ACTION)'); + throw new StandardException('Missing action header (X-CORBADO-ACTION)'); } switch ($_SERVER['HTTP_X_CORBADO_ACTION']) { @@ -178,7 +178,7 @@ public function getAction() : string return self::ACTION_PASSWORD_VERIFY; default: - throw new Standard('Invalid action ("' . $_SERVER['HTTP_X_CORBADO_ACTION'] . '")'); + throw new StandardException('Invalid action ("' . $_SERVER['HTTP_X_CORBADO_ACTION'] . '")'); } } @@ -186,8 +186,8 @@ public function getAction() : string * Returns auth methods request model * * @return \Corbado\Classes\WebhookModels\AuthMethodsRequest - * @throws Classes\Exceptions\Assert - * @throws Standard + * @throws Classes\Exceptions\AssertException + * @throws StandardException */ public function getAuthMethodsRequest() : \Corbado\Classes\WebhookModels\AuthMethodsRequest { @@ -216,8 +216,8 @@ public function getAuthMethodsRequest() : \Corbado\Classes\WebhookModels\AuthMet * @param string $status * @param bool $exit * @return void - * @throws Standard - * @throws Classes\Exceptions\Assert + * @throws StandardException + * @throws Classes\Exceptions\AssertException */ public function sendAuthMethodsResponse(string $status, bool $exit = true, string $responseID = '') : void { @@ -243,8 +243,8 @@ public function sendAuthMethodsResponse(string $status, bool $exit = true, strin * Returns password verify request model * * @return \Corbado\Classes\WebhookModels\PasswordVerifyRequest - * @throws Standard - * @throws Classes\Exceptions\Assert + * @throws StandardException + * @throws Classes\Exceptions\AssertException */ public function getPasswordVerifyRequest() : \Corbado\Classes\WebhookModels\PasswordVerifyRequest { @@ -274,7 +274,7 @@ public function getPasswordVerifyRequest() : \Corbado\Classes\WebhookModels\Pass * @param bool $success * @param bool $exit * @return void - * @throws Standard + * @throws StandardException */ public function sendPasswordVerifyResponse(bool $success, bool $exit = true, string $responseID = '') : void { @@ -298,12 +298,12 @@ public function sendPasswordVerifyResponse(bool $success, bool $exit = true, str * Returns request body * * @return string - * @throws Standard + * @throws StandardException */ private function getRequestBody() : string { $body = file_get_contents('php://input'); if ($body === false) { - throw new Standard('Could not read request body (POST request)'); + throw new StandardException('Could not read request body (POST request)'); } return $body; @@ -314,7 +314,7 @@ private function getRequestBody() : string { * * @param mixed $response * @return void - * @throws Standard + * @throws StandardException */ private function sendResponse($response) : void { header('Content-Type: application/json; charset=utf-8'); diff --git a/src/Configuration.php b/src/Configuration.php index 50cf883..22ba78a 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -22,19 +22,19 @@ class Configuration { * passed via the constructor. All other options can be set via * setters. * - * @throws Classes\Exceptions\Assert - * @throws Classes\Exceptions\Configuration + * @throws Classes\Exceptions\AssertException + * @throws Classes\Exceptions\ConfigurationException */ public function __construct(string $projectID, string $apiSecret = '') { Assert::stringNotEmpty($projectID); if (!str_starts_with($projectID, 'pro-')) { - throw new Classes\Exceptions\Configuration('Invalid project ID "' . $projectID . '" given, needs to start with "pro-"'); + throw new Classes\Exceptions\ConfigurationException('Invalid project ID "' . $projectID . '" given, needs to start with "pro-"'); } if ($apiSecret !== '' && !str_starts_with($apiSecret, 'corbado1_')) { - throw new Classes\Exceptions\Configuration('Invalid API secret "' . $apiSecret . '" given, needs to start with "corbado1_"'); + throw new Classes\Exceptions\ConfigurationException('Invalid API secret "' . $apiSecret . '" given, needs to start with "corbado1_"'); } $this->projectID = $projectID; @@ -42,7 +42,7 @@ public function __construct(string $projectID, string $apiSecret = '') } /** - * @throws Classes\Exceptions\Assert + * @throws Classes\Exceptions\AssertException */ public function setFrontendAPI(string $frontendAPI) : self { @@ -54,7 +54,7 @@ public function setFrontendAPI(string $frontendAPI) : self } /** - * @throws Classes\Exceptions\Assert + * @throws Classes\Exceptions\AssertException */ public function setBackendAPI(string $backendAPI) : self { @@ -66,7 +66,7 @@ public function setBackendAPI(string $backendAPI) : self } /** - * @throws Classes\Exceptions\Assert + * @throws Classes\Exceptions\AssertException */ public function setShortSessionCookieName(string $shortSessionCookieName) : self { @@ -145,7 +145,7 @@ public function getJwksCachePool(): ?CacheItemPoolInterface } /** - * @throws Classes\Exceptions\Assert + * @throws Classes\Exceptions\AssertException */ private function assertURL(string $url) : void { @@ -153,35 +153,35 @@ private function assertURL(string $url) : void $parts = parse_url($url); if ($parts === false) { - throw new Classes\Exceptions\Assert('Assert failed: parse_url() returned error'); + throw new Classes\Exceptions\AssertException('Assert failed: parse_url() returned error'); } if (isset($parts['scheme']) && $parts['scheme'] !== 'https') { - throw new Classes\Exceptions\Assert('Assert failed: scheme needs to be https'); + throw new Classes\Exceptions\AssertException('Assert failed: scheme needs to be https'); } if (!isset($parts['host'])) { - throw new Classes\Exceptions\Assert('Assert failed: host is empty'); + throw new Classes\Exceptions\AssertException('Assert failed: host is empty'); } if (isset($parts['user'])) { - throw new Classes\Exceptions\Assert('Assert failed: username needs to be empty'); + throw new Classes\Exceptions\AssertException('Assert failed: username needs to be empty'); } if (isset($parts['pass'])) { - throw new Classes\Exceptions\Assert('Assert failed: password needs to be empty'); + throw new Classes\Exceptions\AssertException('Assert failed: password needs to be empty'); } if (isset($parts['path'])) { - throw new Classes\Exceptions\Assert('Assert failed: path needs to be empty'); + throw new Classes\Exceptions\AssertException('Assert failed: path needs to be empty'); } if (isset($parts['query'])) { - throw new Classes\Exceptions\Assert('Assert failed: querystring needs to be empty'); + throw new Classes\Exceptions\AssertException('Assert failed: querystring needs to be empty'); } if (isset($parts['fragment'])) { - throw new Classes\Exceptions\Assert('Assert failed: fragment needs to be empty'); + throw new Classes\Exceptions\AssertException('Assert failed: fragment needs to be empty'); } } } diff --git a/src/SDK.php b/src/SDK.php index 0230789..6fee53f 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -3,14 +3,20 @@ namespace Corbado; use Corbado\Classes\Apis\EmailLinks; +use Corbado\Classes\Apis\EmailLinksInterface; use Corbado\Classes\Apis\SMSCodes; -use Corbado\Classes\Apis\Validation; -use Corbado\Classes\Apis\WebAuthn; -use Corbado\Classes\Apis\Widget; +use Corbado\Classes\Apis\SMSCodesInterface; +use Corbado\Classes\Apis\Validations; +use Corbado\Classes\Apis\ValidationsInterface; use Corbado\Classes\Assert; +use Corbado\Classes\Exceptions\ConfigurationException; +use Corbado\Classes\Exceptions\AssertException; use Corbado\Classes\Session; use Corbado\Generated\Api\AuthTokensApi; +use Corbado\Generated\Api\EmailMagicLinksApi; +use Corbado\Generated\Api\SMSOTPApi; use Corbado\Generated\Api\UserApi; +use Corbado\Generated\Api\ValidationApi; use Corbado\Generated\Model\ClientInfo; use GuzzleHttp\Client; use Psr\Http\Client\ClientInterface; @@ -19,11 +25,9 @@ class SDK { private Configuration $config; private ClientInterface $client; - private ?EmailLinks $emailLinks = null; - private ?SMSCodes $smsCodes = null; - private ?WebAuthn $webAuthn = null; - private ?Validation $validation = null; - private ?Widget $widget = null; + private ?EmailLinksInterface $emailLinks = null; + private ?SMSCodesInterface $smsCodes = null; + private ?ValidationsInterface $validations = null; private ?UserApi $users = null; private ?Session $session = null; private ?AuthTokensApi $authTokens = null; @@ -32,7 +36,6 @@ class SDK * Constructor * * @param Configuration $config - * @throws Classes\Exceptions\Configuration */ public function __construct(Configuration $config) { @@ -54,11 +57,16 @@ public function __construct(Configuration $config) /** * Returns email links handling * - * @return EmailLinks + * @return EmailLinksInterface + * @throws AssertException + * @throws ConfigurationException */ - public function emailLinks() : EmailLinks { + public function emailLinks() : EmailLinksInterface { if ($this->emailLinks === null) { - $this->emailLinks = new EmailLinks($this->client); + $this->emailLinks = new EmailLinks( + // @phpstan-ignore-next-line + new EmailMagicLinksApi($this->client, $this->createGeneratedConfiguration()) + ); } return $this->emailLinks; @@ -67,55 +75,44 @@ public function emailLinks() : EmailLinks { /** * Returns SMS codes handling * - * @return SMSCodes + * @return SMSCodesInterface + * @throws AssertException + * @throws ConfigurationException */ - public function smsCodes() : SMSCodes { + public function smsCodes() : SMSCodesInterface { if ($this->smsCodes === null) { - $this->smsCodes = new SMSCodes($this->client); + $this->smsCodes = new SMSCodes( + // @phpstan-ignore-next-line + new SMSOTPApi($this->client, $this->createGeneratedConfiguration()) + ); } return $this->smsCodes; } - /** - * Returns WebAuthn handling - * - * @return WebAuthn - */ - public function webAuthn() : WebAuthn { - if ($this->webAuthn === null) { - $this->webAuthn = new WebAuthn($this->client); - } - - return $this->webAuthn; - } - /** * Returns validation handling * - * @return Validation + * @return ValidationsInterface + * @throws AssertException + * @throws ConfigurationException */ - public function validation() : Validation { - if ($this->validation === null) { - $this->validation = new Validation($this->client); - } - - return $this->validation; - } - - public function widget() : Widget { - if ($this->widget === null) { - $this->widget = new Widget($this->client); + public function validations() : ValidationsInterface { + if ($this->validations === null) { + $this->validations = new Validations( + // @phpstan-ignore-next-line + new ValidationApi($this->client, $this->createGeneratedConfiguration()) + ); } - return $this->widget; + return $this->validations; } /** * Returns users handling * - * @throws Classes\Exceptions\Configuration * @return UserApi + * @throws ConfigurationException */ public function users() : UserApi { if ($this->users === null) { @@ -130,14 +127,14 @@ public function users() : UserApi { * Returns session handling * * @return Session - * @throws Classes\Exceptions\Assert - * @throws Classes\Exceptions\Configuration + * @throws ConfigurationException + * @throws AssertException * @link https://docs.corbado.com/sessions/overview */ public function sessions() : Session { if ($this->session === null) { if ($this->config->getJwksCachePool() === null) { - throw new Classes\Exceptions\Configuration('No JWKS cache pool set, use Configuration::setJwksCachePool()'); + throw new ConfigurationException('No JWKS cache pool set, use Configuration::setJwksCachePool()'); } $this->session = new Session( @@ -155,8 +152,8 @@ public function sessions() : Session { /** * Returns auth tokens handling * - * @throws Classes\Exceptions\Configuration * @return AuthTokensApi + * @throws ConfigurationException */ public function authTokens() : AuthTokensApi { if ($this->authTokens === null) { @@ -169,12 +166,12 @@ public function authTokens() : AuthTokensApi { /** * @return Generated\Configuration - * @throws Classes\Exceptions\Configuration + * @throws Classes\Exceptions\ConfigurationException */ private function createGeneratedConfiguration() : Generated\Configuration { if ($this->config->getApiSecret() == '') { - throw new Classes\Exceptions\Configuration('No API secret set, pass in constructor of configuration'); + throw new Classes\Exceptions\ConfigurationException('No API secret set, pass in constructor of configuration'); } $config = new Generated\Configuration(); @@ -188,7 +185,7 @@ private function createGeneratedConfiguration() : Generated\Configuration } /** - * @throws Classes\Exceptions\Assert + * @throws Classes\Exceptions\AssertException */ public static function createClientInfo(string $remoteAddress, string $userAgent) : ClientInfo { Assert::stringNotEmpty($remoteAddress); diff --git a/tests/Classes/SessionTest.php b/tests/Classes/SessionTest.php index 72cab11..f7bc1bb 100644 --- a/tests/Classes/SessionTest.php +++ b/tests/Classes/SessionTest.php @@ -2,7 +2,7 @@ namespace Classes; -use Corbado\Classes\Exceptions\Assert; +use Corbado\Classes\Exceptions\AssertException; use Corbado\Classes\Session; use Exception; use Firebase\JWT\JWT; @@ -17,7 +17,7 @@ class SessionTest extends TestCase { /** - * @throws Assert + * @throws AssertException * @throws Exception */ public function testGetShortSessionValue() : void diff --git a/tests/Classes/UserTest.php b/tests/Classes/UserTest.php index a228b11..982e128 100644 --- a/tests/Classes/UserTest.php +++ b/tests/Classes/UserTest.php @@ -17,7 +17,7 @@ public function testIsAuthenticated() : void } /** - * @throws \Corbado\Classes\Exceptions\Standard + * @throws \Corbado\Classes\Exceptions\StandardException */ public function testGetUserData() : void { From 4c2585270690a79fd017c648bad51aed28f9d26a Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 3 Dec 2023 07:52:15 +0100 Subject: [PATCH 02/81] Ported auth tokens --- examples/test.php | 3 +- src/Classes/Apis/AuthTokens.php | 50 ++++++++++++++++++++++++ src/Classes/Apis/AuthTokensInterface.php | 10 +++++ src/SDK.php | 15 ++++--- 4 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 src/Classes/Apis/AuthTokens.php create mode 100644 src/Classes/Apis/AuthTokensInterface.php diff --git a/examples/test.php b/examples/test.php index 8ac010c..8f72443 100644 --- a/examples/test.php +++ b/examples/test.php @@ -20,8 +20,7 @@ $request->setToken($corbadoAuthToken); $request->setClientInfo(SDK::createClientInfo($remoteAddress, $userAgent)); - /** @var AuthTokenValidateRsp $response */ - $response = $corbado->authTokens()->authTokenValidate($request); + $response = $corbado->authTokens()->validate($request); echo $response->getData()->getUserId(); diff --git a/src/Classes/Apis/AuthTokens.php b/src/Classes/Apis/AuthTokens.php new file mode 100644 index 0000000..b32865d --- /dev/null +++ b/src/Classes/Apis/AuthTokens.php @@ -0,0 +1,50 @@ +api = $api; + } + + /** + * @param AuthTokenValidateReq $req + * @return AuthTokenValidateRsp + * @throws AssertException + * @throws StandardException + * @throws ServerException + */ + public function validate(AuthTokenValidateReq $req): AuthTokenValidateRsp { + Assert::notNull($req); + + try { + $rsp = $this->api->authTokenValidate($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } +} diff --git a/src/Classes/Apis/AuthTokensInterface.php b/src/Classes/Apis/AuthTokensInterface.php new file mode 100644 index 0000000..96fecf7 --- /dev/null +++ b/src/Classes/Apis/AuthTokensInterface.php @@ -0,0 +1,10 @@ +authTokens === null) { - // @phpstan-ignore-next-line - $this->authTokens = new AuthTokensApi($this->client, $this->createGeneratedConfiguration()); + $this->authTokens = new AuthTokens( + // @phpstan-ignore-next-line + new AuthTokensApi($this->client, $this->createGeneratedConfiguration()) + ); } return $this->authTokens; From 75553516e82387c5e672672c5f34ec27de1f61cb Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 4 Dec 2023 06:31:04 +0100 Subject: [PATCH 03/81] Added users api --- src/Classes/Apis/AuthTokens.php | 6 +- src/Classes/Apis/Users.php | 98 +++++++++++++++++++++++++++++ src/Classes/Apis/UsersInterface.php | 15 +++++ 3 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 src/Classes/Apis/Users.php create mode 100644 src/Classes/Apis/UsersInterface.php diff --git a/src/Classes/Apis/AuthTokens.php b/src/Classes/Apis/AuthTokens.php index b32865d..f2103d5 100644 --- a/src/Classes/Apis/AuthTokens.php +++ b/src/Classes/Apis/AuthTokens.php @@ -20,7 +20,8 @@ class AuthTokens implements AuthTokensInterface /** * @throws AssertException */ - public function __construct(AuthTokensApi $api) { + public function __construct(AuthTokensApi $api) + { Assert::notNull($api); $this->api = $api; } @@ -32,7 +33,8 @@ public function __construct(AuthTokensApi $api) { * @throws StandardException * @throws ServerException */ - public function validate(AuthTokenValidateReq $req): AuthTokenValidateRsp { + public function validate(AuthTokenValidateReq $req): AuthTokenValidateRsp + { Assert::notNull($req); try { diff --git a/src/Classes/Apis/Users.php b/src/Classes/Apis/Users.php new file mode 100644 index 0000000..83932cd --- /dev/null +++ b/src/Classes/Apis/Users.php @@ -0,0 +1,98 @@ +api = $api; + } + + /** + * @throws AssertException + * @throws StandardException + * @throws ServerException + */ + public function create(UserCreateReq $req): UserCreateRsp + { + Assert::notNull($req); + + try { + $rsp = $this->api->userCreate($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } + + /** + * @throws StandardException + * @throws AssertException + * @throws ServerException + */ + public function delete(string $id, UserDeleteReq $req) : GenericRsp + { + Assert::stringNotEmpty($id); + Assert::notNull($req); + + try { + $rsp = $this->api->userDelete($id, $req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } + + /** + * @throws StandardException + * @throws AssertException + * @throws ServerException + */ + public function get(string $id, string $remoteAddr = '', string $userAgent = '') : UserGetRsp + { + Assert::stringNotEmpty($id); + + try { + $rsp = $this->api->userGet($id, $remoteAddr, $userAgent); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } +} diff --git a/src/Classes/Apis/UsersInterface.php b/src/Classes/Apis/UsersInterface.php new file mode 100644 index 0000000..a4f515a --- /dev/null +++ b/src/Classes/Apis/UsersInterface.php @@ -0,0 +1,15 @@ + Date: Mon, 4 Dec 2023 06:44:14 +0100 Subject: [PATCH 04/81] Added SDK version header --- composer.json | 3 ++- src/SDK.php | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index c454eef..3ab5455 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ }, "require-dev": { "phpunit/phpunit": "^9", - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^1.10", + "squizlabs/php_codesniffer": "^3.7" }, "scripts": { "analyze": "vendor/bin/phpstan --memory-limit=1000000000 analyze src examples tests", diff --git a/src/SDK.php b/src/SDK.php index 2d444e6..afd142b 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -34,6 +34,8 @@ class SDK private ?Session $session = null; private ?AuthTokensInterface $authTokens = null; + const VERSION = '1.0.0'; + /** * Constructor * @@ -48,12 +50,14 @@ public function __construct(Configuration $config) [ 'base_uri' => $this->config->getBackendAPI(), 'http_errors' => false, - 'auth' => [$this->config->getProjectID(), $this->config->getApiSecret()] + 'auth' => [$this->config->getProjectID(), $this->config->getApiSecret()], + 'headers' => ['X-Corbado-SDK-Version' => 'PHP SDK ' . self::VERSION], ] ); } else { $this->client = $this->config->getHttpClient(); } + } /** From 11b8acce05ff10f3ee388850ebca83592bdf5b04 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 4 Dec 2023 06:48:26 +0100 Subject: [PATCH 05/81] Playing with codesniffer --- src/SDK.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/SDK.php b/src/SDK.php index afd142b..b3c2c5c 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -57,7 +57,6 @@ public function __construct(Configuration $config) } else { $this->client = $this->config->getHttpClient(); } - } /** @@ -67,7 +66,8 @@ public function __construct(Configuration $config) * @throws AssertException * @throws ConfigurationException */ - public function emailLinks() : EmailLinksInterface { + public function emailLinks(): EmailLinksInterface + { if ($this->emailLinks === null) { $this->emailLinks = new EmailLinks( // @phpstan-ignore-next-line @@ -85,7 +85,8 @@ public function emailLinks() : EmailLinksInterface { * @throws AssertException * @throws ConfigurationException */ - public function smsCodes() : SMSCodesInterface { + public function smsCodes(): SMSCodesInterface + { if ($this->smsCodes === null) { $this->smsCodes = new SMSCodes( // @phpstan-ignore-next-line @@ -103,7 +104,8 @@ public function smsCodes() : SMSCodesInterface { * @throws AssertException * @throws ConfigurationException */ - public function validations() : ValidationsInterface { + public function validations(): ValidationsInterface + { if ($this->validations === null) { $this->validations = new Validations( // @phpstan-ignore-next-line @@ -120,7 +122,8 @@ public function validations() : ValidationsInterface { * @return UserApi * @throws ConfigurationException */ - public function users() : UserApi { + public function users(): UserApi + { if ($this->users === null) { // @phpstan-ignore-next-line $this->users = new UserApi($this->client, $this->createGeneratedConfiguration()); @@ -137,7 +140,8 @@ public function users() : UserApi { * @throws AssertException * @link https://docs.corbado.com/sessions/overview */ - public function sessions() : Session { + public function sessions(): Session + { if ($this->session === null) { if ($this->config->getJwksCachePool() === null) { throw new ConfigurationException('No JWKS cache pool set, use Configuration::setJwksCachePool()'); @@ -162,7 +166,8 @@ public function sessions() : Session { * @throws ConfigurationException * @throws AssertException */ - public function authTokens() : AuthTokensInterface { + public function authTokens(): AuthTokensInterface + { if ($this->authTokens === null) { $this->authTokens = new AuthTokens( // @phpstan-ignore-next-line @@ -177,7 +182,7 @@ public function authTokens() : AuthTokensInterface { * @return Generated\Configuration * @throws Classes\Exceptions\ConfigurationException */ - private function createGeneratedConfiguration() : Generated\Configuration + private function createGeneratedConfiguration(): Generated\Configuration { if ($this->config->getApiSecret() == '') { throw new Classes\Exceptions\ConfigurationException('No API secret set, pass in constructor of configuration'); @@ -196,7 +201,8 @@ private function createGeneratedConfiguration() : Generated\Configuration /** * @throws Classes\Exceptions\AssertException */ - public static function createClientInfo(string $remoteAddress, string $userAgent) : ClientInfo { + public static function createClientInfo(string $remoteAddress, string $userAgent): ClientInfo + { Assert::stringNotEmpty($remoteAddress); Assert::stringNotEmpty($userAgent); From 19c5ea1fdbda2bfabc30b63bf15d83a0a72f045e Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 4 Dec 2023 06:57:38 +0100 Subject: [PATCH 06/81] Playing with codesniffer --- src/Configuration.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Configuration.php b/src/Configuration.php index 22ba78a..b927a04 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -6,7 +6,8 @@ use Psr\Cache\CacheItemPoolInterface; use Psr\Http\Client\ClientInterface; -class Configuration { +class Configuration +{ private string $projectID = ''; private string $apiSecret = ''; private string $frontendAPI = ''; @@ -44,7 +45,7 @@ public function __construct(string $projectID, string $apiSecret = '') /** * @throws Classes\Exceptions\AssertException */ - public function setFrontendAPI(string $frontendAPI) : self + public function setFrontendAPI(string $frontendAPI): self { $this->assertURL($frontendAPI); @@ -56,7 +57,7 @@ public function setFrontendAPI(string $frontendAPI) : self /** * @throws Classes\Exceptions\AssertException */ - public function setBackendAPI(string $backendAPI) : self + public function setBackendAPI(string $backendAPI): self { $this->assertURL($backendAPI); @@ -68,7 +69,7 @@ public function setBackendAPI(string $backendAPI) : self /** * @throws Classes\Exceptions\AssertException */ - public function setShortSessionCookieName(string $shortSessionCookieName) : self + public function setShortSessionCookieName(string $shortSessionCookieName): self { Assert::stringNotEmpty($shortSessionCookieName); @@ -77,13 +78,14 @@ public function setShortSessionCookieName(string $shortSessionCookieName) : self return $this; } - public function setHttpClient(ClientInterface $httpClient) : self { + public function setHttpClient(ClientInterface $httpClient): self + { $this->httpClient = $httpClient; return $this; } - public function setJwksCachePool(CacheItemPoolInterface $jwksCachePool) : self + public function setJwksCachePool(CacheItemPoolInterface $jwksCachePool): self { $this->jwksCachePool = $jwksCachePool; @@ -106,7 +108,7 @@ public function getApiSecret(): string return $this->apiSecret; } - public function getFrontendAPI() : string + public function getFrontendAPI(): string { if ($this->frontendAPI === '') { $this->frontendAPI = 'https://' . $this->projectID . '.frontendapi.corbado.io'; @@ -115,7 +117,7 @@ public function getFrontendAPI() : string return $this->frontendAPI; } - public function getBackendAPI() : string + public function getBackendAPI(): string { return $this->backendAPI; } @@ -123,7 +125,7 @@ public function getBackendAPI() : string /** * @return string */ - public function getShortSessionCookieName() : string + public function getShortSessionCookieName(): string { return $this->shortSessionCookieName; } @@ -147,7 +149,7 @@ public function getJwksCachePool(): ?CacheItemPoolInterface /** * @throws Classes\Exceptions\AssertException */ - private function assertURL(string $url) : void + private function assertURL(string $url): void { Assert::stringNotEmpty($url); From e1d8d14e0f025cf2aae890f3abc9eac3f63fd705 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 4 Dec 2023 07:18:05 +0100 Subject: [PATCH 07/81] Added php-cs-fixer --- .php-cs-fixer.php | 10 ++++++++++ composer.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .php-cs-fixer.php diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..5b134ac --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,10 @@ +exclude(['vendor', 'src/Generated']) + ->in(__DIR__); + +$config = new PhpCsFixer\Config(); +$config->setFinder($finder); + +return $config; \ No newline at end of file diff --git a/composer.json b/composer.json index 3ab5455..0e98ad1 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require-dev": { "phpunit/phpunit": "^9", "phpstan/phpstan": "^1.10", - "squizlabs/php_codesniffer": "^3.7" + "friendsofphp/php-cs-fixer": "^3.40" }, "scripts": { "analyze": "vendor/bin/phpstan --memory-limit=1000000000 analyze src examples tests", From 9c063b8798d5963b737b9f00aa702300d0267043 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 11 Dec 2023 06:57:30 +0100 Subject: [PATCH 08/81] Configured cs fixer, ran cs fixer --- .php-cs-fixer.php | 4 +- composer.json | 4 +- examples/test.php | 2 +- examples/validation.php | 2 +- examples/webhook.php | 12 +- src/Classes/Apis/AuthTokensInterface.php | 5 +- src/Classes/Apis/EmailLinksInterface.php | 5 +- src/Classes/Apis/SMSCodesInterface.php | 5 +- src/Classes/Apis/Users.php | 4 +- src/Classes/Apis/UsersInterface.php | 5 +- src/Classes/Apis/Validations.php | 174 +++++++++--------- src/Classes/Apis/ValidationsInterface.php | 3 +- src/Classes/Assert.php | 16 +- src/Classes/Exceptions/AssertException.php | 5 +- .../Exceptions/ConfigurationException.php | 5 +- src/Classes/Exceptions/ServerException.php | 17 +- src/Classes/Exceptions/StandardException.php | 5 +- src/Classes/Helper.php | 6 +- src/Classes/Session.php | 11 +- src/Classes/User.php | 23 ++- src/Classes/Webhook.php | 35 ++-- .../WebhookModels/AuthMethodsDataResponse.php | 6 +- .../WebhookModels/AuthMethodsResponse.php | 1 - .../WebhookModels/PasswordVerifyResponse.php | 1 - src/SDK.php | 2 +- tests/Classes/SessionTest.php | 20 +- tests/Classes/UserTest.php | 39 ++-- tests/ConfigurationTest.php | 10 +- 28 files changed, 229 insertions(+), 198 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 5b134ac..2c9c625 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,8 +1,8 @@ exclude(['vendor', 'src/Generated']) - ->in(__DIR__); + ->in(__DIR__) + ->notPath('src/Generated'); $config = new PhpCsFixer\Config(); $config->setFinder($finder); diff --git a/composer.json b/composer.json index 0e98ad1..a97d0f2 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,8 @@ }, "scripts": { "analyze": "vendor/bin/phpstan --memory-limit=1000000000 analyze src examples tests", - "test": "vendor/bin/phpunit --colors=always --bootstrap vendor/autoload.php tests" + "test": "vendor/bin/phpunit --colors=always --bootstrap vendor/autoload.php tests", + "cs": "vendor/bin/php-cs-fixer check --diff --config=.php-cs-fixer.php", + "cs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php" } } diff --git a/examples/test.php b/examples/test.php index 8f72443..7a00986 100644 --- a/examples/test.php +++ b/examples/test.php @@ -37,4 +37,4 @@ } catch (Throwable $e) { echo $e->getMessage(); -} \ No newline at end of file +} diff --git a/examples/validation.php b/examples/validation.php index 8df683a..52c7f60 100644 --- a/examples/validation.php +++ b/examples/validation.php @@ -25,4 +25,4 @@ print_r($e->getError()); } catch (Throwable $e) { echo 'Throwable:' . $e->getMessage(); -} \ No newline at end of file +} diff --git a/examples/webhook.php b/examples/webhook.php index c2fa6cc..e2a8d03 100644 --- a/examples/webhook.php +++ b/examples/webhook.php @@ -38,8 +38,8 @@ break; - // Handle the "passwordVerify" action which basically checks - // if the given username and password are valid. + // Handle the "passwordVerify" action which basically checks + // if the given username and password are valid. case $webhook::ACTION_PASSWORD_VERIFY: $request = $webhook->getPasswordVerifyRequest(); @@ -80,7 +80,8 @@ * @param string $username * @return string */ -function getUserStatus(string $username) : string { +function getUserStatus(string $username): string +{ ///////////////////////////////////// // Implement your logic here! //////////////////////////////////// @@ -102,7 +103,8 @@ function getUserStatus(string $username) : string { * @param string $password * @return bool */ -function verifyPassword(string $username, string $password) : bool { +function verifyPassword(string $username, string $password): bool +{ ///////////////////////////////////// // Implement your logic here! //////////////////////////////////// @@ -113,4 +115,4 @@ function verifyPassword(string $username, string $password) : bool { } return false; -} \ No newline at end of file +} diff --git a/src/Classes/Apis/AuthTokensInterface.php b/src/Classes/Apis/AuthTokensInterface.php index 96fecf7..d3b7a08 100644 --- a/src/Classes/Apis/AuthTokensInterface.php +++ b/src/Classes/Apis/AuthTokensInterface.php @@ -5,6 +5,7 @@ use Corbado\Generated\Model\AuthTokenValidateReq; use Corbado\Generated\Model\AuthTokenValidateRsp; -interface AuthTokensInterface { +interface AuthTokensInterface +{ public function validate(AuthTokenValidateReq $req): AuthTokenValidateRsp; -} \ No newline at end of file +} diff --git a/src/Classes/Apis/EmailLinksInterface.php b/src/Classes/Apis/EmailLinksInterface.php index 65adf1e..46ec281 100644 --- a/src/Classes/Apis/EmailLinksInterface.php +++ b/src/Classes/Apis/EmailLinksInterface.php @@ -7,7 +7,8 @@ use Corbado\Generated\Model\EmailLinksValidateReq; use Corbado\Generated\Model\EmailLinkValidateRsp; -interface EmailLinksInterface { +interface EmailLinksInterface +{ public function send(EmailLinkSendReq $req): EmailLinkSendRsp; public function validate(string $id, EmailLinksValidateReq $req): EmailLinkValidateRsp; -} \ No newline at end of file +} diff --git a/src/Classes/Apis/SMSCodesInterface.php b/src/Classes/Apis/SMSCodesInterface.php index 5a2178d..84cf1e2 100644 --- a/src/Classes/Apis/SMSCodesInterface.php +++ b/src/Classes/Apis/SMSCodesInterface.php @@ -7,7 +7,8 @@ use Corbado\Generated\Model\SmsCodeValidateReq; use Corbado\Generated\Model\SmsCodeValidateRsp; -interface SMSCodesInterface { +interface SMSCodesInterface +{ public function send(SmsCodeSendReq $req): SmsCodeSendRsp; public function validate(string $id, SmsCodeValidateReq $req): SmsCodeValidateRsp; -} \ No newline at end of file +} diff --git a/src/Classes/Apis/Users.php b/src/Classes/Apis/Users.php index 83932cd..51cb6e9 100644 --- a/src/Classes/Apis/Users.php +++ b/src/Classes/Apis/Users.php @@ -56,7 +56,7 @@ public function create(UserCreateReq $req): UserCreateRsp * @throws AssertException * @throws ServerException */ - public function delete(string $id, UserDeleteReq $req) : GenericRsp + public function delete(string $id, UserDeleteReq $req): GenericRsp { Assert::stringNotEmpty($id); Assert::notNull($req); @@ -79,7 +79,7 @@ public function delete(string $id, UserDeleteReq $req) : GenericRsp * @throws AssertException * @throws ServerException */ - public function get(string $id, string $remoteAddr = '', string $userAgent = '') : UserGetRsp + public function get(string $id, string $remoteAddr = '', string $userAgent = ''): UserGetRsp { Assert::stringNotEmpty($id); diff --git a/src/Classes/Apis/UsersInterface.php b/src/Classes/Apis/UsersInterface.php index a4f515a..85f4c68 100644 --- a/src/Classes/Apis/UsersInterface.php +++ b/src/Classes/Apis/UsersInterface.php @@ -8,8 +8,9 @@ use Corbado\Generated\Model\UserDeleteReq; use Corbado\Generated\Model\UserGetRsp; -interface UsersInterface { +interface UsersInterface +{ public function create(UserCreateReq $req): UserCreateRsp; - public function delete(string $id, UserDeleteReq $req) : GenericRsp; + public function delete(string $id, UserDeleteReq $req): GenericRsp; public function get(string $id, string $remoteAddr = '', string $userAgent = ''): UserGetRsp; } diff --git a/src/Classes/Apis/Validations.php b/src/Classes/Apis/Validations.php index c518096..266a205 100644 --- a/src/Classes/Apis/Validations.php +++ b/src/Classes/Apis/Validations.php @@ -1,87 +1,87 @@ -api = $api; - } - - /** - * Validates email address - * - * @throws AssertException - * @throws ServerException - * @throws StandardException - */ - public function validateEmail(ValidateEmailReq $req): ValidateEmailRsp - { - Assert::notNull($req); - - try { - $rsp = $this->api->validateEmail($req); - } catch (ApiException $e) { - throw Helper::convertToServerException($e); - } - - if ($rsp instanceof ErrorRsp) { - throw new StandardException('Got unexpected ErrorRsp'); - } - - return $rsp; - } - - /** - * Validates phone number - * - * @throws AssertException - * @throws StandardException - * @throws ServerException - */ - public function validatePhoneNumber(ValidatePhoneNumberReq $req): ValidatePhoneNumberRsp - { - Assert::notNull($req); - - try { - $rsp = $this->api->validatePhoneNumber($req); - } catch (ApiException $e) { - throw Helper::convertToServerException($e); - } - - if ($rsp instanceof ErrorRsp) { - throw new StandardException('Got unexpected ErrorRsp'); - } - - return $rsp; - } -} +api = $api; + } + + /** + * Validates email address + * + * @throws AssertException + * @throws ServerException + * @throws StandardException + */ + public function validateEmail(ValidateEmailReq $req): ValidateEmailRsp + { + Assert::notNull($req); + + try { + $rsp = $this->api->validateEmail($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } + + /** + * Validates phone number + * + * @throws AssertException + * @throws StandardException + * @throws ServerException + */ + public function validatePhoneNumber(ValidatePhoneNumberReq $req): ValidatePhoneNumberRsp + { + Assert::notNull($req); + + try { + $rsp = $this->api->validatePhoneNumber($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } +} diff --git a/src/Classes/Apis/ValidationsInterface.php b/src/Classes/Apis/ValidationsInterface.php index 8836928..28fd1a8 100644 --- a/src/Classes/Apis/ValidationsInterface.php +++ b/src/Classes/Apis/ValidationsInterface.php @@ -7,7 +7,8 @@ use Corbado\Generated\Model\ValidatePhoneNumberReq; use Corbado\Generated\Model\ValidatePhoneNumberRsp; -interface ValidationsInterface { +interface ValidationsInterface +{ public function validateEmail(ValidateEmailReq $req): ValidateEmailRsp; public function validatePhoneNumber(ValidatePhoneNumberReq $req): ValidatePhoneNumberRsp; } diff --git a/src/Classes/Assert.php b/src/Classes/Assert.php index 6531492..35858ea 100644 --- a/src/Classes/Assert.php +++ b/src/Classes/Assert.php @@ -2,8 +2,8 @@ namespace Corbado\Classes; -class Assert { - +class Assert +{ /** * Checks if given data is not null * @@ -11,7 +11,8 @@ class Assert { * @return void * @throws \Corbado\Classes\Exceptions\AssertException */ - public static function notNull(mixed $data) : void { + public static function notNull(mixed $data): void + { if ($data === null) { throw new Exceptions\AssertException('Assert failed: Given data is null'); } @@ -24,7 +25,8 @@ public static function notNull(mixed $data) : void { * @return void * @throws \Corbado\Classes\Exceptions\AssertException */ - public static function stringNotEmpty(string $data) : void { + public static function stringNotEmpty(string $data): void + { if ($data == '') { throw new Exceptions\AssertException('Assert failed: Given string is empty'); } @@ -38,7 +40,8 @@ public static function stringNotEmpty(string $data) : void { * @return void * @throws \Corbado\Classes\Exceptions\AssertException */ - public static function stringEquals(string $data, array $possibleValues) : void { + public static function stringEquals(string $data, array $possibleValues): void + { self::stringNotEmpty($data); if (in_array($data, $possibleValues, true)) { @@ -56,7 +59,8 @@ public static function stringEquals(string $data, array $possibleValues) : void * @return void * @throws \Corbado\Classes\Exceptions\AssertException */ - public static function arrayKeysExist(array $data, array $keys) : void { + public static function arrayKeysExist(array $data, array $keys): void + { foreach ($keys as $key) { if (!array_key_exists($key, $data)) { throw new Exceptions\AssertException('Assert failed: Given array has no key "' . $key . '"'); diff --git a/src/Classes/Exceptions/AssertException.php b/src/Classes/Exceptions/AssertException.php index 6af7289..aa6e8d8 100644 --- a/src/Classes/Exceptions/AssertException.php +++ b/src/Classes/Exceptions/AssertException.php @@ -2,5 +2,6 @@ namespace Corbado\Classes\Exceptions; -class AssertException extends \Exception { -} \ No newline at end of file +class AssertException extends \Exception +{ +} diff --git a/src/Classes/Exceptions/ConfigurationException.php b/src/Classes/Exceptions/ConfigurationException.php index c46b3d4..401e602 100644 --- a/src/Classes/Exceptions/ConfigurationException.php +++ b/src/Classes/Exceptions/ConfigurationException.php @@ -2,5 +2,6 @@ namespace Corbado\Classes\Exceptions; -class ConfigurationException extends \Exception { -} \ No newline at end of file +class ConfigurationException extends \Exception +{ +} diff --git a/src/Classes/Exceptions/ServerException.php b/src/Classes/Exceptions/ServerException.php index 90d203e..b9cf449 100644 --- a/src/Classes/Exceptions/ServerException.php +++ b/src/Classes/Exceptions/ServerException.php @@ -2,7 +2,8 @@ namespace Corbado\Classes\Exceptions; -class ServerException extends \Exception { +class ServerException extends \Exception +{ private int $httpStatusCode; /** @@ -30,25 +31,29 @@ public function __construct(int $httpStatusCode, string $message, array $request $this->error = $error; } - public function getHttpStatusCode(): int { + public function getHttpStatusCode(): int + { return $this->httpStatusCode; } /** * @return array */ - public function getRequestData(): array { + public function getRequestData(): array + { return $this->requestData; } - public function getRuntime(): float { + public function getRuntime(): float + { return $this->runtime; } /** * @return array */ - public function getError(): array { + public function getError(): array + { return $this->error; } -} \ No newline at end of file +} diff --git a/src/Classes/Exceptions/StandardException.php b/src/Classes/Exceptions/StandardException.php index 51be4dd..cb4c085 100644 --- a/src/Classes/Exceptions/StandardException.php +++ b/src/Classes/Exceptions/StandardException.php @@ -2,5 +2,6 @@ namespace Corbado\Classes\Exceptions; -class StandardException extends \Exception { -} \ No newline at end of file +class StandardException extends \Exception +{ +} diff --git a/src/Classes/Helper.php b/src/Classes/Helper.php index fc58469..4e24b37 100644 --- a/src/Classes/Helper.php +++ b/src/Classes/Helper.php @@ -61,13 +61,13 @@ public static function isErrorHttpStatusCode(int $statusCode): bool * @throws AssertException * @throws ServerException */ - public static function throwServerExceptionOld(array $data) : void + public static function throwServerExceptionOld(array $data): void { Assert::arrayKeysExist($data, ['httpStatusCode', 'message', 'requestData', 'runtime']); // Check for error data, not existent for 404 for example if (!array_key_exists('error', $data)) { - $data['error'] = []; + $data['error'] = []; } throw new ServerException($data['httpStatusCode'], $data['message'], $data['requestData'], $data['runtime'], $data['error']); @@ -76,7 +76,7 @@ public static function throwServerExceptionOld(array $data) : void /** * @throws StandardException */ - public static function convertToServerException(ApiException $e) : ServerException + public static function convertToServerException(ApiException $e): ServerException { $body = $e->getResponseBody(); if (!is_string($body)) { diff --git a/src/Classes/Session.php b/src/Classes/Session.php index 58ca091..8a2dec6 100644 --- a/src/Classes/Session.php +++ b/src/Classes/Session.php @@ -48,7 +48,7 @@ public function __construct(ClientInterface $client, string $shortSessionCookieN * @return string * @throws Exceptions\AssertException */ - public function getShortSessionValue() : string + public function getShortSessionValue(): string { if (!empty($_COOKIE[$this->shortSessionCookieName])) { return $_COOKIE[$this->shortSessionCookieName]; @@ -68,7 +68,7 @@ public function getShortSessionValue() : string * @return stdClass|null Returns stdClass on success, otherwise null * @throws Exceptions\AssertException */ - public function validateShortSessionValue(string $value) : ?stdClass + public function validateShortSessionValue(string $value): ?stdClass { Assert::stringNotEmpty($value); @@ -110,7 +110,7 @@ public function validateShortSessionValue(string $value) : ?stdClass * * @return string */ - public function getLastShortSessionValidationResult() : string + public function getLastShortSessionValidationResult(): string { return $this->lastShortSessionValidationResult; } @@ -124,7 +124,7 @@ public function getLastShortSessionValidationResult() : string * @return User * @throws Exceptions\AssertException */ - public function getCurrentUser() : User + public function getCurrentUser(): User { $guest = new User(false); @@ -169,7 +169,8 @@ public function getCurrentUser() : User * @return string * @throws Exceptions\AssertException */ - private function extractBearerToken(string $authorizationHeader) : string { + private function extractBearerToken(string $authorizationHeader): string + { Assert::stringNotEmpty($authorizationHeader); if (!str_starts_with($authorizationHeader, 'Bearer ')) { diff --git a/src/Classes/User.php b/src/Classes/User.php index 151b32f..e5c511c 100644 --- a/src/Classes/User.php +++ b/src/Classes/User.php @@ -4,14 +4,16 @@ use Corbado\Classes\Exceptions\StandardException; -class User { +class User +{ private bool $authenticated; private string $id; private string $name; private string $email; private string $phoneNumber; - public function __construct(bool $authenticated, string $id = '', string $name = '', string $email = '', string $phoneNumber = '') { + public function __construct(bool $authenticated, string $id = '', string $name = '', string $email = '', string $phoneNumber = '') + { $this->authenticated = $authenticated; $this->id = $id; $this->name = $name; @@ -19,14 +21,16 @@ public function __construct(bool $authenticated, string $id = '', string $name = $this->phoneNumber = $phoneNumber; } - public function isAuthenticated() : bool { + public function isAuthenticated(): bool + { return $this->authenticated; } /** * @throws StandardException */ - public function getID() : string { + public function getID(): string + { if ($this->isAuthenticated() === false) { throw new StandardException('User is not authenticated'); } @@ -37,7 +41,8 @@ public function getID() : string { /** * @throws StandardException */ - public function getName() : string { + public function getName(): string + { if ($this->isAuthenticated() === false) { throw new StandardException('User is not authenticated'); } @@ -48,7 +53,8 @@ public function getName() : string { /** * @throws StandardException */ - public function getEmail() : string { + public function getEmail(): string + { if ($this->isAuthenticated() === false) { throw new StandardException('User is not authenticated'); } @@ -59,11 +65,12 @@ public function getEmail() : string { /** * @throws StandardException */ - public function getPhoneNumber() : string { + public function getPhoneNumber(): string + { if ($this->isAuthenticated() === false) { throw new StandardException('User is not authenticated'); } return $this->phoneNumber; } -} \ No newline at end of file +} diff --git a/src/Classes/Webhook.php b/src/Classes/Webhook.php index e8c87d4..6e21979 100644 --- a/src/Classes/Webhook.php +++ b/src/Classes/Webhook.php @@ -32,9 +32,9 @@ class Webhook */ private bool $authenticated = false; - const ACTION_AUTH_METHODS = 'auth_methods'; - const ACTION_PASSWORD_VERIFY = 'password_verify'; - const STANDARD_FIELDS = ['id', 'projectID', 'action', 'data']; + public const ACTION_AUTH_METHODS = 'auth_methods'; + public const ACTION_PASSWORD_VERIFY = 'password_verify'; + public const STANDARD_FIELDS = ['id', 'projectID', 'action', 'data']; /** * Constructor @@ -60,7 +60,7 @@ public function __construct(string $username, string $password) * * @return void */ - public function disableAutomaticAuthenticationHandling() : void + public function disableAutomaticAuthenticationHandling(): void { $this->automaticAuthenticationHandling = false; } @@ -70,7 +70,8 @@ public function disableAutomaticAuthenticationHandling() : void * * @return bool */ - public function checkAuthentication() : bool { + public function checkAuthentication(): bool + { if (empty($_SERVER['PHP_AUTH_USER'])) { return false; } @@ -92,7 +93,7 @@ public function checkAuthentication() : bool { * @param bool $exit If true the methods exists, default is true * @return void */ - public function sendUnauthorizedResponse(bool $exit = true) : void + public function sendUnauthorizedResponse(bool $exit = true): void { header('WWW-Authenticate: Basic realm="Webhook"'); header('HTTP/1.0 401 Unauthorized'); @@ -109,7 +110,7 @@ public function sendUnauthorizedResponse(bool $exit = true) : void * @return void * @throws StandardException */ - public function handleAuthentication() : void + public function handleAuthentication(): void { if ($this->authenticated) { throw new StandardException("Already authenticated, something is wrong"); @@ -130,7 +131,7 @@ public function handleAuthentication() : void * @return void * @throws StandardException */ - private function checkAutomaticAuthentication() : void + private function checkAutomaticAuthentication(): void { if ($this->automaticAuthenticationHandling === false) { return; @@ -149,7 +150,7 @@ private function checkAutomaticAuthentication() : void * @return bool * @throws StandardException */ - public function isPost() : bool + public function isPost(): bool { $this->checkAutomaticAuthentication(); @@ -162,7 +163,7 @@ public function isPost() : bool * @return string * @throws StandardException */ - public function getAction() : string + public function getAction(): string { $this->checkAutomaticAuthentication(); @@ -189,7 +190,7 @@ public function getAction() : string * @throws Classes\Exceptions\AssertException * @throws StandardException */ - public function getAuthMethodsRequest() : \Corbado\Classes\WebhookModels\AuthMethodsRequest + public function getAuthMethodsRequest(): \Corbado\Classes\WebhookModels\AuthMethodsRequest { $this->checkAutomaticAuthentication(); @@ -219,7 +220,7 @@ public function getAuthMethodsRequest() : \Corbado\Classes\WebhookModels\AuthMet * @throws StandardException * @throws Classes\Exceptions\AssertException */ - public function sendAuthMethodsResponse(string $status, bool $exit = true, string $responseID = '') : void + public function sendAuthMethodsResponse(string $status, bool $exit = true, string $responseID = ''): void { Assert::stringEquals($status, ['exists', 'not_exists', 'blocked']); @@ -246,7 +247,7 @@ public function sendAuthMethodsResponse(string $status, bool $exit = true, strin * @throws StandardException * @throws Classes\Exceptions\AssertException */ - public function getPasswordVerifyRequest() : \Corbado\Classes\WebhookModels\PasswordVerifyRequest + public function getPasswordVerifyRequest(): \Corbado\Classes\WebhookModels\PasswordVerifyRequest { $this->checkAutomaticAuthentication(); @@ -276,7 +277,7 @@ public function getPasswordVerifyRequest() : \Corbado\Classes\WebhookModels\Pass * @return void * @throws StandardException */ - public function sendPasswordVerifyResponse(bool $success, bool $exit = true, string $responseID = '') : void + public function sendPasswordVerifyResponse(bool $success, bool $exit = true, string $responseID = ''): void { $this->checkAutomaticAuthentication(); @@ -300,7 +301,8 @@ public function sendPasswordVerifyResponse(bool $success, bool $exit = true, str * @return string * @throws StandardException */ - private function getRequestBody() : string { + private function getRequestBody(): string + { $body = file_get_contents('php://input'); if ($body === false) { throw new StandardException('Could not read request body (POST request)'); @@ -316,7 +318,8 @@ private function getRequestBody() : string { * @return void * @throws StandardException */ - private function sendResponse($response) : void { + private function sendResponse($response): void + { header('Content-Type: application/json; charset=utf-8'); echo Helper::jsonEncode($response); } diff --git a/src/Classes/WebhookModels/AuthMethodsDataResponse.php b/src/Classes/WebhookModels/AuthMethodsDataResponse.php index 0eb3b9d..3971f22 100644 --- a/src/Classes/WebhookModels/AuthMethodsDataResponse.php +++ b/src/Classes/WebhookModels/AuthMethodsDataResponse.php @@ -4,9 +4,9 @@ class AuthMethodsDataResponse { - const USER_EXISTS = 'exists'; - const USER_NOT_EXISTS = 'not_exists'; - const USER_BLOCKED = 'blocked'; + public const USER_EXISTS = 'exists'; + public const USER_NOT_EXISTS = 'not_exists'; + public const USER_BLOCKED = 'blocked'; public string $status; } diff --git a/src/Classes/WebhookModels/AuthMethodsResponse.php b/src/Classes/WebhookModels/AuthMethodsResponse.php index dd4dc0d..c0b8d95 100644 --- a/src/Classes/WebhookModels/AuthMethodsResponse.php +++ b/src/Classes/WebhookModels/AuthMethodsResponse.php @@ -6,4 +6,3 @@ class AuthMethodsResponse extends CommonResponse { public AuthMethodsDataResponse $data; } - diff --git a/src/Classes/WebhookModels/PasswordVerifyResponse.php b/src/Classes/WebhookModels/PasswordVerifyResponse.php index ba12e30..a111082 100644 --- a/src/Classes/WebhookModels/PasswordVerifyResponse.php +++ b/src/Classes/WebhookModels/PasswordVerifyResponse.php @@ -6,4 +6,3 @@ class PasswordVerifyResponse extends CommonResponse { public PasswordVerifyDataResponse $data; } - diff --git a/src/SDK.php b/src/SDK.php index b3c2c5c..c551a37 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -34,7 +34,7 @@ class SDK private ?Session $session = null; private ?AuthTokensInterface $authTokens = null; - const VERSION = '1.0.0'; + public const VERSION = '1.0.0'; /** * Constructor diff --git a/tests/Classes/SessionTest.php b/tests/Classes/SessionTest.php index f7bc1bb..6796201 100644 --- a/tests/Classes/SessionTest.php +++ b/tests/Classes/SessionTest.php @@ -20,7 +20,7 @@ class SessionTest extends TestCase * @throws AssertException * @throws Exception */ - public function testGetShortSessionValue() : void + public function testGetShortSessionValue(): void { $session = self::createSession(); @@ -68,22 +68,22 @@ public static function provideJWTs(): array [ // Not before (nfb) in future false, - self::generateJWT('https://auth.acme.com', time() + 100, time() + 100) + self::generateJWT('https://auth.acme.com', time() + 100, time() + 100) ], [ // Expired (exp) false, - self::generateJWT('https://auth.acme.com', time() - 100, time() - 100) + self::generateJWT('https://auth.acme.com', time() - 100, time() - 100) ], [ // Invalid issuer (iss) false, - self::generateJWT('https://invalid.com', time() + 100, time() - 100) + self::generateJWT('https://invalid.com', time() + 100, time() - 100) ], [ // Success true, - self::generateJWT('https://auth.acme.com', time() + 100, time() - 100) + self::generateJWT('https://auth.acme.com', time() + 100, time() - 100) ] ]; } @@ -91,7 +91,7 @@ public static function provideJWTs(): array /** * @throws Exception */ - public function testGetCurrentUserGuest() : void + public function testGetCurrentUserGuest(): void { $session = self::createSession(); $user = $session->getCurrentUser(); @@ -101,7 +101,7 @@ public function testGetCurrentUserGuest() : void /** * @throws Exception */ - public function testGetCurrentUserAuthenticated() : void + public function testGetCurrentUserAuthenticated(): void { $_COOKIE['cbo_short_session'] = self::generateJWT('https://auth.acme.com', time() + 100, time() - 100); @@ -113,7 +113,7 @@ public function testGetCurrentUserAuthenticated() : void /** * @throws Exception */ - private static function createSession() : Session + private static function createSession(): Session { $jwks = file_get_contents(dirname(__FILE__) . '/testdata/jwks.json'); if ($jwks === false) { @@ -129,7 +129,7 @@ private static function createSession() : Session $handlerStack = HandlerStack::create($mock); $client = new Client(['handler' => $handlerStack]); - $cacheItemPool = new class implements CacheItemPoolInterface { + $cacheItemPool = new class () implements CacheItemPoolInterface { /** * @var array */ @@ -141,7 +141,7 @@ public function getItem(string $key): CacheItemInterface return $this->items[$key]; } - return new class($key) implements CacheItemInterface { + return new class ($key) implements CacheItemInterface { private string $key; private mixed $value; private bool $isHit; diff --git a/tests/Classes/UserTest.php b/tests/Classes/UserTest.php index 982e128..ca1cae6 100644 --- a/tests/Classes/UserTest.php +++ b/tests/Classes/UserTest.php @@ -3,28 +3,29 @@ use Corbado\Classes\User; use PHPUnit\Framework\TestCase; -class UserTest extends TestCase { - public function testIsGuest() : void - { - $user = new User(false); - $this->assertFalse($user->isAuthenticated()); - } +class UserTest extends TestCase +{ + public function testIsGuest(): void + { + $user = new User(false); + $this->assertFalse($user->isAuthenticated()); + } - public function testIsAuthenticated() : void - { - $user = new User(true); - $this->assertTrue($user->isAuthenticated()); - } + public function testIsAuthenticated(): void + { + $user = new User(true); + $this->assertTrue($user->isAuthenticated()); + } /** * @throws \Corbado\Classes\Exceptions\StandardException */ - public function testGetUserData() : void - { - $user = new User(true, 'id', 'name', 'email', 'phone-number'); - $this->assertEquals('id', $user->getID()); - $this->assertEquals('name', $user->getName()); - $this->assertEquals('email', $user->getEmail()); - $this->assertEquals('phone-number', $user->getPhoneNumber()); - } + public function testGetUserData(): void + { + $user = new User(true, 'id', 'name', 'email', 'phone-number'); + $this->assertEquals('id', $user->getID()); + $this->assertEquals('name', $user->getName()); + $this->assertEquals('email', $user->getEmail()); + $this->assertEquals('phone-number', $user->getPhoneNumber()); + } } diff --git a/tests/ConfigurationTest.php b/tests/ConfigurationTest.php index 6e09a1d..8568f47 100644 --- a/tests/ConfigurationTest.php +++ b/tests/ConfigurationTest.php @@ -11,7 +11,7 @@ class ConfigurationTest extends TestCase * @param bool $valid * @return void */ - public function testSetFrontendAPI(string $frontendAPI, bool $valid) : void + public function testSetFrontendAPI(string $frontendAPI, bool $valid): void { try { $config = new Configuration('pro-123', 'corbado1_123'); @@ -30,7 +30,7 @@ public function testSetFrontendAPI(string $frontendAPI, bool $valid) : void * @param bool $valid * @return void */ - public function testSetBackendAPI(string $backendAPI, bool $valid) : void + public function testSetBackendAPI(string $backendAPI, bool $valid): void { try { $config = new Configuration('pro-123', 'corbado1_123'); @@ -43,7 +43,7 @@ public function testSetBackendAPI(string $backendAPI, bool $valid) : void $this->assertEquals($valid, !$error); } - public function testGetFrontendAPI() : void + public function testGetFrontendAPI(): void { $config = new Configuration('pro-123', 'corbado1_123'); $this->assertEquals('https://pro-123.frontendapi.corbado.io', $config->getFrontendAPI()); @@ -52,7 +52,7 @@ public function testGetFrontendAPI() : void /** * @return array> */ - public function provideURLs() : array + public function provideURLs(): array { return [ ['', false], @@ -66,4 +66,4 @@ public function provideURLs() : array ['https://auth.acme.com', true], ]; } -} \ No newline at end of file +} From 981bcb5f019b7852da6a2ec2c295afcd398ebcae Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 11 Dec 2023 07:00:52 +0100 Subject: [PATCH 09/81] Renamed to --- src/Classes/Apis/AuthTokens.php | 10 +++++----- src/Classes/Apis/EmailLinks.php | 12 ++++++------ src/Classes/Apis/SMSCodes.php | 12 ++++++------ src/Classes/Apis/Users.php | 14 +++++++------- src/Classes/Apis/Validations.php | 12 ++++++------ 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Classes/Apis/AuthTokens.php b/src/Classes/Apis/AuthTokens.php index f2103d5..7b4048e 100644 --- a/src/Classes/Apis/AuthTokens.php +++ b/src/Classes/Apis/AuthTokens.php @@ -15,15 +15,15 @@ class AuthTokens implements AuthTokensInterface { - private AuthTokensApi $api; + private AuthTokensApi $client; /** * @throws AssertException */ - public function __construct(AuthTokensApi $api) + public function __construct(AuthTokensApi $client) { - Assert::notNull($api); - $this->api = $api; + Assert::notNull($client); + $this->client = $client; } /** @@ -38,7 +38,7 @@ public function validate(AuthTokenValidateReq $req): AuthTokenValidateRsp Assert::notNull($req); try { - $rsp = $this->api->authTokenValidate($req); + $rsp = $this->client->authTokenValidate($req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } diff --git a/src/Classes/Apis/EmailLinks.php b/src/Classes/Apis/EmailLinks.php index bcbff6f..33b9b49 100644 --- a/src/Classes/Apis/EmailLinks.php +++ b/src/Classes/Apis/EmailLinks.php @@ -17,15 +17,15 @@ class EmailLinks implements EmailLinksInterface { - private EmailMagicLinksApi $api; + private EmailMagicLinksApi $client; /** * @throws AssertException */ - public function __construct(EmailMagicLinksApi $api) + public function __construct(EmailMagicLinksApi $client) { - Assert::notNull($api); - $this->api = $api; + Assert::notNull($client); + $this->client = $client; } /** @@ -38,7 +38,7 @@ public function send(EmailLinkSendReq $req): EmailLinkSendRsp Assert::notNull($req); try { - $rsp = $this->api->emailLinkSend($req); + $rsp = $this->client->emailLinkSend($req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } @@ -61,7 +61,7 @@ public function validate(string $id, EmailLinksValidateReq $req): EmailLinkValid Assert::notNull($req); try { - $rsp = $this->api->emailLinkValidate($id, $req); + $rsp = $this->client->emailLinkValidate($id, $req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } diff --git a/src/Classes/Apis/SMSCodes.php b/src/Classes/Apis/SMSCodes.php index 1c0dbad..0603ef9 100644 --- a/src/Classes/Apis/SMSCodes.php +++ b/src/Classes/Apis/SMSCodes.php @@ -17,15 +17,15 @@ class SMSCodes implements SMSCodesInterface { - private SMSOTPApi $api; + private SMSOTPApi $client; /** * @throws AssertException */ - public function __construct(SMSOTPApi $api) + public function __construct(SMSOTPApi $client) { - Assert::notNull($api); - $this->api = $api; + Assert::notNull($client); + $this->client = $client; } /** @@ -38,7 +38,7 @@ public function send(SmsCodeSendReq $req): SmsCodeSendRsp Assert::notNull($req); try { - $rsp = $this->api->smsCodeSend($req); + $rsp = $this->client->smsCodeSend($req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } @@ -61,7 +61,7 @@ public function validate(string $id, SmsCodeValidateReq $req): SmsCodeValidateRs Assert::notNull($req); try { - $rsp = $this->api->smsCodeValidate($id, $req); + $rsp = $this->client->smsCodeValidate($id, $req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } diff --git a/src/Classes/Apis/Users.php b/src/Classes/Apis/Users.php index 51cb6e9..01be8f0 100644 --- a/src/Classes/Apis/Users.php +++ b/src/Classes/Apis/Users.php @@ -18,15 +18,15 @@ class Users implements UsersInterface { - private UserApi $api; + private UserApi $client; /** * @throws AssertException */ - public function __construct(UserApi $api) + public function __construct(UserApi $client) { - Assert::notNull($api); - $this->api = $api; + Assert::notNull($client); + $this->client = $client; } /** @@ -39,7 +39,7 @@ public function create(UserCreateReq $req): UserCreateRsp Assert::notNull($req); try { - $rsp = $this->api->userCreate($req); + $rsp = $this->client->userCreate($req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } @@ -62,7 +62,7 @@ public function delete(string $id, UserDeleteReq $req): GenericRsp Assert::notNull($req); try { - $rsp = $this->api->userDelete($id, $req); + $rsp = $this->client->userDelete($id, $req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } @@ -84,7 +84,7 @@ public function get(string $id, string $remoteAddr = '', string $userAgent = '') Assert::stringNotEmpty($id); try { - $rsp = $this->api->userGet($id, $remoteAddr, $userAgent); + $rsp = $this->client->userGet($id, $remoteAddr, $userAgent); } catch (ApiException $e) { throw Helper::convertToServerException($e); } diff --git a/src/Classes/Apis/Validations.php b/src/Classes/Apis/Validations.php index 266a205..e335776 100644 --- a/src/Classes/Apis/Validations.php +++ b/src/Classes/Apis/Validations.php @@ -26,15 +26,15 @@ class Validations implements ValidationsInterface { - private ValidationApi $api; + private ValidationApi $client; /** * @throws AssertException */ - public function __construct(ValidationApi $api) + public function __construct(ValidationApi $client) { - Assert::notNull($api); - $this->api = $api; + Assert::notNull($client); + $this->client = $client; } /** @@ -49,7 +49,7 @@ public function validateEmail(ValidateEmailReq $req): ValidateEmailRsp Assert::notNull($req); try { - $rsp = $this->api->validateEmail($req); + $rsp = $this->client->validateEmail($req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } @@ -73,7 +73,7 @@ public function validatePhoneNumber(ValidatePhoneNumberReq $req): ValidatePhoneN Assert::notNull($req); try { - $rsp = $this->api->validatePhoneNumber($req); + $rsp = $this->client->validatePhoneNumber($req); } catch (ApiException $e) { throw Helper::convertToServerException($e); } From ec0e730c690242b7ecfcb205240c44da44bf445d Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 11 Dec 2023 07:05:20 +0100 Subject: [PATCH 10/81] Added cs to github action --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 906a14c..de3a768 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,5 +47,8 @@ jobs: - name: Run analyze run: composer analyze + - name: Run cs + run: composer cs + - name: Run tests run: composer test \ No newline at end of file From 5963aaab4ca3696eaa49fa0eae1f07141435df3a Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 11 Dec 2023 07:22:02 +0100 Subject: [PATCH 11/81] Added basis for integration tests --- .github/workflows/build.yml | 8 ++++---- composer.json | 5 +++-- tests/integration/validation/ValidateEmailTest.php | 14 ++++++++++++++ tests/{ => unit}/Classes/SessionTest.php | 2 +- tests/{ => unit}/Classes/UserTest.php | 2 ++ tests/{ => unit}/Classes/testdata/jwks.json | 0 tests/{ => unit}/Classes/testdata/jwks.md | 0 tests/{ => unit}/Classes/testdata/privateKey.pem | 0 tests/{ => unit}/ConfigurationTest.php | 3 +++ 9 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 tests/integration/validation/ValidateEmailTest.php rename tests/{ => unit}/Classes/SessionTest.php (99%) rename tests/{ => unit}/Classes/UserTest.php (97%) rename tests/{ => unit}/Classes/testdata/jwks.json (100%) rename tests/{ => unit}/Classes/testdata/jwks.md (100%) rename tests/{ => unit}/Classes/testdata/privateKey.pem (100%) rename tests/{ => unit}/ConfigurationTest.php (98%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de3a768..ab9c567 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,8 +47,8 @@ jobs: - name: Run analyze run: composer analyze - - name: Run cs - run: composer cs + - name: Run cs check + run: composer cs-check - - name: Run tests - run: composer test \ No newline at end of file + - name: Run unit tests + run: composer unittests \ No newline at end of file diff --git a/composer.json b/composer.json index a97d0f2..17a5cd3 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,9 @@ }, "scripts": { "analyze": "vendor/bin/phpstan --memory-limit=1000000000 analyze src examples tests", - "test": "vendor/bin/phpunit --colors=always --bootstrap vendor/autoload.php tests", - "cs": "vendor/bin/php-cs-fixer check --diff --config=.php-cs-fixer.php", + "unittests": "vendor/bin/phpunit --colors=always --bootstrap vendor/autoload.php tests/unit", + "integrationtests": "vendor/bin/phpunit --colors=always --bootstrap vendor/autoload.php tests/integration", + "cs-check": "vendor/bin/php-cs-fixer check --diff --config=.php-cs-fixer.php", "cs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php" } } diff --git a/tests/integration/validation/ValidateEmailTest.php b/tests/integration/validation/ValidateEmailTest.php new file mode 100644 index 0000000..2785743 --- /dev/null +++ b/tests/integration/validation/ValidateEmailTest.php @@ -0,0 +1,14 @@ +assertEmpty($email); + } +} \ No newline at end of file diff --git a/tests/Classes/SessionTest.php b/tests/unit/Classes/SessionTest.php similarity index 99% rename from tests/Classes/SessionTest.php rename to tests/unit/Classes/SessionTest.php index 6796201..a847cd7 100644 --- a/tests/Classes/SessionTest.php +++ b/tests/unit/Classes/SessionTest.php @@ -1,6 +1,6 @@ Date: Mon, 11 Dec 2023 07:22:31 +0100 Subject: [PATCH 12/81] Added basis for integration tests --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab9c567..d101368 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,4 +51,7 @@ jobs: run: composer cs-check - name: Run unit tests - run: composer unittests \ No newline at end of file + run: composer unittests + + - name: Run integration tests + run: composer integrationtests \ No newline at end of file From d4bbf946d7d1ffd952aef5beb26ec0283ccdc67f Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 11 Dec 2023 07:34:37 +0100 Subject: [PATCH 13/81] Added basis for integration tests --- tests/integration/Utils.php | 38 +++++++++++++++++++ .../validation/ValidateEmailTest.php | 5 ++- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 tests/integration/Utils.php diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php new file mode 100644 index 0000000..727f420 --- /dev/null +++ b/tests/integration/Utils.php @@ -0,0 +1,38 @@ +setBackendAPI(self::getEnv('CORBADO_BACKEND_API')); + + return new SDK($config); + } + + /** + * @throws Exception + */ + private static function getEnv(string $key): string + { + $value = getenv($key); + if ($value === false) { + throw new Exception('Environment variable ' . $key . ' not found'); + } + + return $value; + } +} \ No newline at end of file diff --git a/tests/integration/validation/ValidateEmailTest.php b/tests/integration/validation/ValidateEmailTest.php index 2785743..e54a9f3 100644 --- a/tests/integration/validation/ValidateEmailTest.php +++ b/tests/integration/validation/ValidateEmailTest.php @@ -2,13 +2,14 @@ namespace integration\validation; +use integration\Utils; use PHPUnit\Framework\TestCase; class ValidateEmailTest extends TestCase { public function testValidateEmail(): void { - $email = ''; - $this->assertEmpty($email); + $res = Utils::SDK()->validations()->validateEmail(null); + $this->assertTrue($res); } } \ No newline at end of file From a9e3fc3541a714220853642fab3422ad2cec3d1d Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 12 Dec 2023 07:09:49 +0100 Subject: [PATCH 14/81] Finished validation integration test, added project config to GitHub action (secrets) --- .github/workflows/build.yml | 4 ++ composer.json | 5 ++- src/Classes/Exceptions/ServerException.php | 14 ++++++ .../Validation/ValidateEmailTest.php | 43 +++++++++++++++++++ .../validation/ValidateEmailTest.php | 15 ------- 5 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 tests/integration/Validation/ValidateEmailTest.php delete mode 100644 tests/integration/validation/ValidateEmailTest.php diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d101368..6f283ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,4 +54,8 @@ jobs: run: composer unittests - name: Run integration tests + env: + CORBADO_BACKEND_API: ${{ secrets.CORBADO_BACKEND_API }} + CORBADO_PROJECT_ID: ${{ secrets.CORBADO_PROJECT_ID }} + CORBADO_API_SECRET: ${{ secrets.CORBADO_API_SECRET }} run: composer integrationtests \ No newline at end of file diff --git a/composer.json b/composer.json index 17a5cd3..89c3083 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,10 @@ ], "license": "MIT", "autoload": { - "psr-4": {"Corbado\\": "src/"} + "psr-4": { + "Corbado\\": "src/", + "integration\\": "tests/integration/" + } }, "require": { "guzzlehttp/guzzle": "^7.5", diff --git a/src/Classes/Exceptions/ServerException.php b/src/Classes/Exceptions/ServerException.php index b9cf449..86794c4 100644 --- a/src/Classes/Exceptions/ServerException.php +++ b/src/Classes/Exceptions/ServerException.php @@ -56,4 +56,18 @@ public function getError(): array { return $this->error; } + + public function getValidationMessage(): string + { + if (empty($this->error)) { + return ''; + } + + $messages = []; + foreach ($this->error['validation'] as $item) { + $messages[] = $item['field'] . ': ' . $item['message']; + } + + return implode('; ', $messages); + } } diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php new file mode 100644 index 0000000..f7ee627 --- /dev/null +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -0,0 +1,43 @@ +validations()->validateEmail((new ValidateEmailReq())->setEmail('')); + } catch (ServerException $e) { + $exception = $e; + } catch (\Throwable $e) { + $this->fail('Unexpected exception: ' . $e->getMessage()); + } + + $this->assertNull($res); + $this->assertNotNull($exception); + $this->assertEquals(400, $exception->getHttpStatusCode()); + $this->assertEquals('email: cannot be blank', $exception->getValidationMessage()); + } + + public function testValidateEmailSuccess(): void + { + try { + $res = Utils::SDK()->validations()->validateEmail((new ValidateEmailReq())->setEmail('info@corbado.com')); + } catch (\Throwable $e) { + $this->fail('Unexpected exception: ' . $e->getMessage()); + } + + $this->assertTrue($res->getData()->getIsValid()); + } +} \ No newline at end of file diff --git a/tests/integration/validation/ValidateEmailTest.php b/tests/integration/validation/ValidateEmailTest.php deleted file mode 100644 index e54a9f3..0000000 --- a/tests/integration/validation/ValidateEmailTest.php +++ /dev/null @@ -1,15 +0,0 @@ -validations()->validateEmail(null); - $this->assertTrue($res); - } -} \ No newline at end of file From 25e952ca0303286f24246feb69ea1fc77d6a7ebb Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 12 Dec 2023 07:10:58 +0100 Subject: [PATCH 15/81] CS fix --- tests/integration/Utils.php | 2 +- tests/integration/Validation/ValidateEmailTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index 727f420..c4e46cf 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -35,4 +35,4 @@ private static function getEnv(string $key): string return $value; } -} \ No newline at end of file +} diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php index f7ee627..ae29b8f 100644 --- a/tests/integration/Validation/ValidateEmailTest.php +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -40,4 +40,4 @@ public function testValidateEmailSuccess(): void $this->assertTrue($res->getData()->getIsValid()); } -} \ No newline at end of file +} From aac3920bfc405fdacd7711f4ab89f0409880087d Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 12 Dec 2023 07:19:13 +0100 Subject: [PATCH 16/81] Added integration tests for phone number validation --- .../Validation/ValidateEmailTest.php | 2 - .../Validation/ValidatePhoneNumberTest.php | 42 +++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 tests/integration/Validation/ValidatePhoneNumberTest.php diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php index ae29b8f..910c558 100644 --- a/tests/integration/Validation/ValidateEmailTest.php +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -9,8 +9,6 @@ class ValidateEmailTest extends TestCase { - /** - */ public function testValidateEmailValidationError(): void { $res = null; diff --git a/tests/integration/Validation/ValidatePhoneNumberTest.php b/tests/integration/Validation/ValidatePhoneNumberTest.php new file mode 100644 index 0000000..76027d7 --- /dev/null +++ b/tests/integration/Validation/ValidatePhoneNumberTest.php @@ -0,0 +1,42 @@ +validations()->validatePhoneNumber((new ValidatePhoneNumberReq())->setPhoneNumber('')); + } catch (ServerException $e) { + $exception = $e; + } catch (\Throwable $e) { + $this->fail('Unexpected exception: ' . $e->getMessage()); + } + + $this->assertNull($res); + $this->assertNotNull($exception); + $this->assertEquals(400, $exception->getHttpStatusCode()); + $this->assertEquals('phoneNumber: cannot be blank', $exception->getValidationMessage()); + } + + public function testValidatePhoneNumberSuccess(): void + { + try { + $res = Utils::SDK()->validations()->validatePhoneNumber((new ValidatePhoneNumberReq())->setPhoneNumber('+49 151 12345678')); + } catch (\Throwable $e) { + $this->fail('Unexpected exception: ' . $e->getMessage()); + } + + $this->assertTrue($res->getData()->getIsValid()); + } +} From 552c1f22379ef1d45f37ec8e85edb889df57bc0a Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 12 Dec 2023 20:34:29 +0100 Subject: [PATCH 17/81] Removed old examples --- examples/test.php | 40 ---------------------------------------- examples/validation.php | 28 ---------------------------- 2 files changed, 68 deletions(-) delete mode 100644 examples/test.php delete mode 100644 examples/validation.php diff --git a/examples/test.php b/examples/test.php deleted file mode 100644 index 7a00986..0000000 --- a/examples/test.php +++ /dev/null @@ -1,40 +0,0 @@ -setToken($corbadoAuthToken); - $request->setClientInfo(SDK::createClientInfo($remoteAddress, $userAgent)); - - $response = $corbado->authTokens()->validate($request); - - echo $response->getData()->getUserId(); - -} catch (ApiException $e) { - echo $e->getMessage(); - echo "\n"; - - $body = $e->getResponseBody(); - if (is_string($body)) { - echo $body; - } else { - var_dump($body); - } - -} catch (Throwable $e) { - echo $e->getMessage(); -} diff --git a/examples/validation.php b/examples/validation.php deleted file mode 100644 index 52c7f60..0000000 --- a/examples/validation.php +++ /dev/null @@ -1,28 +0,0 @@ -setEmail('s@s.de'); - $request->setClientInfo(SDK::createClientInfo('127.0.0.1', 'PHP CLI')); - - $response = $corbado->validations()->validateEmail($request); - - echo $response->getData()->getIsValid() ? 'Valid' : 'Invalid'; - -} catch (ServerException $e) { - print_r($e->getMessage()); - print_r($e->getRuntime()); - print_r($e->getError()); -} catch (Throwable $e) { - echo 'Throwable:' . $e->getMessage(); -} From 6a44a4a9432b8d85f988043770a043954235a3b6 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 12 Dec 2023 20:59:37 +0100 Subject: [PATCH 18/81] README cleanup (text, badges etc.) --- README.md | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 2068f02..0a92851 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,17 @@ # Corbado PHP SDK -This SDK facilitates effortless integration of Corbado's Backend API within your PHP applications. +PHP SDK for Corbado Backend API -## Documentation - -For a detailed understanding of how to use the Corbado Backend API, refer to -the [Corbado Backend API Reference](https://api.corbado.com/docs/api/) -and [Corbado API-only integration guide](https://docs.corbado.com/integrations/api-only). +[![Test Status](https://github.com/corbado/corbado-php/workflows/build/badge.svg)](https://github.com/corbado/corbado-php/actions?query=workflow%3Abuild) +[![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://api.corbado.com/docs/api/) +[![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/corbado-php) +[![Latest Stable Version](http://poser.pugx.org/corbado/php-sdk/v)](https://packagist.org/packages/corbado/php-sdk) ## Requirements -Ensure your environment runs PHP 7.2 or higher. +The SDK supports PHP Version 7.2 and above. -## Installation +## Usage Use the following command to install the Corbado PHP SDK: @@ -20,19 +19,14 @@ Use the following command to install the Corbado PHP SDK: composer require corbado/php-sdk ``` -## Usage - -To initialize the SDK, supply it with your Corbado account's ```Project ID``` and ```API secret```. You can obtain these -parameters from the [Corbado developer panel](https://app.corbado.com). - -## Initialization +Now create a new SDK client: ```PHP $config = new Corbado\Configuration("", ""); $corbado = new Corbado\SDK($config); ``` -### Services +## Services The Corbado SDK provides a range of services including: @@ -41,10 +35,7 @@ The Corbado SDK provides a range of services including: - `Sessions` - `SMSCodes` - `Validation` -- `WebAuthn` -- `Widget` - -- `UserApi` +- `Users` To use a specific service, such as Session, invoke it as shown below: @@ -52,7 +43,7 @@ To use a specific service, such as Session, invoke it as shown below: $corbado->sessions()->getCurrentUser(); ``` -### Corbado session management +## Corbado session management Corbado offers an efficient and secure session management system (refer to the [documentation](https://docs.corbado.com/sessions/overview) for more details). From e357afcc15418f63c59c1a1689a1a4e2556157e5 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 12 Dec 2023 21:09:19 +0100 Subject: [PATCH 19/81] Added comment --- src/SDK.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SDK.php b/src/SDK.php index c551a37..a783393 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -55,6 +55,7 @@ public function __construct(Configuration $config) ] ); } else { + // SDK version might be missing, okay for now (auth needs to be set) $this->client = $this->config->getHttpClient(); } } From c053f08579723b6fab070ea06357353cdfd4295a Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 13 Dec 2023 07:23:17 +0100 Subject: [PATCH 20/81] Fixed users api interface, added integration test for user list, some minor improvements --- src/Classes/Apis/Users.php | 21 ++++++++ src/Classes/Apis/UsersInterface.php | 6 +++ src/SDK.php | 15 ++++-- tests/integration/User/UserListTest.php | 50 ++++++++++++++++++ tests/integration/Utils.php | 51 +++++++++++++++++++ .../Validation/ValidateEmailTest.php | 20 +++++--- .../Validation/ValidatePhoneNumberTest.php | 20 +++++--- 7 files changed, 164 insertions(+), 19 deletions(-) create mode 100644 tests/integration/User/UserListTest.php diff --git a/src/Classes/Apis/Users.php b/src/Classes/Apis/Users.php index 01be8f0..745b370 100644 --- a/src/Classes/Apis/Users.php +++ b/src/Classes/Apis/Users.php @@ -15,6 +15,7 @@ use Corbado\Generated\Model\UserCreateRsp; use Corbado\Generated\Model\UserDeleteReq; use Corbado\Generated\Model\UserGetRsp; +use Corbado\Generated\Model\UserListRsp; class Users implements UsersInterface { @@ -95,4 +96,24 @@ public function get(string $id, string $remoteAddr = '', string $userAgent = '') return $rsp; } + + /** + * @param array $filter + * @throws ServerException + * @throws StandardException + */ + public function list(string $remoteAddr = '', string $userAgent = '', string $sort = '', array $filter = [], int $page = 1, int $pageSize = 10): UserListRsp + { + try { + $rsp = $this->client->userList($remoteAddr, $userAgent, $sort, $filter, $page, $pageSize); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } } diff --git a/src/Classes/Apis/UsersInterface.php b/src/Classes/Apis/UsersInterface.php index 85f4c68..195f64b 100644 --- a/src/Classes/Apis/UsersInterface.php +++ b/src/Classes/Apis/UsersInterface.php @@ -7,10 +7,16 @@ use Corbado\Generated\Model\UserCreateRsp; use Corbado\Generated\Model\UserDeleteReq; use Corbado\Generated\Model\UserGetRsp; +use Corbado\Generated\Model\UserListRsp; interface UsersInterface { public function create(UserCreateReq $req): UserCreateRsp; public function delete(string $id, UserDeleteReq $req): GenericRsp; public function get(string $id, string $remoteAddr = '', string $userAgent = ''): UserGetRsp; + + /** + * @param array $filter + */ + public function list(string $remoteAddr = '', string $userAgent = '', string $sort = '', array $filter = [], int $page = 1, int $pageSize = 10): UserListRsp; } diff --git a/src/SDK.php b/src/SDK.php index a783393..505ad40 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -8,6 +8,8 @@ use Corbado\Classes\Apis\EmailLinksInterface; use Corbado\Classes\Apis\SMSCodes; use Corbado\Classes\Apis\SMSCodesInterface; +use Corbado\Classes\Apis\Users; +use Corbado\Classes\Apis\UsersInterface; use Corbado\Classes\Apis\Validations; use Corbado\Classes\Apis\ValidationsInterface; use Corbado\Classes\Assert; @@ -30,7 +32,7 @@ class SDK private ?EmailLinksInterface $emailLinks = null; private ?SMSCodesInterface $smsCodes = null; private ?ValidationsInterface $validations = null; - private ?UserApi $users = null; + private ?UsersInterface $users = null; private ?Session $session = null; private ?AuthTokensInterface $authTokens = null; @@ -120,14 +122,17 @@ public function validations(): ValidationsInterface /** * Returns users handling * - * @return UserApi + * @return UsersInterface + * @throws AssertException * @throws ConfigurationException */ - public function users(): UserApi + public function users(): UsersInterface { if ($this->users === null) { - // @phpstan-ignore-next-line - $this->users = new UserApi($this->client, $this->createGeneratedConfiguration()); + $this->users = new Users( + // @phpstan-ignore-next-line + new UserApi($this->client, $this->createGeneratedConfiguration()) + ); } return $this->users; diff --git a/tests/integration/User/UserListTest.php b/tests/integration/User/UserListTest.php new file mode 100644 index 0000000..bff4458 --- /dev/null +++ b/tests/integration/User/UserListTest.php @@ -0,0 +1,50 @@ +users()->list('', '', 'foo:bar'); + } catch (ServerException $e) { + $exception = $e; + } catch (\Throwable $e) { + $this->fail(Utils::createExceptionFailMessage($e)); + } + + $this->assertNull($rsp); + $this->assertNotNull($exception); + $this->assertEquals(422, $exception->getHttpStatusCode()); + $this->assertEquals('sort: Invalid order direction \'bar\'', $exception->getValidationMessage()); + } + + public function testUserListSuccess(): void + { + try { + $userID = Utils::createUser(); + + $rsp = Utils::SDK()->users()->list(); + + $found = false; + foreach ($rsp->getData()->getUsers() as $user) { + if ($user->getId() === $userID) { + $found = true; + break; + } + } + + $this->assertTrue($found); + } catch (\Throwable $e) { + $this->fail(Utils::createExceptionFailMessage($e)); + } + } +} diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index c4e46cf..5c5ecc3 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -4,7 +4,9 @@ use Corbado\Classes\Exceptions\AssertException; use Corbado\Classes\Exceptions\ConfigurationException; +use Corbado\Classes\Exceptions\ServerException; use Corbado\Configuration; +use Corbado\Generated\Model\UserCreateReq; use Corbado\SDK; use Exception; @@ -35,4 +37,53 @@ private static function getEnv(string $key): string return $value; } + + private static function generateString(int $length): string + { + // Removed I, 1, 0 and O because of risk of confusion + $characters = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijklmnopwrstuvwxyz23456789'; + $charactersLength = strlen($characters); + + $string = ''; + for ($i = 0; $i < $length; $i++) { + $string .= $characters[rand(0, $charactersLength - 1)]; + } + + return $string; + } + + private static function createRandomTestName(): string + { + return self::generateString(10); + } + + private static function createRandomTestEmail(): string + { + return self::generateString(10) . '@test.de'; + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public static function createUser(): string + { + $req = new UserCreateReq(); + $req->setName(self::createRandomTestName()); + $req->setEmail(self::createRandomTestEmail()); + + $rsp = self::SDK()->users()->create($req); + + return $rsp->getData()->getUserId(); + } + + public static function createExceptionFailMessage(\Throwable $e): string + { + if ($e instanceof ServerException) { + return 'Unexpected server exception: ' . $e->getMessage() . ' (' . $e->getValidationMessage() . ')'; + } + + return 'Unexpected exception: ' . $e->getMessage(); + } + } diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php index 910c558..2f5955e 100644 --- a/tests/integration/Validation/ValidateEmailTest.php +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -11,18 +11,21 @@ class ValidateEmailTest extends TestCase { public function testValidateEmailValidationError(): void { - $res = null; + $rsp = null; $exception = null; try { - $res = Utils::SDK()->validations()->validateEmail((new ValidateEmailReq())->setEmail('')); + $req = new ValidateEmailReq(); + $req->setEmail(''); + + $rsp = Utils::SDK()->validations()->validateEmail($req); } catch (ServerException $e) { $exception = $e; } catch (\Throwable $e) { - $this->fail('Unexpected exception: ' . $e->getMessage()); + $this->fail(Utils::createExceptionFailMessage($e)); } - $this->assertNull($res); + $this->assertNull($rsp); $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); $this->assertEquals('email: cannot be blank', $exception->getValidationMessage()); @@ -31,11 +34,14 @@ public function testValidateEmailValidationError(): void public function testValidateEmailSuccess(): void { try { - $res = Utils::SDK()->validations()->validateEmail((new ValidateEmailReq())->setEmail('info@corbado.com')); + $req = new ValidateEmailReq(); + $req->setEmail('info@corbado.com'); + + $rsp = Utils::SDK()->validations()->validateEmail($req); } catch (\Throwable $e) { - $this->fail('Unexpected exception: ' . $e->getMessage()); + $this->fail(Utils::createExceptionFailMessage($e)); } - $this->assertTrue($res->getData()->getIsValid()); + $this->assertTrue($rsp->getData()->getIsValid()); } } diff --git a/tests/integration/Validation/ValidatePhoneNumberTest.php b/tests/integration/Validation/ValidatePhoneNumberTest.php index 76027d7..25acbfc 100644 --- a/tests/integration/Validation/ValidatePhoneNumberTest.php +++ b/tests/integration/Validation/ValidatePhoneNumberTest.php @@ -12,18 +12,21 @@ class ValidatePhoneNumberTest extends TestCase { public function testValidatePhoneNumberValidationError(): void { - $res = null; + $rsp = null; $exception = null; try { - $res = Utils::SDK()->validations()->validatePhoneNumber((new ValidatePhoneNumberReq())->setPhoneNumber('')); + $req = new ValidatePhoneNumberReq(); + $req->setPhoneNumber(''); + + $rsp = Utils::SDK()->validations()->validatePhoneNumber($req); } catch (ServerException $e) { $exception = $e; } catch (\Throwable $e) { - $this->fail('Unexpected exception: ' . $e->getMessage()); + $this->fail(Utils::createExceptionFailMessage($e)); } - $this->assertNull($res); + $this->assertNull($rsp); $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); $this->assertEquals('phoneNumber: cannot be blank', $exception->getValidationMessage()); @@ -32,11 +35,14 @@ public function testValidatePhoneNumberValidationError(): void public function testValidatePhoneNumberSuccess(): void { try { - $res = Utils::SDK()->validations()->validatePhoneNumber((new ValidatePhoneNumberReq())->setPhoneNumber('+49 151 12345678')); + $req = new ValidatePhoneNumberReq(); + $req->setPhoneNumber('+49 151 12345678'); + + $rsp = Utils::SDK()->validations()->validatePhoneNumber($req); } catch (\Throwable $e) { - $this->fail('Unexpected exception: ' . $e->getMessage()); + $this->fail(Utils::createExceptionFailMessage($e)); } - $this->assertTrue($res->getData()->getIsValid()); + $this->assertTrue($rsp->getData()->getIsValid()); } } From f4e3ffeb32985e4aac10b2d7c3df5067bf7cb62d Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 13 Dec 2023 21:29:43 +0100 Subject: [PATCH 21/81] Added more integration tests, simplified integration tests --- src/Classes/Exceptions/ServerException.php | 10 +++- tests/integration/User/UserDeleteTest.php | 39 ++++++++++++++ tests/integration/User/UserGetTest.php | 38 ++++++++++++++ tests/integration/User/UserListTest.php | 51 +++++++++---------- tests/integration/Utils.php | 10 ---- .../Validation/ValidateEmailTest.php | 36 ++++++------- .../Validation/ValidatePhoneNumberTest.php | 37 ++++++-------- 7 files changed, 141 insertions(+), 80 deletions(-) create mode 100644 tests/integration/User/UserDeleteTest.php create mode 100644 tests/integration/User/UserGetTest.php diff --git a/src/Classes/Exceptions/ServerException.php b/src/Classes/Exceptions/ServerException.php index 86794c4..74b25e3 100644 --- a/src/Classes/Exceptions/ServerException.php +++ b/src/Classes/Exceptions/ServerException.php @@ -23,12 +23,14 @@ class ServerException extends \Exception */ public function __construct(int $httpStatusCode, string $message, array $requestData, float $runtime, array $error) { - parent::__construct($message, $httpStatusCode); - $this->httpStatusCode = $httpStatusCode; $this->requestData = $requestData; $this->runtime = $runtime; $this->error = $error; + + $message = $message . ' (HTTP status code: ' . $httpStatusCode . ', validation message: ' . $this->getValidationMessage() . ')'; + + parent::__construct($message, $httpStatusCode); } public function getHttpStatusCode(): int @@ -63,6 +65,10 @@ public function getValidationMessage(): string return ''; } + if (empty($this->error['validation'])) { + return ''; + } + $messages = []; foreach ($this->error['validation'] as $item) { $messages[] = $item['field'] . ': ' . $item['message']; diff --git a/tests/integration/User/UserDeleteTest.php b/tests/integration/User/UserDeleteTest.php new file mode 100644 index 0000000..6c214f3 --- /dev/null +++ b/tests/integration/User/UserDeleteTest.php @@ -0,0 +1,39 @@ +users()->delete('usr-123456789', new UserDeleteReq()); + } catch (ServerException $e) { + $this->assertEquals(400, $e->getHttpStatusCode()); + $this->assertEquals('userID: does not exist', $e->getValidationMessage()); + } + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testUserDeleteSuccess(): void + { + $userID = Utils::createUser(); + + $rsp = Utils::SDK()->users()->delete($userID, new UserDeleteReq()); + $this->assertEquals(200, $rsp->getHttpStatusCode()); + } +} diff --git a/tests/integration/User/UserGetTest.php b/tests/integration/User/UserGetTest.php new file mode 100644 index 0000000..82968be --- /dev/null +++ b/tests/integration/User/UserGetTest.php @@ -0,0 +1,38 @@ +users()->get('usr-123456789'); + } catch (ServerException $e) { + $this->assertEquals(404, $e->getHttpStatusCode()); + } + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testUserGetSuccess(): void + { + $userID = Utils::createUser(); + + $rsp = Utils::SDK()->users()->get($userID); + $this->assertEquals(200, $rsp->getHttpStatusCode()); + } +} diff --git a/tests/integration/User/UserListTest.php b/tests/integration/User/UserListTest.php index bff4458..6334f27 100644 --- a/tests/integration/User/UserListTest.php +++ b/tests/integration/User/UserListTest.php @@ -2,49 +2,46 @@ namespace integration\User; +use _PHPStan_f73a165d5\Nette\Neon\Exception; +use Corbado\Classes\Exceptions\AssertException; +use Corbado\Classes\Exceptions\ConfigurationException; use Corbado\Classes\Exceptions\ServerException; use integration\Utils; use PHPUnit\Framework\TestCase; class UserListTest extends TestCase { + /** + * @throws AssertException + * @throws ConfigurationException + */ public function testUserListValidationError(): void { - $rsp = null; - $exception = null; - try { - $rsp = Utils::SDK()->users()->list('', '', 'foo:bar'); + Utils::SDK()->users()->list('', '', 'foo:bar'); } catch (ServerException $e) { - $exception = $e; - } catch (\Throwable $e) { - $this->fail(Utils::createExceptionFailMessage($e)); + $this->assertEquals(422, $e->getHttpStatusCode()); + $this->assertEquals('sort: Invalid order direction \'bar\'', $e->getValidationMessage()); } - - $this->assertNull($rsp); - $this->assertNotNull($exception); - $this->assertEquals(422, $exception->getHttpStatusCode()); - $this->assertEquals('sort: Invalid order direction \'bar\'', $exception->getValidationMessage()); } + /** + * @throws AssertException + * @throws ConfigurationException + */ public function testUserListSuccess(): void { - try { - $userID = Utils::createUser(); - - $rsp = Utils::SDK()->users()->list(); - - $found = false; - foreach ($rsp->getData()->getUsers() as $user) { - if ($user->getId() === $userID) { - $found = true; - break; - } + $userID = Utils::createUser(); + $rsp = Utils::SDK()->users()->list('', '', 'created:desc'); + + $found = false; + foreach ($rsp->getData()->getUsers() as $user) { + if ($user->getId() === $userID) { + $found = true; + break; } - - $this->assertTrue($found); - } catch (\Throwable $e) { - $this->fail(Utils::createExceptionFailMessage($e)); } + + $this->assertTrue($found); } } diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index 5c5ecc3..dfd4fc8 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -76,14 +76,4 @@ public static function createUser(): string return $rsp->getData()->getUserId(); } - - public static function createExceptionFailMessage(\Throwable $e): string - { - if ($e instanceof ServerException) { - return 'Unexpected server exception: ' . $e->getMessage() . ' (' . $e->getValidationMessage() . ')'; - } - - return 'Unexpected exception: ' . $e->getMessage(); - } - } diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php index 2f5955e..aed1680 100644 --- a/tests/integration/Validation/ValidateEmailTest.php +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -2,6 +2,8 @@ namespace integration\Validation; +use Corbado\Classes\Exceptions\AssertException; +use Corbado\Classes\Exceptions\ConfigurationException; use Corbado\Classes\Exceptions\ServerException; use Corbado\Generated\Model\ValidateEmailReq; use integration\Utils; @@ -9,39 +11,33 @@ class ValidateEmailTest extends TestCase { + /** + * @throws AssertException + * @throws ConfigurationException + */ public function testValidateEmailValidationError(): void { - $rsp = null; - $exception = null; - try { $req = new ValidateEmailReq(); $req->setEmail(''); - $rsp = Utils::SDK()->validations()->validateEmail($req); + Utils::SDK()->validations()->validateEmail($req); } catch (ServerException $e) { - $exception = $e; - } catch (\Throwable $e) { - $this->fail(Utils::createExceptionFailMessage($e)); + $this->assertEquals(400, $e->getHttpStatusCode()); + $this->assertEquals('email: cannot be blank', $e->getValidationMessage()); } - - $this->assertNull($rsp); - $this->assertNotNull($exception); - $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals('email: cannot be blank', $exception->getValidationMessage()); } + /** + * @throws AssertException + * @throws ConfigurationException + */ public function testValidateEmailSuccess(): void { - try { - $req = new ValidateEmailReq(); - $req->setEmail('info@corbado.com'); - - $rsp = Utils::SDK()->validations()->validateEmail($req); - } catch (\Throwable $e) { - $this->fail(Utils::createExceptionFailMessage($e)); - } + $req = new ValidateEmailReq(); + $req->setEmail('info@corbado.com'); + $rsp = Utils::SDK()->validations()->validateEmail($req); $this->assertTrue($rsp->getData()->getIsValid()); } } diff --git a/tests/integration/Validation/ValidatePhoneNumberTest.php b/tests/integration/Validation/ValidatePhoneNumberTest.php index 25acbfc..7098837 100644 --- a/tests/integration/Validation/ValidatePhoneNumberTest.php +++ b/tests/integration/Validation/ValidatePhoneNumberTest.php @@ -2,47 +2,42 @@ namespace integration\Validation; +use Corbado\Classes\Exceptions\AssertException; +use Corbado\Classes\Exceptions\ConfigurationException; use Corbado\Classes\Exceptions\ServerException; -use Corbado\Generated\Model\ValidateEmailReq; use Corbado\Generated\Model\ValidatePhoneNumberReq; use integration\Utils; use PHPUnit\Framework\TestCase; class ValidatePhoneNumberTest extends TestCase { + /** + * @throws AssertException + * @throws ConfigurationException + */ public function testValidatePhoneNumberValidationError(): void { - $rsp = null; - $exception = null; - try { $req = new ValidatePhoneNumberReq(); $req->setPhoneNumber(''); - $rsp = Utils::SDK()->validations()->validatePhoneNumber($req); + Utils::SDK()->validations()->validatePhoneNumber($req); } catch (ServerException $e) { - $exception = $e; - } catch (\Throwable $e) { - $this->fail(Utils::createExceptionFailMessage($e)); + $this->assertEquals(400, $e->getHttpStatusCode()); + $this->assertEquals('phoneNumber: cannot be blank', $e->getValidationMessage()); } - - $this->assertNull($rsp); - $this->assertNotNull($exception); - $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals('phoneNumber: cannot be blank', $exception->getValidationMessage()); } + /** + * @throws AssertException + * @throws ConfigurationException + */ public function testValidatePhoneNumberSuccess(): void { - try { - $req = new ValidatePhoneNumberReq(); - $req->setPhoneNumber('+49 151 12345678'); - - $rsp = Utils::SDK()->validations()->validatePhoneNumber($req); - } catch (\Throwable $e) { - $this->fail(Utils::createExceptionFailMessage($e)); - } + $req = new ValidatePhoneNumberReq(); + $req->setPhoneNumber('+49 151 12345678'); + $rsp = Utils::SDK()->validations()->validatePhoneNumber($req); $this->assertTrue($rsp->getData()->getIsValid()); } } From 061f7171ef3c0496ee0ad29b48f71c61abde15d9 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Thu, 14 Dec 2023 06:35:30 +0100 Subject: [PATCH 22/81] Fixed integration tests, added integration test for user create --- tests/integration/User/UserCreateTest.php | 50 +++++++++++++++++++ tests/integration/User/UserDeleteTest.php | 9 +++- tests/integration/User/UserGetTest.php | 7 ++- tests/integration/User/UserListTest.php | 9 +++- tests/integration/Utils.php | 4 +- .../Validation/ValidateEmailTest.php | 9 +++- .../Validation/ValidatePhoneNumberTest.php | 9 +++- 7 files changed, 86 insertions(+), 11 deletions(-) create mode 100644 tests/integration/User/UserCreateTest.php diff --git a/tests/integration/User/UserCreateTest.php b/tests/integration/User/UserCreateTest.php new file mode 100644 index 0000000..ef14e30 --- /dev/null +++ b/tests/integration/User/UserCreateTest.php @@ -0,0 +1,50 @@ +setName(''); + $req->setEmail(''); + + Utils::SDK()->users()->create($req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEquals(400, $exception->getHttpStatusCode()); + $this->assertEquals('name: cannot be blank', $exception->getValidationMessage()); + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testUserCreateSuccess(): void + { + $req = new UserCreateReq(); + $req->setName(Utils::createRandomTestName()); + $req->setEmail(Utils::createRandomTestEmail()); + + $rsp = Utils::SDK()->users()->create($req); + $this->assertEquals(200, $rsp->getHttpStatusCode()); + } +} \ No newline at end of file diff --git a/tests/integration/User/UserDeleteTest.php b/tests/integration/User/UserDeleteTest.php index 6c214f3..d5cc836 100644 --- a/tests/integration/User/UserDeleteTest.php +++ b/tests/integration/User/UserDeleteTest.php @@ -17,12 +17,17 @@ class UserDeleteTest extends TestCase */ public function testUserDeleteNotFound(): void { + $exception = null; + try { Utils::SDK()->users()->delete('usr-123456789', new UserDeleteReq()); } catch (ServerException $e) { - $this->assertEquals(400, $e->getHttpStatusCode()); - $this->assertEquals('userID: does not exist', $e->getValidationMessage()); + $exception = $e; } + + $this->assertNotNull($exception); + $this->assertEquals(400, $exception->getHttpStatusCode()); + $this->assertEquals('userID: does not exist', $exception->getValidationMessage()); } /** diff --git a/tests/integration/User/UserGetTest.php b/tests/integration/User/UserGetTest.php index 82968be..7458a30 100644 --- a/tests/integration/User/UserGetTest.php +++ b/tests/integration/User/UserGetTest.php @@ -17,11 +17,16 @@ class UserGetTest extends TestCase */ public function testUserGetNotFound(): void { + $exception = null; + try { Utils::SDK()->users()->get('usr-123456789'); } catch (ServerException $e) { - $this->assertEquals(404, $e->getHttpStatusCode()); + $exception = $e; } + + $this->assertNotNull($exception); + $this->assertEquals(404, $exception->getHttpStatusCode()); } /** diff --git a/tests/integration/User/UserListTest.php b/tests/integration/User/UserListTest.php index 6334f27..be77d26 100644 --- a/tests/integration/User/UserListTest.php +++ b/tests/integration/User/UserListTest.php @@ -17,12 +17,17 @@ class UserListTest extends TestCase */ public function testUserListValidationError(): void { + $exception = null; + try { Utils::SDK()->users()->list('', '', 'foo:bar'); } catch (ServerException $e) { - $this->assertEquals(422, $e->getHttpStatusCode()); - $this->assertEquals('sort: Invalid order direction \'bar\'', $e->getValidationMessage()); + $exception = $e; } + + $this->assertNotNull($exception); + $this->assertEquals(422, $exception->getHttpStatusCode()); + $this->assertEquals('sort: Invalid order direction \'bar\'', $exception->getValidationMessage()); } /** diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index dfd4fc8..809ebda 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -52,12 +52,12 @@ private static function generateString(int $length): string return $string; } - private static function createRandomTestName(): string + public static function createRandomTestName(): string { return self::generateString(10); } - private static function createRandomTestEmail(): string + public static function createRandomTestEmail(): string { return self::generateString(10) . '@test.de'; } diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php index aed1680..25a2da2 100644 --- a/tests/integration/Validation/ValidateEmailTest.php +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -17,15 +17,20 @@ class ValidateEmailTest extends TestCase */ public function testValidateEmailValidationError(): void { + $exception = null; + try { $req = new ValidateEmailReq(); $req->setEmail(''); Utils::SDK()->validations()->validateEmail($req); } catch (ServerException $e) { - $this->assertEquals(400, $e->getHttpStatusCode()); - $this->assertEquals('email: cannot be blank', $e->getValidationMessage()); + $exception = $e; } + + $this->assertNotNull($exception); + $this->assertEquals(400, $exception->getHttpStatusCode()); + $this->assertEquals('email: cannot be blank', $exception->getValidationMessage()); } /** diff --git a/tests/integration/Validation/ValidatePhoneNumberTest.php b/tests/integration/Validation/ValidatePhoneNumberTest.php index 7098837..60ed0ef 100644 --- a/tests/integration/Validation/ValidatePhoneNumberTest.php +++ b/tests/integration/Validation/ValidatePhoneNumberTest.php @@ -17,15 +17,20 @@ class ValidatePhoneNumberTest extends TestCase */ public function testValidatePhoneNumberValidationError(): void { + $exception = null; + try { $req = new ValidatePhoneNumberReq(); $req->setPhoneNumber(''); Utils::SDK()->validations()->validatePhoneNumber($req); } catch (ServerException $e) { - $this->assertEquals(400, $e->getHttpStatusCode()); - $this->assertEquals('phoneNumber: cannot be blank', $e->getValidationMessage()); + $exception = $e; } + + $this->assertNotNull($e); + $this->assertEquals(400, $exception->getHttpStatusCode()); + $this->assertEquals('phoneNumber: cannot be blank', $exception->getValidationMessage()); } /** From bc32ed1da90b1023ac4b7850c82b3b555ee7d870 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 09:54:47 +0100 Subject: [PATCH 23/81] Added OpenAPI generation --- composer.json | 3 ++- scripts/generate-openapi.sh | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 scripts/generate-openapi.sh diff --git a/composer.json b/composer.json index 89c3083..cfa2fe2 100644 --- a/composer.json +++ b/composer.json @@ -31,6 +31,7 @@ "unittests": "vendor/bin/phpunit --colors=always --bootstrap vendor/autoload.php tests/unit", "integrationtests": "vendor/bin/phpunit --colors=always --bootstrap vendor/autoload.php tests/integration", "cs-check": "vendor/bin/php-cs-fixer check --diff --config=.php-cs-fixer.php", - "cs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php" + "cs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php", + "generate-openapi": "sh scripts/generate-openapi.sh" } } diff --git a/scripts/generate-openapi.sh b/scripts/generate-openapi.sh new file mode 100644 index 0000000..4a7f428 --- /dev/null +++ b/scripts/generate-openapi.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +echo "Generating OpenAPI code ..." + +cd "$(dirname "$0")" +rm -rf .gen +mkdir -p .gen +cd .gen + +curl -s -O https://api.corbado.com/docs/api/openapi/backend_api_public.yml +docker pull openapitools/openapi-generator-cli +docker run -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/backend_api_public.yml -g php -o /local --additional-properties=invokerPackage=Corbado\\Generated + +echo " done!" \ No newline at end of file From 9de8b6d5a2b0694518f1271b590b6224b9acbcc8 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 10:03:02 +0100 Subject: [PATCH 24/81] Generated OpenAPI code --- .gitignore | 2 + scripts/generate-openapi.sh | 2 + src/Generated/Api/APISecretsApi.php | 142 +- src/Generated/Api/AnalyzerApi.php | 1642 ++++++++++-- src/Generated/Api/AndroidAppConfigApi.php | 188 +- src/Generated/Api/AssociationTokensApi.php | 490 ++++ src/Generated/Api/AuthMethodsApi.php | 50 +- src/Generated/Api/AuthTokensApi.php | 50 +- src/Generated/Api/EmailMagicLinksApi.php | 188 +- src/Generated/Api/EmailOTPApi.php | 1197 +++++++++ src/Generated/Api/EmailTemplatesApi.php | 96 +- src/Generated/Api/ExamplesApi.php | 50 +- src/Generated/Api/IOSAppConfigApi.php | 188 +- src/Generated/Api/LongSessionsApi.php | 1243 +++++++++ src/Generated/Api/PasskeysBiometricsApi.php | 2258 +++++++++++++++-- src/Generated/Api/ProjectConfigApi.php | 491 +++- src/Generated/Api/RequestLogsApi.php | 108 +- src/Generated/Api/SMSOTPApi.php | 96 +- src/Generated/Api/SMSTemplatesApi.php | 96 +- src/Generated/Api/SessionConfigApi.php | 835 ++++++ src/Generated/Api/UserApi.php | 2026 +++++++++++++-- src/Generated/Api/ValidationApi.php | 96 +- src/Generated/Api/WebhookLogsApi.php | 62 +- src/Generated/ApiException.php | 2 +- src/Generated/Configuration.php | 10 +- src/Generated/HeaderSelector.php | 2 +- .../Model/AndroidAppConfigDeleteReq.php | 4 +- src/Generated/Model/AndroidAppConfigItem.php | 14 +- .../Model/AndroidAppConfigListRsp.php | 12 +- .../Model/AndroidAppConfigSaveReq.php | 8 +- .../Model/AndroidAppConfigSaveRsp.php | 22 +- .../Model/AndroidAppConfigUpdateReq.php | 8 +- .../Model/AndroidAppConfigUpdateRsp.php | 22 +- src/Generated/Model/AppType.php | 67 + .../Model/AssociationTokenCreateReq.php | 521 ++++ .../Model/AssociationTokenCreateRsp.php | 577 +++++ .../AssociationTokenCreateRspAllOfData.php | 444 ++++ src/Generated/Model/AuthMethod.php | 2 +- src/Generated/Model/AuthMethodsListReq.php | 6 +- src/Generated/Model/AuthMethodsListRsp.php | 10 +- .../Model/AuthMethodsListRspAllOfData.php | 6 +- src/Generated/Model/AuthTokenValidateReq.php | 6 +- src/Generated/Model/AuthTokenValidateRsp.php | 10 +- src/Generated/Model/ClientInfo.php | 4 +- src/Generated/Model/CustomLoginIdentifier.php | 558 ++++ src/Generated/Model/Email.php | 12 +- src/Generated/Model/EmailCode.php | 703 +++++ src/Generated/Model/EmailCodeGetRsp.php | 577 +++++ .../Model/EmailCodeGetRspAllOfData.php | 413 +++ src/Generated/Model/EmailCodeSendReq.php | 654 +++++ src/Generated/Model/EmailCodeSendRsp.php | 577 +++++ .../Model/EmailCodeSendRspAllOfData.php | 413 +++ src/Generated/Model/EmailCodeValidateReq.php | 515 ++++ src/Generated/Model/EmailCodeValidateRsp.php | 719 ++++++ src/Generated/Model/EmailLink.php | 20 +- src/Generated/Model/EmailLinkGetRsp.php | 10 +- .../Model/EmailLinkGetRspAllOfData.php | 2 +- src/Generated/Model/EmailLinkSendReq.php | 22 +- src/Generated/Model/EmailLinkSendRsp.php | 10 +- .../Model/EmailLinkSendRspAllOfData.php | 2 +- src/Generated/Model/EmailLinkValidateRsp.php | 20 +- src/Generated/Model/EmailLinksDeleteReq.php | 4 +- src/Generated/Model/EmailLinksValidateReq.php | 8 +- .../Model/EmailTemplateCreateReq.php | 109 +- .../Model/EmailTemplateCreateRsp.php | 10 +- .../Model/EmailTemplateCreateRspAllOfData.php | 2 +- .../Model/EmailTemplateDeleteReq.php | 4 +- src/Generated/Model/EmailValidationResult.php | 8 +- src/Generated/Model/EmptyReq.php | 444 ++++ src/Generated/Model/ErrorRsp.php | 44 +- src/Generated/Model/ErrorRspAllOfError.php | 8 +- .../Model/ErrorRspAllOfErrorValidation.php | 4 +- src/Generated/Model/ExampleGetRsp.php | 12 +- src/Generated/Model/FullUser.php | 16 +- src/Generated/Model/GenericRsp.php | 8 +- src/Generated/Model/IOSAppConfigDeleteReq.php | 4 +- src/Generated/Model/IOSAppConfigItem.php | 12 +- src/Generated/Model/IOSAppConfigListRsp.php | 12 +- src/Generated/Model/IOSAppConfigSaveReq.php | 8 +- src/Generated/Model/IOSAppConfigSaveRsp.php | 20 +- src/Generated/Model/IOSAppConfigUpdateReq.php | 8 +- src/Generated/Model/IOSAppConfigUpdateRsp.php | 20 +- src/Generated/Model/LoginIdentifierType.php | 67 + src/Generated/Model/LongSession.php | 28 +- src/Generated/Model/LongSessionGetRsp.php | 10 +- .../Model/LongSessionGetRspAllOfData.php | 2 +- src/Generated/Model/LongSessionListRsp.php | 10 +- .../Model/LongSessionListRspAllOfData.php | 4 +- src/Generated/Model/LongSessionRevokeReq.php | 4 +- src/Generated/Model/ModelInterface.php | 2 +- src/Generated/Model/Paging.php | 6 +- src/Generated/Model/PhoneNumber.php | 10 +- .../Model/PhoneNumberValidationResult.php | 6 +- src/Generated/Model/ProjectConfig.php | 943 ++++++- src/Generated/Model/ProjectConfigGetRsp.php | 10 +- src/Generated/Model/ProjectConfigSaveReq.php | 651 ++++- .../Model/ProjectConfigWebhookTestReq.php | 6 +- .../Model/ProjectConfigWebhookTestRsp.php | 10 +- .../ProjectConfigWebhookTestRspAllOfData.php | 6 +- .../Model/ProjectSecretCreateReq.php | 4 +- .../Model/ProjectSecretCreateRsp.php | 16 +- .../Model/ProjectSecretDeleteReq.php | 4 +- src/Generated/Model/ProjectSecretItem.php | 8 +- src/Generated/Model/ProjectSecretListRsp.php | 12 +- src/Generated/Model/RequestData.php | 4 +- src/Generated/Model/RequestLog.php | 104 +- src/Generated/Model/RequestLogGetRsp.php | 10 +- src/Generated/Model/RequestLogsListRsp.php | 10 +- .../Model/RequestLogsListRspAllOfData.php | 4 +- src/Generated/Model/SessionConfig.php | 131 +- src/Generated/Model/SessionConfigGetRsp.php | 10 +- .../Model/SessionConfigUpdateReq.php | 93 +- src/Generated/Model/SessionTokenCreateReq.php | 8 +- src/Generated/Model/SessionTokenCreateRsp.php | 10 +- .../Model/SessionTokenCreateRspAllOfData.php | 2 +- src/Generated/Model/SessionTokenVerifyReq.php | 6 +- src/Generated/Model/SessionTokenVerifyRsp.php | 10 +- .../Model/SessionTokenVerifyRspAllOfData.php | 6 +- src/Generated/Model/SmsCodeSendReq.php | 12 +- src/Generated/Model/SmsCodeSendRsp.php | 10 +- .../Model/SmsCodeSendRspAllOfData.php | 2 +- src/Generated/Model/SmsCodeValidateReq.php | 8 +- src/Generated/Model/SmsCodeValidateRsp.php | 10 +- src/Generated/Model/SmsTemplateCreateReq.php | 12 +- src/Generated/Model/SmsTemplateCreateRsp.php | 10 +- .../Model/SmsTemplateCreateRspAllOfData.php | 2 +- src/Generated/Model/SmsTemplateDeleteReq.php | 4 +- src/Generated/Model/Status.php | 2 +- src/Generated/Model/TrackingBackupState.php | 450 ++++ .../Model/TrackingBackupStateGetRsp.php | 577 +++++ .../Model/TrackingBrowserDetailedStats.php | 129 +- .../TrackingBrowserDetailedStatsListRsp.php | 10 +- ...ngBrowserDetailedStatsListRspAllOfData.php | 4 +- src/Generated/Model/TrackingBrowserStats.php | 12 +- .../Model/TrackingBrowserStatsListRsp.php | 10 +- .../TrackingBrowserStatsListRspAllOfData.php | 4 +- src/Generated/Model/TrackingDetailedStats.php | 561 ++++ .../Model/TrackingDetailedStatsListRsp.php | 577 +++++ .../TrackingDetailedStatsListRspAllOfData.php | 450 ++++ src/Generated/Model/TrackingEnums.php | 487 ++++ src/Generated/Model/TrackingEnumsGetRsp.php | 577 +++++ .../Model/TrackingOSDetailedStats.php | 202 +- .../Model/TrackingOSDetailedStatsListRsp.php | 10 +- ...rackingOSDetailedStatsListRspAllOfData.php | 4 +- src/Generated/Model/TrackingOSStats.php | 12 +- .../Model/TrackingOSStatsListRsp.php | 10 +- .../Model/TrackingOSStatsListRspAllOfData.php | 4 +- src/Generated/Model/TrackingRawListRow.php | 12 +- src/Generated/Model/TrackingRawListRsp.php | 12 +- src/Generated/Model/TrackingStats.php | 10 +- src/Generated/Model/TrackingStatsListRsp.php | 10 +- .../Model/TrackingStatsListRspAllOfData.php | 4 +- src/Generated/Model/User.php | 57 +- src/Generated/Model/UserAuthLog.php | 12 +- src/Generated/Model/UserAuthLogListRsp.php | 10 +- .../Model/UserAuthLogListRspAllOfData.php | 4 +- src/Generated/Model/UserCreateReq.php | 12 +- src/Generated/Model/UserCreateRsp.php | 10 +- .../Model/UserCreateRspAllOfData.php | 6 +- .../UserCustomLoginIdentifierCreateReq.php | 515 ++++ .../UserCustomLoginIdentifierCreateRsp.php | 577 +++++ ...ustomLoginIdentifierCreateRspAllOfData.php | 413 +++ .../UserCustomLoginIdentifierDeleteReq.php | 444 ++++ .../Model/UserCustomLoginIdentifierGetRsp.php | 577 +++++ ...erCustomLoginIdentifierGetRspAllOfData.php | 413 +++ src/Generated/Model/UserDeleteReq.php | 4 +- src/Generated/Model/UserDevice.php | 18 +- src/Generated/Model/UserDeviceListRsp.php | 12 +- src/Generated/Model/UserEmail.php | 10 +- src/Generated/Model/UserEmailCreateReq.php | 6 +- src/Generated/Model/UserEmailCreateRsp.php | 10 +- .../Model/UserEmailCreateRspAllOfData.php | 2 +- src/Generated/Model/UserEmailDeleteReq.php | 4 +- src/Generated/Model/UserEmailGetRsp.php | 10 +- .../Model/UserEmailGetRspAllOfData.php | 2 +- src/Generated/Model/UserGetRsp.php | 10 +- src/Generated/Model/UserListRsp.php | 10 +- src/Generated/Model/UserListRspAllOfData.php | 4 +- src/Generated/Model/UserPhoneNumber.php | 10 +- .../Model/UserPhoneNumberCreateReq.php | 6 +- .../Model/UserPhoneNumberCreateRsp.php | 10 +- .../UserPhoneNumberCreateRspAllOfData.php | 2 +- .../Model/UserPhoneNumberDeleteReq.php | 4 +- src/Generated/Model/UserPhoneNumberGetRsp.php | 10 +- .../Model/UserPhoneNumberGetRspAllOfData.php | 2 +- src/Generated/Model/UserStats.php | 18 +- src/Generated/Model/UserStatsListRsp.php | 10 +- .../Model/UserStatsListRspAllOfData.php | 4 +- src/Generated/Model/UserUpdateReq.php | 76 +- src/Generated/Model/UserUpdateRsp.php | 10 +- src/Generated/Model/ValidateEmailReq.php | 10 +- src/Generated/Model/ValidateEmailRsp.php | 10 +- .../Model/ValidatePhoneNumberReq.php | 8 +- .../Model/ValidatePhoneNumberRsp.php | 10 +- src/Generated/Model/ValidationEmail.php | 12 +- src/Generated/Model/ValidationPhoneNumber.php | 10 +- .../Model/WebAuthnAssociateStartReq.php | 481 ++++ .../Model/WebAuthnAssociateStartRsp.php | 648 +++++ .../Model/WebAuthnAuthenticateFinishRsp.php | 18 +- .../Model/WebAuthnAuthenticateStartReq.php | 45 +- .../Model/WebAuthnAuthenticateStartRsp.php | 12 +- .../Model/WebAuthnAuthenticateSuccess.php | 16 +- .../Model/WebAuthnAuthenticatorUpdateReq.php | 481 ++++ .../Model/WebAuthnCredentialExistsReq.php | 521 ++++ .../Model/WebAuthnCredentialExistsRsp.php | 577 +++++ .../Model/WebAuthnCredentialItemRsp.php | 495 +++- .../Model/WebAuthnCredentialListRsp.php | 12 +- src/Generated/Model/WebAuthnCredentialReq.php | 6 +- src/Generated/Model/WebAuthnCredentialRsp.php | 10 +- src/Generated/Model/WebAuthnFinishReq.php | 45 +- .../Model/WebAuthnMediationStartReq.php | 43 +- .../Model/WebAuthnMediationStartRsp.php | 10 +- .../Model/WebAuthnRegisterFinishRsp.php | 18 +- .../Model/WebAuthnRegisterStartReq.php | 49 +- .../Model/WebAuthnRegisterStartRsp.php | 12 +- src/Generated/Model/WebauthnSettingCreate.php | 4 +- .../Model/WebauthnSettingCreateReq.php | 8 +- .../Model/WebauthnSettingCreateRsp.php | 18 +- .../Model/WebauthnSettingDeleteReq.php | 4 +- src/Generated/Model/WebauthnSettingGetRsp.php | 18 +- src/Generated/Model/WebauthnSettingItem.php | 10 +- .../Model/WebauthnSettingListRsp.php | 12 +- .../Model/WebauthnSettingUpdateReq.php | 8 +- .../Model/WebauthnSettingUpdateRsp.php | 18 +- src/Generated/Model/WebhookLog.php | 24 +- src/Generated/Model/WebhookLogsListRsp.php | 10 +- .../Model/WebhookLogsListRspAllOfData.php | 4 +- src/Generated/ObjectSerializer.php | 2 +- 228 files changed, 30832 insertions(+), 1963 deletions(-) create mode 100644 src/Generated/Api/AssociationTokensApi.php create mode 100644 src/Generated/Api/EmailOTPApi.php create mode 100644 src/Generated/Api/LongSessionsApi.php create mode 100644 src/Generated/Api/SessionConfigApi.php create mode 100644 src/Generated/Model/AppType.php create mode 100644 src/Generated/Model/AssociationTokenCreateReq.php create mode 100644 src/Generated/Model/AssociationTokenCreateRsp.php create mode 100644 src/Generated/Model/AssociationTokenCreateRspAllOfData.php create mode 100644 src/Generated/Model/CustomLoginIdentifier.php create mode 100644 src/Generated/Model/EmailCode.php create mode 100644 src/Generated/Model/EmailCodeGetRsp.php create mode 100644 src/Generated/Model/EmailCodeGetRspAllOfData.php create mode 100644 src/Generated/Model/EmailCodeSendReq.php create mode 100644 src/Generated/Model/EmailCodeSendRsp.php create mode 100644 src/Generated/Model/EmailCodeSendRspAllOfData.php create mode 100644 src/Generated/Model/EmailCodeValidateReq.php create mode 100644 src/Generated/Model/EmailCodeValidateRsp.php create mode 100644 src/Generated/Model/EmptyReq.php create mode 100644 src/Generated/Model/LoginIdentifierType.php create mode 100644 src/Generated/Model/TrackingBackupState.php create mode 100644 src/Generated/Model/TrackingBackupStateGetRsp.php create mode 100644 src/Generated/Model/TrackingDetailedStats.php create mode 100644 src/Generated/Model/TrackingDetailedStatsListRsp.php create mode 100644 src/Generated/Model/TrackingDetailedStatsListRspAllOfData.php create mode 100644 src/Generated/Model/TrackingEnums.php create mode 100644 src/Generated/Model/TrackingEnumsGetRsp.php create mode 100644 src/Generated/Model/UserCustomLoginIdentifierCreateReq.php create mode 100644 src/Generated/Model/UserCustomLoginIdentifierCreateRsp.php create mode 100644 src/Generated/Model/UserCustomLoginIdentifierCreateRspAllOfData.php create mode 100644 src/Generated/Model/UserCustomLoginIdentifierDeleteReq.php create mode 100644 src/Generated/Model/UserCustomLoginIdentifierGetRsp.php create mode 100644 src/Generated/Model/UserCustomLoginIdentifierGetRspAllOfData.php create mode 100644 src/Generated/Model/WebAuthnAssociateStartReq.php create mode 100644 src/Generated/Model/WebAuthnAssociateStartRsp.php create mode 100644 src/Generated/Model/WebAuthnAuthenticatorUpdateReq.php create mode 100644 src/Generated/Model/WebAuthnCredentialExistsReq.php create mode 100644 src/Generated/Model/WebAuthnCredentialExistsRsp.php diff --git a/.gitignore b/.gitignore index fe8d8b4..5d97d12 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .idea/ vendor/ +scripts/.gen composer.lock .phpunit.result.cache .DS_Store +.php-cs-fixer.cache diff --git a/scripts/generate-openapi.sh b/scripts/generate-openapi.sh index 4a7f428..391fc84 100644 --- a/scripts/generate-openapi.sh +++ b/scripts/generate-openapi.sh @@ -11,4 +11,6 @@ curl -s -O https://api.corbado.com/docs/api/openapi/backend_api_public.yml docker pull openapitools/openapi-generator-cli docker run -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/backend_api_public.yml -g php -o /local --additional-properties=invokerPackage=Corbado\\Generated +cp -r lib/* ../../src/Generated + echo " done!" \ No newline at end of file diff --git a/src/Generated/Api/APISecretsApi.php b/src/Generated/Api/APISecretsApi.php index e936527..99a25b8 100644 --- a/src/Generated/Api/APISecretsApi.php +++ b/src/Generated/Api/APISecretsApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,7 +83,7 @@ class APISecretsApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -135,7 +135,7 @@ public function getConfig() * @param \Corbado\Generated\Model\ProjectSecretCreateReq $project_secret_create_req project_secret_create_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectSecretCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\ProjectSecretCreateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -151,7 +151,7 @@ public function projectSecretCreate($project_secret_create_req = null, string $c * @param \Corbado\Generated\Model\ProjectSecretCreateReq $project_secret_create_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectSecretCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\ProjectSecretCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -201,7 +201,19 @@ public function projectSecretCreateWithHttpInfo($project_secret_create_req = nul } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ProjectSecretCreateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -216,7 +228,19 @@ public function projectSecretCreateWithHttpInfo($project_secret_create_req = nul } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -233,7 +257,19 @@ public function projectSecretCreateWithHttpInfo($project_secret_create_req = nul } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -440,7 +476,7 @@ public function projectSecretCreateRequest($project_secret_create_req = null, st * @param \Corbado\Generated\Model\ProjectSecretDeleteReq $project_secret_delete_req project_secret_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectSecretDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -457,7 +493,7 @@ public function projectSecretDelete($secret_id, $project_secret_delete_req = nul * @param \Corbado\Generated\Model\ProjectSecretDeleteReq $project_secret_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectSecretDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -507,7 +543,19 @@ public function projectSecretDeleteWithHttpInfo($secret_id, $project_secret_dele } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -522,7 +570,19 @@ public function projectSecretDeleteWithHttpInfo($secret_id, $project_secret_dele } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -539,7 +599,19 @@ public function projectSecretDeleteWithHttpInfo($secret_id, $project_secret_dele } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -762,7 +834,7 @@ public function projectSecretDeleteRequest($secret_id, $project_secret_delete_re * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectSecretList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\ProjectSecretListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -777,7 +849,7 @@ public function projectSecretList(string $contentType = self::contentTypes['proj * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectSecretList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\ProjectSecretListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -827,7 +899,19 @@ public function projectSecretListWithHttpInfo(string $contentType = self::conten } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ProjectSecretListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -842,7 +926,19 @@ public function projectSecretListWithHttpInfo(string $contentType = self::conten } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -859,7 +955,19 @@ public function projectSecretListWithHttpInfo(string $contentType = self::conten } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/AnalyzerApi.php b/src/Generated/Api/AnalyzerApi.php index 1a0daff..4d16833 100644 --- a/src/Generated/Api/AnalyzerApi.php +++ b/src/Generated/Api/AnalyzerApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -75,12 +75,21 @@ class AnalyzerApi 'trackingAllRequest' => [ 'application/json', ], + 'trackingBackupStateGet' => [ + 'application/json', + ], 'trackingBrowserDetailedStatsList' => [ 'application/json', ], 'trackingBrowserStatsList' => [ 'application/json', ], + 'trackingDetailedStatsList' => [ + 'application/json', + ], + 'trackingEnumsGet' => [ + 'application/json', + ], 'trackingOSDetailedStatsList' => [ 'application/json', ], @@ -92,7 +101,7 @@ class AnalyzerApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -147,36 +156,1145 @@ public function getConfig() * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\TrackingRawListRsp + */ + public function trackingAllRequest($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + { + list($response) = $this->trackingAllRequestWithHttpInfo($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + return $response; + } + + /** + * Operation trackingAllRequestWithHttpInfo + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\TrackingRawListRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function trackingAllRequestWithHttpInfo($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + { + $request = $this->trackingAllRequestRequest($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\TrackingRawListRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\TrackingRawListRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingRawListRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\TrackingRawListRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\TrackingRawListRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation trackingAllRequestAsync + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function trackingAllRequestAsync($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + { + return $this->trackingAllRequestAsyncWithHttpInfo($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation trackingAllRequestAsyncWithHttpInfo + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function trackingAllRequestAsyncWithHttpInfo($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + { + $returnType = '\Corbado\Generated\Model\TrackingRawListRsp'; + $request = $this->trackingAllRequestRequest($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'trackingAllRequest' + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function trackingAllRequestRequest($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + { + + + + + + + + + $resourcePath = '/v1/tracking'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $remote_address, + 'remoteAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $user_agent, + 'userAgent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + 'filter[]', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'pageSize', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation trackingBackupStateGet + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBackupStateGet'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\TrackingBackupStateGetRsp + */ + public function trackingBackupStateGet($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingBackupStateGet'][0]) + { + list($response) = $this->trackingBackupStateGetWithHttpInfo($remote_address, $user_agent, $contentType); + return $response; + } + + /** + * Operation trackingBackupStateGetWithHttpInfo + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBackupStateGet'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\TrackingBackupStateGetRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function trackingBackupStateGetWithHttpInfo($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingBackupStateGet'][0]) + { + $request = $this->trackingBackupStateGetRequest($remote_address, $user_agent, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\TrackingBackupStateGetRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\TrackingBackupStateGetRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingBackupStateGetRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\TrackingBackupStateGetRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\TrackingBackupStateGetRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation trackingBackupStateGetAsync + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBackupStateGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function trackingBackupStateGetAsync($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingBackupStateGet'][0]) + { + return $this->trackingBackupStateGetAsyncWithHttpInfo($remote_address, $user_agent, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation trackingBackupStateGetAsyncWithHttpInfo + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBackupStateGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function trackingBackupStateGetAsyncWithHttpInfo($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingBackupStateGet'][0]) + { + $returnType = '\Corbado\Generated\Model\TrackingBackupStateGetRsp'; + $request = $this->trackingBackupStateGetRequest($remote_address, $user_agent, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'trackingBackupStateGet' + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBackupStateGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function trackingBackupStateGetRequest($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingBackupStateGet'][0]) + { + + + + + $resourcePath = '/v1/tracking/backupState'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $remote_address, + 'remoteAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $user_agent, + 'userAgent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation trackingBrowserDetailedStatsList + * + * @param string $granularity Data granularity (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp + */ + public function trackingBrowserDetailedStatsList($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + { + list($response) = $this->trackingBrowserDetailedStatsListWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + return $response; + } + + /** + * Operation trackingBrowserDetailedStatsListWithHttpInfo + * + * @param string $granularity Data granularity (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function trackingBrowserDetailedStatsListWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + { + $request = $this->trackingBrowserDetailedStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation trackingBrowserDetailedStatsListAsync + * + * @param string $granularity Data granularity (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function trackingBrowserDetailedStatsListAsync($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + { + return $this->trackingBrowserDetailedStatsListAsyncWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation trackingBrowserDetailedStatsListAsyncWithHttpInfo + * + * @param string $granularity Data granularity (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function trackingBrowserDetailedStatsListAsyncWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + { + $returnType = '\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp'; + $request = $this->trackingBrowserDetailedStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'trackingBrowserDetailedStatsList' + * + * @param string $granularity Data granularity (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function trackingBrowserDetailedStatsListRequest($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + { + + // verify the required parameter 'granularity' is set + if ($granularity === null || (is_array($granularity) && count($granularity) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $granularity when calling trackingBrowserDetailedStatsList' + ); + } + + + + + + + + + $resourcePath = '/v1/tracking/browser/stats/detailed'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $remote_address, + 'remoteAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $user_agent, + 'userAgent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + 'filter[]', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'pageSize', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $granularity, + 'granularity', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation trackingBrowserStatsList + * + * @param string $granularity Data granularity (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \Corbado\Generated\Model\TrackingRawListRsp + * @return \Corbado\Generated\Model\TrackingBrowserStatsListRsp */ - public function trackingAllRequest($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + public function trackingBrowserStatsList($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) { - list($response) = $this->trackingAllRequestWithHttpInfo($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + list($response) = $this->trackingBrowserStatsListWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); return $response; } /** - * Operation trackingAllRequestWithHttpInfo + * Operation trackingBrowserStatsListWithHttpInfo * + * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) * @param string $sort Field sorting (optional) * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \Corbado\Generated\Model\TrackingRawListRsp, HTTP status code, HTTP response headers (array of strings) + * @return array of \Corbado\Generated\Model\TrackingBrowserStatsListRsp, HTTP status code, HTTP response headers (array of strings) */ - public function trackingAllRequestWithHttpInfo($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + public function trackingBrowserStatsListWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) { - $request = $this->trackingAllRequestRequest($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + $request = $this->trackingBrowserStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); try { $options = $this->createHttpClientOption(); @@ -215,29 +1333,53 @@ public function trackingAllRequestWithHttpInfo($remote_address = null, $user_age switch($statusCode) { case 200: - if ('\Corbado\Generated\Model\TrackingRawListRsp' === '\SplFileObject') { + if ('\Corbado\Generated\Model\TrackingBrowserStatsListRsp' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Corbado\Generated\Model\TrackingRawListRsp' !== 'string') { - $content = json_decode($content); + if ('\Corbado\Generated\Model\TrackingBrowserStatsListRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } return [ - ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingRawListRsp', []), + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingBrowserStatsListRsp', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\Corbado\Generated\Model\TrackingRawListRsp'; + $returnType = '\Corbado\Generated\Model\TrackingBrowserStatsListRsp'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -252,7 +1394,7 @@ public function trackingAllRequestWithHttpInfo($remote_address = null, $user_age case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Corbado\Generated\Model\TrackingRawListRsp', + '\Corbado\Generated\Model\TrackingBrowserStatsListRsp', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -263,22 +1405,23 @@ public function trackingAllRequestWithHttpInfo($remote_address = null, $user_age } /** - * Operation trackingAllRequestAsync + * Operation trackingBrowserStatsListAsync * + * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) * @param string $sort Field sorting (optional) * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function trackingAllRequestAsync($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + public function trackingBrowserStatsListAsync($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) { - return $this->trackingAllRequestAsyncWithHttpInfo($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType) + return $this->trackingBrowserStatsListAsyncWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -287,23 +1430,24 @@ function ($response) { } /** - * Operation trackingAllRequestAsyncWithHttpInfo + * Operation trackingBrowserStatsListAsyncWithHttpInfo * + * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) * @param string $sort Field sorting (optional) * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function trackingAllRequestAsyncWithHttpInfo($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + public function trackingBrowserStatsListAsyncWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) { - $returnType = '\Corbado\Generated\Model\TrackingRawListRsp'; - $request = $this->trackingAllRequestRequest($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + $returnType = '\Corbado\Generated\Model\TrackingBrowserStatsListRsp'; + $request = $this->trackingBrowserStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -342,22 +1486,30 @@ function ($exception) { } /** - * Create request for operation 'trackingAllRequest' + * Create request for operation 'trackingBrowserStatsList' * + * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) * @param string $sort Field sorting (optional) * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingAllRequest'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function trackingAllRequestRequest($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingAllRequest'][0]) + public function trackingBrowserStatsListRequest($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) { + // verify the required parameter 'granularity' is set + if ($granularity === null || (is_array($granularity) && count($granularity) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $granularity when calling trackingBrowserStatsList' + ); + } + @@ -365,7 +1517,7 @@ public function trackingAllRequestRequest($remote_address = null, $user_agent = - $resourcePath = '/v1/tracking'; + $resourcePath = '/v1/tracking/browser/stats'; $formParams = []; $queryParams = []; $headerParams = []; @@ -395,8 +1547,8 @@ public function trackingAllRequestRequest($remote_address = null, $user_agent = $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -413,8 +1565,8 @@ public function trackingAllRequestRequest($remote_address = null, $user_agent = $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -422,10 +1574,19 @@ public function trackingAllRequestRequest($remote_address = null, $user_agent = $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $granularity, + 'granularity', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); @@ -497,7 +1658,7 @@ public function trackingAllRequestRequest($remote_address = null, $user_agent = } /** - * Operation trackingBrowserDetailedStatsList + * Operation trackingDetailedStatsList * * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) @@ -506,20 +1667,20 @@ public function trackingAllRequestRequest($remote_address = null, $user_agent = * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingDetailedStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp + * @return \Corbado\Generated\Model\TrackingDetailedStatsListRsp */ - public function trackingBrowserDetailedStatsList($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + public function trackingDetailedStatsList($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingDetailedStatsList'][0]) { - list($response) = $this->trackingBrowserDetailedStatsListWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + list($response) = $this->trackingDetailedStatsListWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); return $response; } /** - * Operation trackingBrowserDetailedStatsListWithHttpInfo + * Operation trackingDetailedStatsListWithHttpInfo * * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) @@ -528,15 +1689,15 @@ public function trackingBrowserDetailedStatsList($granularity, $remote_address = * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingDetailedStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp, HTTP status code, HTTP response headers (array of strings) + * @return array of \Corbado\Generated\Model\TrackingDetailedStatsListRsp, HTTP status code, HTTP response headers (array of strings) */ - public function trackingBrowserDetailedStatsListWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + public function trackingDetailedStatsListWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingDetailedStatsList'][0]) { - $request = $this->trackingBrowserDetailedStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + $request = $this->trackingDetailedStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); try { $options = $this->createHttpClientOption(); @@ -575,29 +1736,53 @@ public function trackingBrowserDetailedStatsListWithHttpInfo($granularity, $remo switch($statusCode) { case 200: - if ('\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp' === '\SplFileObject') { + if ('\Corbado\Generated\Model\TrackingDetailedStatsListRsp' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp' !== 'string') { - $content = json_decode($content); + if ('\Corbado\Generated\Model\TrackingDetailedStatsListRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } return [ - ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp', []), + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingDetailedStatsListRsp', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp'; + $returnType = '\Corbado\Generated\Model\TrackingDetailedStatsListRsp'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -612,7 +1797,7 @@ public function trackingBrowserDetailedStatsListWithHttpInfo($granularity, $remo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp', + '\Corbado\Generated\Model\TrackingDetailedStatsListRsp', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -623,7 +1808,7 @@ public function trackingBrowserDetailedStatsListWithHttpInfo($granularity, $remo } /** - * Operation trackingBrowserDetailedStatsListAsync + * Operation trackingDetailedStatsListAsync * * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) @@ -632,14 +1817,14 @@ public function trackingBrowserDetailedStatsListWithHttpInfo($granularity, $remo * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingDetailedStatsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function trackingBrowserDetailedStatsListAsync($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + public function trackingDetailedStatsListAsync($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingDetailedStatsList'][0]) { - return $this->trackingBrowserDetailedStatsListAsyncWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType) + return $this->trackingDetailedStatsListAsyncWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -648,7 +1833,7 @@ function ($response) { } /** - * Operation trackingBrowserDetailedStatsListAsyncWithHttpInfo + * Operation trackingDetailedStatsListAsyncWithHttpInfo * * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) @@ -657,15 +1842,15 @@ function ($response) { * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingDetailedStatsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function trackingBrowserDetailedStatsListAsyncWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + public function trackingDetailedStatsListAsyncWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingDetailedStatsList'][0]) { - $returnType = '\Corbado\Generated\Model\TrackingBrowserDetailedStatsListRsp'; - $request = $this->trackingBrowserDetailedStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + $returnType = '\Corbado\Generated\Model\TrackingDetailedStatsListRsp'; + $request = $this->trackingDetailedStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -704,7 +1889,7 @@ function ($exception) { } /** - * Create request for operation 'trackingBrowserDetailedStatsList' + * Create request for operation 'trackingDetailedStatsList' * * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) @@ -713,18 +1898,18 @@ function ($exception) { * @param string[] $filter Field filtering (optional) * @param int $page Page number (optional, default to 1) * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserDetailedStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingDetailedStatsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function trackingBrowserDetailedStatsListRequest($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserDetailedStatsList'][0]) + public function trackingDetailedStatsListRequest($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingDetailedStatsList'][0]) { // verify the required parameter 'granularity' is set if ($granularity === null || (is_array($granularity) && count($granularity) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $granularity when calling trackingBrowserDetailedStatsList' + 'Missing the required parameter $granularity when calling trackingDetailedStatsList' ); } @@ -735,7 +1920,7 @@ public function trackingBrowserDetailedStatsListRequest($granularity, $remote_ad - $resourcePath = '/v1/tracking/browser/stats/detailed'; + $resourcePath = '/v1/tracking/stats/detailed'; $formParams = []; $queryParams = []; $headerParams = []; @@ -765,8 +1950,8 @@ public function trackingBrowserDetailedStatsListRequest($granularity, $remote_ad $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -783,8 +1968,8 @@ public function trackingBrowserDetailedStatsListRequest($granularity, $remote_ad $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -792,8 +1977,8 @@ public function trackingBrowserDetailedStatsListRequest($granularity, $remote_ad $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -876,46 +2061,36 @@ public function trackingBrowserDetailedStatsListRequest($granularity, $remote_ad } /** - * Operation trackingBrowserStatsList + * Operation trackingEnumsGet * - * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) - * @param string $sort Field sorting (optional) - * @param string[] $filter Field filtering (optional) - * @param int $page Page number (optional, default to 1) - * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingEnumsGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \Corbado\Generated\Model\TrackingBrowserStatsListRsp + * @return \Corbado\Generated\Model\TrackingEnumsGetRsp */ - public function trackingBrowserStatsList($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) + public function trackingEnumsGet($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingEnumsGet'][0]) { - list($response) = $this->trackingBrowserStatsListWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + list($response) = $this->trackingEnumsGetWithHttpInfo($remote_address, $user_agent, $contentType); return $response; } /** - * Operation trackingBrowserStatsListWithHttpInfo + * Operation trackingEnumsGetWithHttpInfo * - * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) - * @param string $sort Field sorting (optional) - * @param string[] $filter Field filtering (optional) - * @param int $page Page number (optional, default to 1) - * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingEnumsGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \Corbado\Generated\Model\TrackingBrowserStatsListRsp, HTTP status code, HTTP response headers (array of strings) + * @return array of \Corbado\Generated\Model\TrackingEnumsGetRsp, HTTP status code, HTTP response headers (array of strings) */ - public function trackingBrowserStatsListWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) + public function trackingEnumsGetWithHttpInfo($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingEnumsGet'][0]) { - $request = $this->trackingBrowserStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + $request = $this->trackingEnumsGetRequest($remote_address, $user_agent, $contentType); try { $options = $this->createHttpClientOption(); @@ -954,29 +2129,53 @@ public function trackingBrowserStatsListWithHttpInfo($granularity, $remote_addre switch($statusCode) { case 200: - if ('\Corbado\Generated\Model\TrackingBrowserStatsListRsp' === '\SplFileObject') { + if ('\Corbado\Generated\Model\TrackingEnumsGetRsp' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Corbado\Generated\Model\TrackingBrowserStatsListRsp' !== 'string') { - $content = json_decode($content); + if ('\Corbado\Generated\Model\TrackingEnumsGetRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } return [ - ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingBrowserStatsListRsp', []), + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\TrackingEnumsGetRsp', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\Corbado\Generated\Model\TrackingBrowserStatsListRsp'; + $returnType = '\Corbado\Generated\Model\TrackingEnumsGetRsp'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -991,7 +2190,7 @@ public function trackingBrowserStatsListWithHttpInfo($granularity, $remote_addre case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Corbado\Generated\Model\TrackingBrowserStatsListRsp', + '\Corbado\Generated\Model\TrackingEnumsGetRsp', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1002,23 +2201,18 @@ public function trackingBrowserStatsListWithHttpInfo($granularity, $remote_addre } /** - * Operation trackingBrowserStatsListAsync + * Operation trackingEnumsGetAsync * - * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) - * @param string $sort Field sorting (optional) - * @param string[] $filter Field filtering (optional) - * @param int $page Page number (optional, default to 1) - * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingEnumsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function trackingBrowserStatsListAsync($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) + public function trackingEnumsGetAsync($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingEnumsGet'][0]) { - return $this->trackingBrowserStatsListAsyncWithHttpInfo($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType) + return $this->trackingEnumsGetAsyncWithHttpInfo($remote_address, $user_agent, $contentType) ->then( function ($response) { return $response[0]; @@ -1027,24 +2221,19 @@ function ($response) { } /** - * Operation trackingBrowserStatsListAsyncWithHttpInfo + * Operation trackingEnumsGetAsyncWithHttpInfo * - * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) - * @param string $sort Field sorting (optional) - * @param string[] $filter Field filtering (optional) - * @param int $page Page number (optional, default to 1) - * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingEnumsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function trackingBrowserStatsListAsyncWithHttpInfo($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) + public function trackingEnumsGetAsyncWithHttpInfo($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingEnumsGet'][0]) { - $returnType = '\Corbado\Generated\Model\TrackingBrowserStatsListRsp'; - $request = $this->trackingBrowserStatsListRequest($granularity, $remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + $returnType = '\Corbado\Generated\Model\TrackingEnumsGetRsp'; + $request = $this->trackingEnumsGetRequest($remote_address, $user_agent, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1083,38 +2272,22 @@ function ($exception) { } /** - * Create request for operation 'trackingBrowserStatsList' + * Create request for operation 'trackingEnumsGet' * - * @param string $granularity Data granularity (required) * @param string $remote_address Client's remote address (optional) * @param string $user_agent Client's user agent (optional) - * @param string $sort Field sorting (optional) - * @param string[] $filter Field filtering (optional) - * @param int $page Page number (optional, default to 1) - * @param int $page_size Number of items per page (optional, default to 10) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingBrowserStatsList'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingEnumsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function trackingBrowserStatsListRequest($granularity, $remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['trackingBrowserStatsList'][0]) + public function trackingEnumsGetRequest($remote_address = null, $user_agent = null, string $contentType = self::contentTypes['trackingEnumsGet'][0]) { - // verify the required parameter 'granularity' is set - if ($granularity === null || (is_array($granularity) && count($granularity) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $granularity when calling trackingBrowserStatsList' - ); - } - - - - - - $resourcePath = '/v1/tracking/browser/stats'; + $resourcePath = '/v1/tracking/enums'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1139,51 +2312,6 @@ public function trackingBrowserStatsListRequest($granularity, $remote_address = true, // explode false // required ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $sort, - 'sort', // param base name - 'string', // openApiType - '', // style - false, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $filter, - 'filter[]', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $page, - 'page', // param base name - 'integer', // openApiType - '', // style - false, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $page_size, - 'pageSize', // param base name - 'integer', // openApiType - '', // style - false, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $granularity, - 'granularity', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); @@ -1266,7 +2394,7 @@ public function trackingBrowserStatsListRequest($granularity, $remote_address = * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingOSDetailedStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\TrackingOSDetailedStatsListRsp */ @@ -1288,7 +2416,7 @@ public function trackingOSDetailedStatsList($granularity, $remote_address = null * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingOSDetailedStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\TrackingOSDetailedStatsListRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1338,7 +2466,19 @@ public function trackingOSDetailedStatsListWithHttpInfo($granularity, $remote_ad } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\TrackingOSDetailedStatsListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1355,7 +2495,19 @@ public function trackingOSDetailedStatsListWithHttpInfo($granularity, $remote_ad } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1523,8 +2675,8 @@ public function trackingOSDetailedStatsListRequest($granularity, $remote_address $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1541,8 +2693,8 @@ public function trackingOSDetailedStatsListRequest($granularity, $remote_address $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1550,8 +2702,8 @@ public function trackingOSDetailedStatsListRequest($granularity, $remote_address $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1645,7 +2797,7 @@ public function trackingOSDetailedStatsListRequest($granularity, $remote_address * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingOSStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\TrackingOSStatsListRsp */ @@ -1667,7 +2819,7 @@ public function trackingOSStatsList($granularity, $remote_address = null, $user_ * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingOSStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\TrackingOSStatsListRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1717,7 +2869,19 @@ public function trackingOSStatsListWithHttpInfo($granularity, $remote_address = } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\TrackingOSStatsListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1734,7 +2898,19 @@ public function trackingOSStatsListWithHttpInfo($granularity, $remote_address = } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1902,8 +3078,8 @@ public function trackingOSStatsListRequest($granularity, $remote_address = null, $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1920,8 +3096,8 @@ public function trackingOSStatsListRequest($granularity, $remote_address = null, $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1929,8 +3105,8 @@ public function trackingOSStatsListRequest($granularity, $remote_address = null, $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -2024,7 +3200,7 @@ public function trackingOSStatsListRequest($granularity, $remote_address = null, * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\TrackingStatsListRsp */ @@ -2046,7 +3222,7 @@ public function trackingStatsList($granularity, $remote_address = null, $user_ag * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackingStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\TrackingStatsListRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -2096,7 +3272,19 @@ public function trackingStatsListWithHttpInfo($granularity, $remote_address = nu } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\TrackingStatsListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2113,7 +3301,19 @@ public function trackingStatsListWithHttpInfo($granularity, $remote_address = nu } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2281,8 +3481,8 @@ public function trackingStatsListRequest($granularity, $remote_address = null, $ $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -2299,8 +3499,8 @@ public function trackingStatsListRequest($granularity, $remote_address = null, $ $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -2308,8 +3508,8 @@ public function trackingStatsListRequest($granularity, $remote_address = null, $ $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params diff --git a/src/Generated/Api/AndroidAppConfigApi.php b/src/Generated/Api/AndroidAppConfigApi.php index ecd8ddb..8e9a598 100644 --- a/src/Generated/Api/AndroidAppConfigApi.php +++ b/src/Generated/Api/AndroidAppConfigApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -86,7 +86,7 @@ class AndroidAppConfigApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -138,7 +138,7 @@ public function getConfig() * @param \Corbado\Generated\Model\AndroidAppConfigSaveReq $android_app_config_save_req android_app_config_save_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['androidAppConfigCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\AndroidAppConfigSaveRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -154,7 +154,7 @@ public function androidAppConfigCreate($android_app_config_save_req, string $con * @param \Corbado\Generated\Model\AndroidAppConfigSaveReq $android_app_config_save_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['androidAppConfigCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\AndroidAppConfigSaveRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -204,7 +204,19 @@ public function androidAppConfigCreateWithHttpInfo($android_app_config_save_req, } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\AndroidAppConfigSaveRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -219,7 +231,19 @@ public function androidAppConfigCreateWithHttpInfo($android_app_config_save_req, } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -236,7 +260,19 @@ public function androidAppConfigCreateWithHttpInfo($android_app_config_save_req, } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -449,7 +485,7 @@ public function androidAppConfigCreateRequest($android_app_config_save_req, stri * @param \Corbado\Generated\Model\AndroidAppConfigDeleteReq $android_app_config_delete_req android_app_config_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['androidAppConfigDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -466,7 +502,7 @@ public function androidAppConfigDelete($android_app_config_id, $android_app_conf * @param \Corbado\Generated\Model\AndroidAppConfigDeleteReq $android_app_config_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['androidAppConfigDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -516,7 +552,19 @@ public function androidAppConfigDeleteWithHttpInfo($android_app_config_id, $andr } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -531,7 +579,19 @@ public function androidAppConfigDeleteWithHttpInfo($android_app_config_id, $andr } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -548,7 +608,19 @@ public function androidAppConfigDeleteWithHttpInfo($android_app_config_id, $andr } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -771,7 +843,7 @@ public function androidAppConfigDeleteRequest($android_app_config_id, $android_a * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['androidAppConfigGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\AndroidAppConfigListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -786,7 +858,7 @@ public function androidAppConfigGet(string $contentType = self::contentTypes['an * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['androidAppConfigGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\AndroidAppConfigListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -836,7 +908,19 @@ public function androidAppConfigGetWithHttpInfo(string $contentType = self::cont } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\AndroidAppConfigListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -851,7 +935,19 @@ public function androidAppConfigGetWithHttpInfo(string $contentType = self::cont } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -868,7 +964,19 @@ public function androidAppConfigGetWithHttpInfo(string $contentType = self::cont } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1064,7 +1172,7 @@ public function androidAppConfigGetRequest(string $contentType = self::contentTy * @param \Corbado\Generated\Model\AndroidAppConfigUpdateReq $android_app_config_update_req android_app_config_update_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['androidAppConfigPut'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\AndroidAppConfigUpdateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -1081,7 +1189,7 @@ public function androidAppConfigPut($android_app_config_id, $android_app_config_ * @param \Corbado\Generated\Model\AndroidAppConfigUpdateReq $android_app_config_update_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['androidAppConfigPut'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\AndroidAppConfigUpdateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1131,7 +1239,19 @@ public function androidAppConfigPutWithHttpInfo($android_app_config_id, $android } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\AndroidAppConfigUpdateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1146,7 +1266,19 @@ public function androidAppConfigPutWithHttpInfo($android_app_config_id, $android } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1163,7 +1295,19 @@ public function androidAppConfigPutWithHttpInfo($android_app_config_id, $android } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/AssociationTokensApi.php b/src/Generated/Api/AssociationTokensApi.php new file mode 100644 index 0000000..301c223 --- /dev/null +++ b/src/Generated/Api/AssociationTokensApi.php @@ -0,0 +1,490 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Api; + +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use Corbado\Generated\ApiException; +use Corbado\Generated\Configuration; +use Corbado\Generated\HeaderSelector; +use Corbado\Generated\ObjectSerializer; + +/** + * AssociationTokensApi Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class AssociationTokensApi +{ + /** + * @var ClientInterface + */ + protected $client; + + /** + * @var Configuration + */ + protected $config; + + /** + * @var HeaderSelector + */ + protected $headerSelector; + + /** + * @var int Host index + */ + protected $hostIndex; + + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'associationTokenCreate' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation associationTokenCreate + * + * @param \Corbado\Generated\Model\AssociationTokenCreateReq $association_token_create_req association_token_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associationTokenCreate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\AssociationTokenCreateRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function associationTokenCreate($association_token_create_req, string $contentType = self::contentTypes['associationTokenCreate'][0]) + { + list($response) = $this->associationTokenCreateWithHttpInfo($association_token_create_req, $contentType); + return $response; + } + + /** + * Operation associationTokenCreateWithHttpInfo + * + * @param \Corbado\Generated\Model\AssociationTokenCreateReq $association_token_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associationTokenCreate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\AssociationTokenCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function associationTokenCreateWithHttpInfo($association_token_create_req, string $contentType = self::contentTypes['associationTokenCreate'][0]) + { + $request = $this->associationTokenCreateRequest($association_token_create_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\AssociationTokenCreateRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\AssociationTokenCreateRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\AssociationTokenCreateRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\AssociationTokenCreateRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\AssociationTokenCreateRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation associationTokenCreateAsync + * + * @param \Corbado\Generated\Model\AssociationTokenCreateReq $association_token_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associationTokenCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function associationTokenCreateAsync($association_token_create_req, string $contentType = self::contentTypes['associationTokenCreate'][0]) + { + return $this->associationTokenCreateAsyncWithHttpInfo($association_token_create_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation associationTokenCreateAsyncWithHttpInfo + * + * @param \Corbado\Generated\Model\AssociationTokenCreateReq $association_token_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associationTokenCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function associationTokenCreateAsyncWithHttpInfo($association_token_create_req, string $contentType = self::contentTypes['associationTokenCreate'][0]) + { + $returnType = '\Corbado\Generated\Model\AssociationTokenCreateRsp'; + $request = $this->associationTokenCreateRequest($association_token_create_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'associationTokenCreate' + * + * @param \Corbado\Generated\Model\AssociationTokenCreateReq $association_token_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associationTokenCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function associationTokenCreateRequest($association_token_create_req, string $contentType = self::contentTypes['associationTokenCreate'][0]) + { + + // verify the required parameter 'association_token_create_req' is set + if ($association_token_create_req === null || (is_array($association_token_create_req) && count($association_token_create_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $association_token_create_req when calling associationTokenCreate' + ); + } + + + $resourcePath = '/v1/associationTokens'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($association_token_create_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($association_token_create_req)); + } else { + $httpBody = $association_token_create_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Generated/Api/AuthMethodsApi.php b/src/Generated/Api/AuthMethodsApi.php index 480d92c..712edc8 100644 --- a/src/Generated/Api/AuthMethodsApi.php +++ b/src/Generated/Api/AuthMethodsApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -77,7 +77,7 @@ class AuthMethodsApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -129,7 +129,7 @@ public function getConfig() * @param \Corbado\Generated\Model\AuthMethodsListReq $auth_methods_list_req auth_methods_list_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authMethodsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\AuthMethodsListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -145,7 +145,7 @@ public function authMethodsList($auth_methods_list_req, string $contentType = se * @param \Corbado\Generated\Model\AuthMethodsListReq $auth_methods_list_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authMethodsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\AuthMethodsListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -195,7 +195,19 @@ public function authMethodsListWithHttpInfo($auth_methods_list_req, string $cont } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\AuthMethodsListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -210,7 +222,19 @@ public function authMethodsListWithHttpInfo($auth_methods_list_req, string $cont } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -227,7 +251,19 @@ public function authMethodsListWithHttpInfo($auth_methods_list_req, string $cont } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/AuthTokensApi.php b/src/Generated/Api/AuthTokensApi.php index 27f865d..68d49bf 100644 --- a/src/Generated/Api/AuthTokensApi.php +++ b/src/Generated/Api/AuthTokensApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -77,7 +77,7 @@ class AuthTokensApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -129,7 +129,7 @@ public function getConfig() * @param \Corbado\Generated\Model\AuthTokenValidateReq $auth_token_validate_req auth_token_validate_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authTokenValidate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\AuthTokenValidateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -145,7 +145,7 @@ public function authTokenValidate($auth_token_validate_req, string $contentType * @param \Corbado\Generated\Model\AuthTokenValidateReq $auth_token_validate_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authTokenValidate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\AuthTokenValidateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -195,7 +195,19 @@ public function authTokenValidateWithHttpInfo($auth_token_validate_req, string $ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\AuthTokenValidateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -210,7 +222,19 @@ public function authTokenValidateWithHttpInfo($auth_token_validate_req, string $ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -227,7 +251,19 @@ public function authTokenValidateWithHttpInfo($auth_token_validate_req, string $ } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/EmailMagicLinksApi.php b/src/Generated/Api/EmailMagicLinksApi.php index 8707193..a5841e0 100644 --- a/src/Generated/Api/EmailMagicLinksApi.php +++ b/src/Generated/Api/EmailMagicLinksApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -86,7 +86,7 @@ class EmailMagicLinksApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -139,7 +139,7 @@ public function getConfig() * @param \Corbado\Generated\Model\EmailLinksDeleteReq $email_links_delete_req email_links_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailLinkDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\EmailLinkValidateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -156,7 +156,7 @@ public function emailLinkDelete($email_link_id, $email_links_delete_req = null, * @param \Corbado\Generated\Model\EmailLinksDeleteReq $email_links_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailLinkDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\EmailLinkValidateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -206,7 +206,19 @@ public function emailLinkDeleteWithHttpInfo($email_link_id, $email_links_delete_ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\EmailLinkValidateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -221,7 +233,19 @@ public function emailLinkDeleteWithHttpInfo($email_link_id, $email_links_delete_ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -238,7 +262,19 @@ public function emailLinkDeleteWithHttpInfo($email_link_id, $email_links_delete_ } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -458,7 +494,7 @@ public function emailLinkDeleteRequest($email_link_id, $email_links_delete_req = * @param string $email_link_id ID of email magic link (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailLinkGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\EmailLinkGetRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -474,7 +510,7 @@ public function emailLinkGet($email_link_id, string $contentType = self::content * @param string $email_link_id ID of email magic link (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailLinkGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\EmailLinkGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -524,7 +560,19 @@ public function emailLinkGetWithHttpInfo($email_link_id, string $contentType = s } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\EmailLinkGetRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -539,7 +587,19 @@ public function emailLinkGetWithHttpInfo($email_link_id, string $contentType = s } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -556,7 +616,19 @@ public function emailLinkGetWithHttpInfo($email_link_id, string $contentType = s } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -765,7 +837,7 @@ public function emailLinkGetRequest($email_link_id, string $contentType = self:: * @param \Corbado\Generated\Model\EmailLinkSendReq $email_link_send_req email_link_send_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailLinkSend'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\EmailLinkSendRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -781,7 +853,7 @@ public function emailLinkSend($email_link_send_req, string $contentType = self:: * @param \Corbado\Generated\Model\EmailLinkSendReq $email_link_send_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailLinkSend'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\EmailLinkSendRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -831,7 +903,19 @@ public function emailLinkSendWithHttpInfo($email_link_send_req, string $contentT } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\EmailLinkSendRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -846,7 +930,19 @@ public function emailLinkSendWithHttpInfo($email_link_send_req, string $contentT } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -863,7 +959,19 @@ public function emailLinkSendWithHttpInfo($email_link_send_req, string $contentT } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1072,7 +1180,7 @@ public function emailLinkSendRequest($email_link_send_req, string $contentType = * @param \Corbado\Generated\Model\EmailLinksValidateReq $email_links_validate_req email_links_validate_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailLinkValidate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\EmailLinkValidateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -1089,7 +1197,7 @@ public function emailLinkValidate($email_link_id, $email_links_validate_req, str * @param \Corbado\Generated\Model\EmailLinksValidateReq $email_links_validate_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailLinkValidate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\EmailLinkValidateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1139,7 +1247,19 @@ public function emailLinkValidateWithHttpInfo($email_link_id, $email_links_valid } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\EmailLinkValidateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1154,7 +1274,19 @@ public function emailLinkValidateWithHttpInfo($email_link_id, $email_links_valid } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1171,7 +1303,19 @@ public function emailLinkValidateWithHttpInfo($email_link_id, $email_links_valid } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/EmailOTPApi.php b/src/Generated/Api/EmailOTPApi.php new file mode 100644 index 0000000..4a196fa --- /dev/null +++ b/src/Generated/Api/EmailOTPApi.php @@ -0,0 +1,1197 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Api; + +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use Corbado\Generated\ApiException; +use Corbado\Generated\Configuration; +use Corbado\Generated\HeaderSelector; +use Corbado\Generated\ObjectSerializer; + +/** + * EmailOTPApi Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class EmailOTPApi +{ + /** + * @var ClientInterface + */ + protected $client; + + /** + * @var Configuration + */ + protected $config; + + /** + * @var HeaderSelector + */ + protected $headerSelector; + + /** + * @var int Host index + */ + protected $hostIndex; + + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'emailCodeGet' => [ + 'application/json', + ], + 'emailCodeSend' => [ + 'application/json', + ], + 'emailCodeValidate' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation emailCodeGet + * + * @param string $email_code_id ID of email OTP (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeGet'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\EmailCodeGetRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function emailCodeGet($email_code_id, string $contentType = self::contentTypes['emailCodeGet'][0]) + { + list($response) = $this->emailCodeGetWithHttpInfo($email_code_id, $contentType); + return $response; + } + + /** + * Operation emailCodeGetWithHttpInfo + * + * @param string $email_code_id ID of email OTP (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeGet'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\EmailCodeGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function emailCodeGetWithHttpInfo($email_code_id, string $contentType = self::contentTypes['emailCodeGet'][0]) + { + $request = $this->emailCodeGetRequest($email_code_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\EmailCodeGetRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\EmailCodeGetRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\EmailCodeGetRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\EmailCodeGetRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\EmailCodeGetRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation emailCodeGetAsync + * + * @param string $email_code_id ID of email OTP (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function emailCodeGetAsync($email_code_id, string $contentType = self::contentTypes['emailCodeGet'][0]) + { + return $this->emailCodeGetAsyncWithHttpInfo($email_code_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation emailCodeGetAsyncWithHttpInfo + * + * @param string $email_code_id ID of email OTP (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function emailCodeGetAsyncWithHttpInfo($email_code_id, string $contentType = self::contentTypes['emailCodeGet'][0]) + { + $returnType = '\Corbado\Generated\Model\EmailCodeGetRsp'; + $request = $this->emailCodeGetRequest($email_code_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'emailCodeGet' + * + * @param string $email_code_id ID of email OTP (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function emailCodeGetRequest($email_code_id, string $contentType = self::contentTypes['emailCodeGet'][0]) + { + + // verify the required parameter 'email_code_id' is set + if ($email_code_id === null || (is_array($email_code_id) && count($email_code_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_code_id when calling emailCodeGet' + ); + } + + + $resourcePath = '/v1/emailCodes/{emailCodeID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_code_id !== null) { + $resourcePath = str_replace( + '{' . 'emailCodeID' . '}', + ObjectSerializer::toPathValue($email_code_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation emailCodeSend + * + * @param \Corbado\Generated\Model\EmailCodeSendReq $email_code_send_req email_code_send_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeSend'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\EmailCodeSendRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function emailCodeSend($email_code_send_req, string $contentType = self::contentTypes['emailCodeSend'][0]) + { + list($response) = $this->emailCodeSendWithHttpInfo($email_code_send_req, $contentType); + return $response; + } + + /** + * Operation emailCodeSendWithHttpInfo + * + * @param \Corbado\Generated\Model\EmailCodeSendReq $email_code_send_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeSend'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\EmailCodeSendRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function emailCodeSendWithHttpInfo($email_code_send_req, string $contentType = self::contentTypes['emailCodeSend'][0]) + { + $request = $this->emailCodeSendRequest($email_code_send_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\EmailCodeSendRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\EmailCodeSendRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\EmailCodeSendRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\EmailCodeSendRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\EmailCodeSendRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation emailCodeSendAsync + * + * @param \Corbado\Generated\Model\EmailCodeSendReq $email_code_send_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeSend'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function emailCodeSendAsync($email_code_send_req, string $contentType = self::contentTypes['emailCodeSend'][0]) + { + return $this->emailCodeSendAsyncWithHttpInfo($email_code_send_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation emailCodeSendAsyncWithHttpInfo + * + * @param \Corbado\Generated\Model\EmailCodeSendReq $email_code_send_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeSend'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function emailCodeSendAsyncWithHttpInfo($email_code_send_req, string $contentType = self::contentTypes['emailCodeSend'][0]) + { + $returnType = '\Corbado\Generated\Model\EmailCodeSendRsp'; + $request = $this->emailCodeSendRequest($email_code_send_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'emailCodeSend' + * + * @param \Corbado\Generated\Model\EmailCodeSendReq $email_code_send_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeSend'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function emailCodeSendRequest($email_code_send_req, string $contentType = self::contentTypes['emailCodeSend'][0]) + { + + // verify the required parameter 'email_code_send_req' is set + if ($email_code_send_req === null || (is_array($email_code_send_req) && count($email_code_send_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_code_send_req when calling emailCodeSend' + ); + } + + + $resourcePath = '/v1/emailCodes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($email_code_send_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($email_code_send_req)); + } else { + $httpBody = $email_code_send_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation emailCodeValidate + * + * @param string $email_code_id ID of email OTP (required) + * @param \Corbado\Generated\Model\EmailCodeValidateReq $email_code_validate_req email_code_validate_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeValidate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\EmailCodeValidateRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function emailCodeValidate($email_code_id, $email_code_validate_req, string $contentType = self::contentTypes['emailCodeValidate'][0]) + { + list($response) = $this->emailCodeValidateWithHttpInfo($email_code_id, $email_code_validate_req, $contentType); + return $response; + } + + /** + * Operation emailCodeValidateWithHttpInfo + * + * @param string $email_code_id ID of email OTP (required) + * @param \Corbado\Generated\Model\EmailCodeValidateReq $email_code_validate_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeValidate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\EmailCodeValidateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function emailCodeValidateWithHttpInfo($email_code_id, $email_code_validate_req, string $contentType = self::contentTypes['emailCodeValidate'][0]) + { + $request = $this->emailCodeValidateRequest($email_code_id, $email_code_validate_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\EmailCodeValidateRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\EmailCodeValidateRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\EmailCodeValidateRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\EmailCodeValidateRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\EmailCodeValidateRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation emailCodeValidateAsync + * + * @param string $email_code_id ID of email OTP (required) + * @param \Corbado\Generated\Model\EmailCodeValidateReq $email_code_validate_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeValidate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function emailCodeValidateAsync($email_code_id, $email_code_validate_req, string $contentType = self::contentTypes['emailCodeValidate'][0]) + { + return $this->emailCodeValidateAsyncWithHttpInfo($email_code_id, $email_code_validate_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation emailCodeValidateAsyncWithHttpInfo + * + * @param string $email_code_id ID of email OTP (required) + * @param \Corbado\Generated\Model\EmailCodeValidateReq $email_code_validate_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeValidate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function emailCodeValidateAsyncWithHttpInfo($email_code_id, $email_code_validate_req, string $contentType = self::contentTypes['emailCodeValidate'][0]) + { + $returnType = '\Corbado\Generated\Model\EmailCodeValidateRsp'; + $request = $this->emailCodeValidateRequest($email_code_id, $email_code_validate_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'emailCodeValidate' + * + * @param string $email_code_id ID of email OTP (required) + * @param \Corbado\Generated\Model\EmailCodeValidateReq $email_code_validate_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailCodeValidate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function emailCodeValidateRequest($email_code_id, $email_code_validate_req, string $contentType = self::contentTypes['emailCodeValidate'][0]) + { + + // verify the required parameter 'email_code_id' is set + if ($email_code_id === null || (is_array($email_code_id) && count($email_code_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_code_id when calling emailCodeValidate' + ); + } + + // verify the required parameter 'email_code_validate_req' is set + if ($email_code_validate_req === null || (is_array($email_code_validate_req) && count($email_code_validate_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_code_validate_req when calling emailCodeValidate' + ); + } + + + $resourcePath = '/v1/emailCodes/{emailCodeID}/validate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_code_id !== null) { + $resourcePath = str_replace( + '{' . 'emailCodeID' . '}', + ObjectSerializer::toPathValue($email_code_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($email_code_validate_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($email_code_validate_req)); + } else { + $httpBody = $email_code_validate_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Generated/Api/EmailTemplatesApi.php b/src/Generated/Api/EmailTemplatesApi.php index 998a94c..2a1f1ef 100644 --- a/src/Generated/Api/EmailTemplatesApi.php +++ b/src/Generated/Api/EmailTemplatesApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -80,7 +80,7 @@ class EmailTemplatesApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -132,7 +132,7 @@ public function getConfig() * @param \Corbado\Generated\Model\EmailTemplateCreateReq $email_template_create_req email_template_create_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailTemplateCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\EmailTemplateCreateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -148,7 +148,7 @@ public function emailTemplateCreate($email_template_create_req, string $contentT * @param \Corbado\Generated\Model\EmailTemplateCreateReq $email_template_create_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailTemplateCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\EmailTemplateCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -198,7 +198,19 @@ public function emailTemplateCreateWithHttpInfo($email_template_create_req, stri } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\EmailTemplateCreateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -213,7 +225,19 @@ public function emailTemplateCreateWithHttpInfo($email_template_create_req, stri } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -230,7 +254,19 @@ public function emailTemplateCreateWithHttpInfo($email_template_create_req, stri } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -435,7 +471,7 @@ public function emailTemplateCreateRequest($email_template_create_req, string $c * @param \Corbado\Generated\Model\EmailTemplateDeleteReq $email_template_delete_req email_template_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailTemplateDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -452,7 +488,7 @@ public function emailTemplateDelete($email_template_id, $email_template_delete_r * @param \Corbado\Generated\Model\EmailTemplateDeleteReq $email_template_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emailTemplateDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -502,7 +538,19 @@ public function emailTemplateDeleteWithHttpInfo($email_template_id, $email_templ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -517,7 +565,19 @@ public function emailTemplateDeleteWithHttpInfo($email_template_id, $email_templ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -534,7 +594,19 @@ public function emailTemplateDeleteWithHttpInfo($email_template_id, $email_templ } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/ExamplesApi.php b/src/Generated/Api/ExamplesApi.php index a8ac333..0e6e4c1 100644 --- a/src/Generated/Api/ExamplesApi.php +++ b/src/Generated/Api/ExamplesApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -77,7 +77,7 @@ class ExamplesApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -129,7 +129,7 @@ public function getConfig() * @param string $file_name Name of the example to get (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exampleGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\ExampleGetRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -145,7 +145,7 @@ public function exampleGet($file_name, string $contentType = self::contentTypes[ * @param string $file_name Name of the example to get (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exampleGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\ExampleGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -195,7 +195,19 @@ public function exampleGetWithHttpInfo($file_name, string $contentType = self::c } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ExampleGetRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -210,7 +222,19 @@ public function exampleGetWithHttpInfo($file_name, string $contentType = self::c } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -227,7 +251,19 @@ public function exampleGetWithHttpInfo($file_name, string $contentType = self::c } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/IOSAppConfigApi.php b/src/Generated/Api/IOSAppConfigApi.php index f2e1a38..7f52c52 100644 --- a/src/Generated/Api/IOSAppConfigApi.php +++ b/src/Generated/Api/IOSAppConfigApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -86,7 +86,7 @@ class IOSAppConfigApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -138,7 +138,7 @@ public function getConfig() * @param \Corbado\Generated\Model\IOSAppConfigSaveReq $ios_app_config_save_req ios_app_config_save_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['iOSAppConfigCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\IOSAppConfigSaveRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -154,7 +154,7 @@ public function iOSAppConfigCreate($ios_app_config_save_req, string $contentType * @param \Corbado\Generated\Model\IOSAppConfigSaveReq $ios_app_config_save_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['iOSAppConfigCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\IOSAppConfigSaveRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -204,7 +204,19 @@ public function iOSAppConfigCreateWithHttpInfo($ios_app_config_save_req, string } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\IOSAppConfigSaveRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -219,7 +231,19 @@ public function iOSAppConfigCreateWithHttpInfo($ios_app_config_save_req, string } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -236,7 +260,19 @@ public function iOSAppConfigCreateWithHttpInfo($ios_app_config_save_req, string } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -449,7 +485,7 @@ public function iOSAppConfigCreateRequest($ios_app_config_save_req, string $cont * @param \Corbado\Generated\Model\IOSAppConfigDeleteReq $ios_app_config_delete_req ios_app_config_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['iOSAppConfigDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -466,7 +502,7 @@ public function iOSAppConfigDelete($ios_app_config_id, $ios_app_config_delete_re * @param \Corbado\Generated\Model\IOSAppConfigDeleteReq $ios_app_config_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['iOSAppConfigDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -516,7 +552,19 @@ public function iOSAppConfigDeleteWithHttpInfo($ios_app_config_id, $ios_app_conf } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -531,7 +579,19 @@ public function iOSAppConfigDeleteWithHttpInfo($ios_app_config_id, $ios_app_conf } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -548,7 +608,19 @@ public function iOSAppConfigDeleteWithHttpInfo($ios_app_config_id, $ios_app_conf } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -771,7 +843,7 @@ public function iOSAppConfigDeleteRequest($ios_app_config_id, $ios_app_config_de * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['iOSAppConfigGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\IOSAppConfigListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -786,7 +858,7 @@ public function iOSAppConfigGet(string $contentType = self::contentTypes['iOSApp * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['iOSAppConfigGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\IOSAppConfigListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -836,7 +908,19 @@ public function iOSAppConfigGetWithHttpInfo(string $contentType = self::contentT } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\IOSAppConfigListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -851,7 +935,19 @@ public function iOSAppConfigGetWithHttpInfo(string $contentType = self::contentT } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -868,7 +964,19 @@ public function iOSAppConfigGetWithHttpInfo(string $contentType = self::contentT } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1064,7 +1172,7 @@ public function iOSAppConfigGetRequest(string $contentType = self::contentTypes[ * @param \Corbado\Generated\Model\IOSAppConfigUpdateReq $ios_app_config_update_req ios_app_config_update_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['iOSAppConfigPut'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\IOSAppConfigUpdateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -1081,7 +1189,7 @@ public function iOSAppConfigPut($ios_app_config_id, $ios_app_config_update_req = * @param \Corbado\Generated\Model\IOSAppConfigUpdateReq $ios_app_config_update_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['iOSAppConfigPut'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\IOSAppConfigUpdateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1131,7 +1239,19 @@ public function iOSAppConfigPutWithHttpInfo($ios_app_config_id, $ios_app_config_ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\IOSAppConfigUpdateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1146,7 +1266,19 @@ public function iOSAppConfigPutWithHttpInfo($ios_app_config_id, $ios_app_config_ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1163,7 +1295,19 @@ public function iOSAppConfigPutWithHttpInfo($ios_app_config_id, $ios_app_config_ } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/LongSessionsApi.php b/src/Generated/Api/LongSessionsApi.php new file mode 100644 index 0000000..37f9f3e --- /dev/null +++ b/src/Generated/Api/LongSessionsApi.php @@ -0,0 +1,1243 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Api; + +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use Corbado\Generated\ApiException; +use Corbado\Generated\Configuration; +use Corbado\Generated\HeaderSelector; +use Corbado\Generated\ObjectSerializer; + +/** + * LongSessionsApi Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class LongSessionsApi +{ + /** + * @var ClientInterface + */ + protected $client; + + /** + * @var Configuration + */ + protected $config; + + /** + * @var HeaderSelector + */ + protected $headerSelector; + + /** + * @var int Host index + */ + protected $hostIndex; + + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'longSessionGet' => [ + 'application/json', + ], + 'longSessionList' => [ + 'application/json', + ], + 'longSessionRevoke' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation longSessionGet + * + * @param string $session_id ID of session (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionGet'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\LongSessionGetRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function longSessionGet($session_id, string $contentType = self::contentTypes['longSessionGet'][0]) + { + list($response) = $this->longSessionGetWithHttpInfo($session_id, $contentType); + return $response; + } + + /** + * Operation longSessionGetWithHttpInfo + * + * @param string $session_id ID of session (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionGet'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\LongSessionGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function longSessionGetWithHttpInfo($session_id, string $contentType = self::contentTypes['longSessionGet'][0]) + { + $request = $this->longSessionGetRequest($session_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\LongSessionGetRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\LongSessionGetRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\LongSessionGetRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\LongSessionGetRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\LongSessionGetRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation longSessionGetAsync + * + * @param string $session_id ID of session (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function longSessionGetAsync($session_id, string $contentType = self::contentTypes['longSessionGet'][0]) + { + return $this->longSessionGetAsyncWithHttpInfo($session_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation longSessionGetAsyncWithHttpInfo + * + * @param string $session_id ID of session (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function longSessionGetAsyncWithHttpInfo($session_id, string $contentType = self::contentTypes['longSessionGet'][0]) + { + $returnType = '\Corbado\Generated\Model\LongSessionGetRsp'; + $request = $this->longSessionGetRequest($session_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'longSessionGet' + * + * @param string $session_id ID of session (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function longSessionGetRequest($session_id, string $contentType = self::contentTypes['longSessionGet'][0]) + { + + // verify the required parameter 'session_id' is set + if ($session_id === null || (is_array($session_id) && count($session_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $session_id when calling longSessionGet' + ); + } + if (strlen($session_id) > 30) { + throw new \InvalidArgumentException('invalid length for "$session_id" when calling LongSessionsApi.longSessionGet, must be smaller than or equal to 30.'); + } + if (strlen($session_id) < 30) { + throw new \InvalidArgumentException('invalid length for "$session_id" when calling LongSessionsApi.longSessionGet, must be bigger than or equal to 30.'); + } + + + $resourcePath = '/v1/longSessions/{sessionID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($session_id !== null) { + $resourcePath = str_replace( + '{' . 'sessionID' . '}', + ObjectSerializer::toPathValue($session_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation longSessionList + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionList'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\LongSessionListRsp + */ + public function longSessionList($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['longSessionList'][0]) + { + list($response) = $this->longSessionListWithHttpInfo($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + return $response; + } + + /** + * Operation longSessionListWithHttpInfo + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionList'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\LongSessionListRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function longSessionListWithHttpInfo($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['longSessionList'][0]) + { + $request = $this->longSessionListRequest($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\LongSessionListRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\LongSessionListRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\LongSessionListRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\LongSessionListRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\LongSessionListRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation longSessionListAsync + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function longSessionListAsync($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['longSessionList'][0]) + { + return $this->longSessionListAsyncWithHttpInfo($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation longSessionListAsyncWithHttpInfo + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function longSessionListAsyncWithHttpInfo($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['longSessionList'][0]) + { + $returnType = '\Corbado\Generated\Model\LongSessionListRsp'; + $request = $this->longSessionListRequest($remote_address, $user_agent, $sort, $filter, $page, $page_size, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'longSessionList' + * + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $sort Field sorting (optional) + * @param string[] $filter Field filtering (optional) + * @param int $page Page number (optional, default to 1) + * @param int $page_size Number of items per page (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function longSessionListRequest($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['longSessionList'][0]) + { + + + + + + + + + $resourcePath = '/v1/longSessions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $remote_address, + 'remoteAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $user_agent, + 'userAgent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + 'filter[]', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'pageSize', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation longSessionRevoke + * + * @param string $session_id ID of session (required) + * @param \Corbado\Generated\Model\LongSessionRevokeReq $long_session_revoke_req long_session_revoke_req (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionRevoke'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function longSessionRevoke($session_id, $long_session_revoke_req = null, string $contentType = self::contentTypes['longSessionRevoke'][0]) + { + list($response) = $this->longSessionRevokeWithHttpInfo($session_id, $long_session_revoke_req, $contentType); + return $response; + } + + /** + * Operation longSessionRevokeWithHttpInfo + * + * @param string $session_id ID of session (required) + * @param \Corbado\Generated\Model\LongSessionRevokeReq $long_session_revoke_req (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionRevoke'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function longSessionRevokeWithHttpInfo($session_id, $long_session_revoke_req = null, string $contentType = self::contentTypes['longSessionRevoke'][0]) + { + $request = $this->longSessionRevokeRequest($session_id, $long_session_revoke_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\GenericRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\GenericRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\GenericRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\GenericRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation longSessionRevokeAsync + * + * @param string $session_id ID of session (required) + * @param \Corbado\Generated\Model\LongSessionRevokeReq $long_session_revoke_req (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionRevoke'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function longSessionRevokeAsync($session_id, $long_session_revoke_req = null, string $contentType = self::contentTypes['longSessionRevoke'][0]) + { + return $this->longSessionRevokeAsyncWithHttpInfo($session_id, $long_session_revoke_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation longSessionRevokeAsyncWithHttpInfo + * + * @param string $session_id ID of session (required) + * @param \Corbado\Generated\Model\LongSessionRevokeReq $long_session_revoke_req (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionRevoke'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function longSessionRevokeAsyncWithHttpInfo($session_id, $long_session_revoke_req = null, string $contentType = self::contentTypes['longSessionRevoke'][0]) + { + $returnType = '\Corbado\Generated\Model\GenericRsp'; + $request = $this->longSessionRevokeRequest($session_id, $long_session_revoke_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'longSessionRevoke' + * + * @param string $session_id ID of session (required) + * @param \Corbado\Generated\Model\LongSessionRevokeReq $long_session_revoke_req (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['longSessionRevoke'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function longSessionRevokeRequest($session_id, $long_session_revoke_req = null, string $contentType = self::contentTypes['longSessionRevoke'][0]) + { + + // verify the required parameter 'session_id' is set + if ($session_id === null || (is_array($session_id) && count($session_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $session_id when calling longSessionRevoke' + ); + } + if (strlen($session_id) > 30) { + throw new \InvalidArgumentException('invalid length for "$session_id" when calling LongSessionsApi.longSessionRevoke, must be smaller than or equal to 30.'); + } + if (strlen($session_id) < 30) { + throw new \InvalidArgumentException('invalid length for "$session_id" when calling LongSessionsApi.longSessionRevoke, must be bigger than or equal to 30.'); + } + + + + $resourcePath = '/v1/longSessions/{sessionID}/revoke'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($session_id !== null) { + $resourcePath = str_replace( + '{' . 'sessionID' . '}', + ObjectSerializer::toPathValue($session_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($long_session_revoke_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($long_session_revoke_req)); + } else { + $httpBody = $long_session_revoke_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Generated/Api/PasskeysBiometricsApi.php b/src/Generated/Api/PasskeysBiometricsApi.php index 9c7cc7c..972e3ef 100644 --- a/src/Generated/Api/PasskeysBiometricsApi.php +++ b/src/Generated/Api/PasskeysBiometricsApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -72,12 +72,24 @@ class PasskeysBiometricsApi /** @var string[] $contentTypes **/ public const contentTypes = [ + 'webAuthnAssociateStart' => [ + 'application/json', + ], 'webAuthnAuthenticateFinish' => [ 'application/json', ], 'webAuthnAuthenticateStart' => [ 'application/json', ], + 'webAuthnAuthenticatorUpdate' => [ + 'application/json', + ], + 'webAuthnCredentialDelete' => [ + 'application/json', + ], + 'webAuthnCredentialExists' => [ + 'application/json', + ], 'webAuthnCredentialList' => [ 'application/json', ], @@ -110,81 +122,1473 @@ class PasskeysBiometricsApi ], ]; -/** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation webAuthnAssociateStart + * + * @param \Corbado\Generated\Model\WebAuthnAssociateStartReq $web_authn_associate_start_req web_authn_associate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAssociateStart'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\WebAuthnAssociateStartRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function webAuthnAssociateStart($web_authn_associate_start_req, string $contentType = self::contentTypes['webAuthnAssociateStart'][0]) + { + list($response) = $this->webAuthnAssociateStartWithHttpInfo($web_authn_associate_start_req, $contentType); + return $response; + } + + /** + * Operation webAuthnAssociateStartWithHttpInfo + * + * @param \Corbado\Generated\Model\WebAuthnAssociateStartReq $web_authn_associate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAssociateStart'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\WebAuthnAssociateStartRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function webAuthnAssociateStartWithHttpInfo($web_authn_associate_start_req, string $contentType = self::contentTypes['webAuthnAssociateStart'][0]) + { + $request = $this->webAuthnAssociateStartRequest($web_authn_associate_start_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\WebAuthnAssociateStartRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\WebAuthnAssociateStartRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\WebAuthnAssociateStartRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\WebAuthnAssociateStartRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\WebAuthnAssociateStartRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation webAuthnAssociateStartAsync + * + * @param \Corbado\Generated\Model\WebAuthnAssociateStartReq $web_authn_associate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAssociateStart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function webAuthnAssociateStartAsync($web_authn_associate_start_req, string $contentType = self::contentTypes['webAuthnAssociateStart'][0]) + { + return $this->webAuthnAssociateStartAsyncWithHttpInfo($web_authn_associate_start_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation webAuthnAssociateStartAsyncWithHttpInfo + * + * @param \Corbado\Generated\Model\WebAuthnAssociateStartReq $web_authn_associate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAssociateStart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function webAuthnAssociateStartAsyncWithHttpInfo($web_authn_associate_start_req, string $contentType = self::contentTypes['webAuthnAssociateStart'][0]) + { + $returnType = '\Corbado\Generated\Model\WebAuthnAssociateStartRsp'; + $request = $this->webAuthnAssociateStartRequest($web_authn_associate_start_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'webAuthnAssociateStart' + * + * @param \Corbado\Generated\Model\WebAuthnAssociateStartReq $web_authn_associate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAssociateStart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function webAuthnAssociateStartRequest($web_authn_associate_start_req, string $contentType = self::contentTypes['webAuthnAssociateStart'][0]) + { + + // verify the required parameter 'web_authn_associate_start_req' is set + if ($web_authn_associate_start_req === null || (is_array($web_authn_associate_start_req) && count($web_authn_associate_start_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $web_authn_associate_start_req when calling webAuthnAssociateStart' + ); + } + + + $resourcePath = '/v1/webauthn/associate/start'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($web_authn_associate_start_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_authn_associate_start_req)); + } else { + $httpBody = $web_authn_associate_start_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation webAuthnAuthenticateFinish + * + * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req web_authn_finish_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function webAuthnAuthenticateFinish($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + { + list($response) = $this->webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, $contentType); + return $response; + } + + /** + * Operation webAuthnAuthenticateFinishWithHttpInfo + * + * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + { + $request = $this->webAuthnAuthenticateFinishRequest($web_authn_finish_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation webAuthnAuthenticateFinishAsync + * + * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function webAuthnAuthenticateFinishAsync($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + { + return $this->webAuthnAuthenticateFinishAsyncWithHttpInfo($web_authn_finish_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation webAuthnAuthenticateFinishAsyncWithHttpInfo + * + * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function webAuthnAuthenticateFinishAsyncWithHttpInfo($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + { + $returnType = '\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp'; + $request = $this->webAuthnAuthenticateFinishRequest($web_authn_finish_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'webAuthnAuthenticateFinish' + * + * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function webAuthnAuthenticateFinishRequest($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + { + + // verify the required parameter 'web_authn_finish_req' is set + if ($web_authn_finish_req === null || (is_array($web_authn_finish_req) && count($web_authn_finish_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $web_authn_finish_req when calling webAuthnAuthenticateFinish' + ); + } + + + $resourcePath = '/v1/webauthn/authenticate/finish'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($web_authn_finish_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_authn_finish_req)); + } else { + $httpBody = $web_authn_finish_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation webAuthnAuthenticateStart + * + * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req web_authn_authenticate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\WebAuthnAuthenticateStartRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function webAuthnAuthenticateStart($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + { + list($response) = $this->webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_start_req, $contentType); + return $response; + } + + /** + * Operation webAuthnAuthenticateStartWithHttpInfo + * + * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\WebAuthnAuthenticateStartRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + { + $request = $this->webAuthnAuthenticateStartRequest($web_authn_authenticate_start_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation webAuthnAuthenticateStartAsync + * + * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function webAuthnAuthenticateStartAsync($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + { + return $this->webAuthnAuthenticateStartAsyncWithHttpInfo($web_authn_authenticate_start_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation webAuthnAuthenticateStartAsyncWithHttpInfo + * + * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function webAuthnAuthenticateStartAsyncWithHttpInfo($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + { + $returnType = '\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp'; + $request = $this->webAuthnAuthenticateStartRequest($web_authn_authenticate_start_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'webAuthnAuthenticateStart' + * + * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function webAuthnAuthenticateStartRequest($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + { + + // verify the required parameter 'web_authn_authenticate_start_req' is set + if ($web_authn_authenticate_start_req === null || (is_array($web_authn_authenticate_start_req) && count($web_authn_authenticate_start_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $web_authn_authenticate_start_req when calling webAuthnAuthenticateStart' + ); + } + + + $resourcePath = '/v1/webauthn/authenticate/start'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($web_authn_authenticate_start_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_authn_authenticate_start_req)); + } else { + $httpBody = $web_authn_authenticate_start_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation webAuthnAuthenticatorUpdate + * + * @param string $authenticator_id ID of authenticator (required) + * @param \Corbado\Generated\Model\WebAuthnAuthenticatorUpdateReq $web_authn_authenticator_update_req web_authn_authenticator_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticatorUpdate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function webAuthnAuthenticatorUpdate($authenticator_id, $web_authn_authenticator_update_req, string $contentType = self::contentTypes['webAuthnAuthenticatorUpdate'][0]) + { + list($response) = $this->webAuthnAuthenticatorUpdateWithHttpInfo($authenticator_id, $web_authn_authenticator_update_req, $contentType); + return $response; + } + + /** + * Operation webAuthnAuthenticatorUpdateWithHttpInfo + * + * @param string $authenticator_id ID of authenticator (required) + * @param \Corbado\Generated\Model\WebAuthnAuthenticatorUpdateReq $web_authn_authenticator_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticatorUpdate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function webAuthnAuthenticatorUpdateWithHttpInfo($authenticator_id, $web_authn_authenticator_update_req, string $contentType = self::contentTypes['webAuthnAuthenticatorUpdate'][0]) + { + $request = $this->webAuthnAuthenticatorUpdateRequest($authenticator_id, $web_authn_authenticator_update_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\GenericRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\GenericRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\GenericRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\GenericRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation webAuthnAuthenticatorUpdateAsync + * + * @param string $authenticator_id ID of authenticator (required) + * @param \Corbado\Generated\Model\WebAuthnAuthenticatorUpdateReq $web_authn_authenticator_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticatorUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function webAuthnAuthenticatorUpdateAsync($authenticator_id, $web_authn_authenticator_update_req, string $contentType = self::contentTypes['webAuthnAuthenticatorUpdate'][0]) + { + return $this->webAuthnAuthenticatorUpdateAsyncWithHttpInfo($authenticator_id, $web_authn_authenticator_update_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation webAuthnAuthenticatorUpdateAsyncWithHttpInfo + * + * @param string $authenticator_id ID of authenticator (required) + * @param \Corbado\Generated\Model\WebAuthnAuthenticatorUpdateReq $web_authn_authenticator_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticatorUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function webAuthnAuthenticatorUpdateAsyncWithHttpInfo($authenticator_id, $web_authn_authenticator_update_req, string $contentType = self::contentTypes['webAuthnAuthenticatorUpdate'][0]) + { + $returnType = '\Corbado\Generated\Model\GenericRsp'; + $request = $this->webAuthnAuthenticatorUpdateRequest($authenticator_id, $web_authn_authenticator_update_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'webAuthnAuthenticatorUpdate' + * + * @param string $authenticator_id ID of authenticator (required) + * @param \Corbado\Generated\Model\WebAuthnAuthenticatorUpdateReq $web_authn_authenticator_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticatorUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function webAuthnAuthenticatorUpdateRequest($authenticator_id, $web_authn_authenticator_update_req, string $contentType = self::contentTypes['webAuthnAuthenticatorUpdate'][0]) + { + + // verify the required parameter 'authenticator_id' is set + if ($authenticator_id === null || (is_array($authenticator_id) && count($authenticator_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $authenticator_id when calling webAuthnAuthenticatorUpdate' + ); + } + + // verify the required parameter 'web_authn_authenticator_update_req' is set + if ($web_authn_authenticator_update_req === null || (is_array($web_authn_authenticator_update_req) && count($web_authn_authenticator_update_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $web_authn_authenticator_update_req when calling webAuthnAuthenticatorUpdate' + ); + } + + + $resourcePath = '/v1/webauthn/authenticator/{authenticatorID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($authenticator_id !== null) { + $resourcePath = str_replace( + '{' . 'authenticatorID' . '}', + ObjectSerializer::toPathValue($authenticator_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($web_authn_authenticator_update_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_authn_authenticator_update_req)); + } else { + $httpBody = $web_authn_authenticator_update_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** - * Operation webAuthnAuthenticateFinish + * Operation webAuthnCredentialDelete * - * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req web_authn_finish_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $credential_id ID of credential (required) + * @param \Corbado\Generated\Model\EmptyReq $empty_req empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp|\Corbado\Generated\Model\ErrorRsp + * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ - public function webAuthnAuthenticateFinish($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + public function webAuthnCredentialDelete($user_id, $credential_id, $empty_req, string $contentType = self::contentTypes['webAuthnCredentialDelete'][0]) { - list($response) = $this->webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, $contentType); + list($response) = $this->webAuthnCredentialDeleteWithHttpInfo($user_id, $credential_id, $empty_req, $contentType); return $response; } /** - * Operation webAuthnAuthenticateFinishWithHttpInfo + * Operation webAuthnCredentialDeleteWithHttpInfo * - * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $credential_id ID of credential (required) + * @param \Corbado\Generated\Model\EmptyReq $empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ - public function webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + public function webAuthnCredentialDeleteWithHttpInfo($user_id, $credential_id, $empty_req, string $contentType = self::contentTypes['webAuthnCredentialDelete'][0]) { - $request = $this->webAuthnAuthenticateFinishRequest($web_authn_finish_req, $contentType); + $request = $this->webAuthnCredentialDeleteRequest($user_id, $credential_id, $empty_req, $contentType); try { $options = $this->createHttpClientOption(); @@ -223,17 +1627,29 @@ public function webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, st switch($statusCode) { case 200: - if ('\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp' === '\SplFileObject') { + if ('\Corbado\Generated\Model\GenericRsp' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp' !== 'string') { - $content = json_decode($content); + if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } return [ - ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp', []), + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\GenericRsp', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -243,7 +1659,19 @@ public function webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, st } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -254,13 +1682,25 @@ public function webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, st ]; } - $returnType = '\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp'; + $returnType = '\Corbado\Generated\Model\GenericRsp'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -275,7 +1715,7 @@ public function webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, st case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp', + '\Corbado\Generated\Model\GenericRsp', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -294,17 +1734,19 @@ public function webAuthnAuthenticateFinishWithHttpInfo($web_authn_finish_req, st } /** - * Operation webAuthnAuthenticateFinishAsync + * Operation webAuthnCredentialDeleteAsync * - * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $credential_id ID of credential (required) + * @param \Corbado\Generated\Model\EmptyReq $empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webAuthnAuthenticateFinishAsync($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + public function webAuthnCredentialDeleteAsync($user_id, $credential_id, $empty_req, string $contentType = self::contentTypes['webAuthnCredentialDelete'][0]) { - return $this->webAuthnAuthenticateFinishAsyncWithHttpInfo($web_authn_finish_req, $contentType) + return $this->webAuthnCredentialDeleteAsyncWithHttpInfo($user_id, $credential_id, $empty_req, $contentType) ->then( function ($response) { return $response[0]; @@ -313,18 +1755,20 @@ function ($response) { } /** - * Operation webAuthnAuthenticateFinishAsyncWithHttpInfo + * Operation webAuthnCredentialDeleteAsyncWithHttpInfo * - * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $credential_id ID of credential (required) + * @param \Corbado\Generated\Model\EmptyReq $empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webAuthnAuthenticateFinishAsyncWithHttpInfo($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + public function webAuthnCredentialDeleteAsyncWithHttpInfo($user_id, $credential_id, $empty_req, string $contentType = self::contentTypes['webAuthnCredentialDelete'][0]) { - $returnType = '\Corbado\Generated\Model\WebAuthnAuthenticateFinishRsp'; - $request = $this->webAuthnAuthenticateFinishRequest($web_authn_finish_req, $contentType); + $returnType = '\Corbado\Generated\Model\GenericRsp'; + $request = $this->webAuthnCredentialDeleteRequest($user_id, $credential_id, $empty_req, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -363,26 +1807,42 @@ function ($exception) { } /** - * Create request for operation 'webAuthnAuthenticateFinish' + * Create request for operation 'webAuthnCredentialDelete' * - * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateFinish'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $credential_id ID of credential (required) + * @param \Corbado\Generated\Model\EmptyReq $empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function webAuthnAuthenticateFinishRequest($web_authn_finish_req, string $contentType = self::contentTypes['webAuthnAuthenticateFinish'][0]) + public function webAuthnCredentialDeleteRequest($user_id, $credential_id, $empty_req, string $contentType = self::contentTypes['webAuthnCredentialDelete'][0]) { - // verify the required parameter 'web_authn_finish_req' is set - if ($web_authn_finish_req === null || (is_array($web_authn_finish_req) && count($web_authn_finish_req) === 0)) { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $web_authn_finish_req when calling webAuthnAuthenticateFinish' + 'Missing the required parameter $user_id when calling webAuthnCredentialDelete' + ); + } + + // verify the required parameter 'credential_id' is set + if ($credential_id === null || (is_array($credential_id) && count($credential_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $credential_id when calling webAuthnCredentialDelete' + ); + } + + // verify the required parameter 'empty_req' is set + if ($empty_req === null || (is_array($empty_req) && count($empty_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $empty_req when calling webAuthnCredentialDelete' ); } - $resourcePath = '/v1/webauthn/authenticate/finish'; + $resourcePath = '/v1/users/{userID}/credentials/{credentialID}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -391,6 +1851,22 @@ public function webAuthnAuthenticateFinishRequest($web_authn_finish_req, string + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'userID' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + // path params + if ($credential_id !== null) { + $resourcePath = str_replace( + '{' . 'credentialID' . '}', + ObjectSerializer::toPathValue($credential_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -400,12 +1876,12 @@ public function webAuthnAuthenticateFinishRequest($web_authn_finish_req, string ); // for model (json/xml) - if (isset($web_authn_finish_req)) { + if (isset($empty_req)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_authn_finish_req)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($empty_req)); } else { - $httpBody = $web_authn_finish_req; + $httpBody = $empty_req; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -455,7 +1931,7 @@ public function webAuthnAuthenticateFinishRequest($web_authn_finish_req, string $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'DELETE', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -463,34 +1939,34 @@ public function webAuthnAuthenticateFinishRequest($web_authn_finish_req, string } /** - * Operation webAuthnAuthenticateStart + * Operation webAuthnCredentialExists * - * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req web_authn_authenticate_start_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * @param \Corbado\Generated\Model\WebAuthnCredentialExistsReq $web_authn_credential_exists_req web_authn_credential_exists_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialExists'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \Corbado\Generated\Model\WebAuthnAuthenticateStartRsp|\Corbado\Generated\Model\ErrorRsp + * @return \Corbado\Generated\Model\WebAuthnCredentialExistsRsp|\Corbado\Generated\Model\ErrorRsp */ - public function webAuthnAuthenticateStart($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + public function webAuthnCredentialExists($web_authn_credential_exists_req, string $contentType = self::contentTypes['webAuthnCredentialExists'][0]) { - list($response) = $this->webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_start_req, $contentType); + list($response) = $this->webAuthnCredentialExistsWithHttpInfo($web_authn_credential_exists_req, $contentType); return $response; } /** - * Operation webAuthnAuthenticateStartWithHttpInfo + * Operation webAuthnCredentialExistsWithHttpInfo * - * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * @param \Corbado\Generated\Model\WebAuthnCredentialExistsReq $web_authn_credential_exists_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialExists'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \Corbado\Generated\Model\WebAuthnAuthenticateStartRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + * @return array of \Corbado\Generated\Model\WebAuthnCredentialExistsRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ - public function webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + public function webAuthnCredentialExistsWithHttpInfo($web_authn_credential_exists_req, string $contentType = self::contentTypes['webAuthnCredentialExists'][0]) { - $request = $this->webAuthnAuthenticateStartRequest($web_authn_authenticate_start_req, $contentType); + $request = $this->webAuthnCredentialExistsRequest($web_authn_credential_exists_req, $contentType); try { $options = $this->createHttpClientOption(); @@ -529,17 +2005,29 @@ public function webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_st switch($statusCode) { case 200: - if ('\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp' === '\SplFileObject') { + if ('\Corbado\Generated\Model\WebAuthnCredentialExistsRsp' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp' !== 'string') { - $content = json_decode($content); + if ('\Corbado\Generated\Model\WebAuthnCredentialExistsRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } return [ - ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp', []), + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\WebAuthnCredentialExistsRsp', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -549,7 +2037,19 @@ public function webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_st } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -560,13 +2060,25 @@ public function webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_st ]; } - $returnType = '\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp'; + $returnType = '\Corbado\Generated\Model\WebAuthnCredentialExistsRsp'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -581,7 +2093,7 @@ public function webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_st case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp', + '\Corbado\Generated\Model\WebAuthnCredentialExistsRsp', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -600,17 +2112,17 @@ public function webAuthnAuthenticateStartWithHttpInfo($web_authn_authenticate_st } /** - * Operation webAuthnAuthenticateStartAsync + * Operation webAuthnCredentialExistsAsync * - * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * @param \Corbado\Generated\Model\WebAuthnCredentialExistsReq $web_authn_credential_exists_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialExists'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webAuthnAuthenticateStartAsync($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + public function webAuthnCredentialExistsAsync($web_authn_credential_exists_req, string $contentType = self::contentTypes['webAuthnCredentialExists'][0]) { - return $this->webAuthnAuthenticateStartAsyncWithHttpInfo($web_authn_authenticate_start_req, $contentType) + return $this->webAuthnCredentialExistsAsyncWithHttpInfo($web_authn_credential_exists_req, $contentType) ->then( function ($response) { return $response[0]; @@ -619,18 +2131,18 @@ function ($response) { } /** - * Operation webAuthnAuthenticateStartAsyncWithHttpInfo + * Operation webAuthnCredentialExistsAsyncWithHttpInfo * - * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * @param \Corbado\Generated\Model\WebAuthnCredentialExistsReq $web_authn_credential_exists_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialExists'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webAuthnAuthenticateStartAsyncWithHttpInfo($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + public function webAuthnCredentialExistsAsyncWithHttpInfo($web_authn_credential_exists_req, string $contentType = self::contentTypes['webAuthnCredentialExists'][0]) { - $returnType = '\Corbado\Generated\Model\WebAuthnAuthenticateStartRsp'; - $request = $this->webAuthnAuthenticateStartRequest($web_authn_authenticate_start_req, $contentType); + $returnType = '\Corbado\Generated\Model\WebAuthnCredentialExistsRsp'; + $request = $this->webAuthnCredentialExistsRequest($web_authn_credential_exists_req, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -669,26 +2181,26 @@ function ($exception) { } /** - * Create request for operation 'webAuthnAuthenticateStart' + * Create request for operation 'webAuthnCredentialExists' * - * @param \Corbado\Generated\Model\WebAuthnAuthenticateStartReq $web_authn_authenticate_start_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnAuthenticateStart'] to see the possible values for this operation + * @param \Corbado\Generated\Model\WebAuthnCredentialExistsReq $web_authn_credential_exists_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialExists'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function webAuthnAuthenticateStartRequest($web_authn_authenticate_start_req, string $contentType = self::contentTypes['webAuthnAuthenticateStart'][0]) + public function webAuthnCredentialExistsRequest($web_authn_credential_exists_req, string $contentType = self::contentTypes['webAuthnCredentialExists'][0]) { - // verify the required parameter 'web_authn_authenticate_start_req' is set - if ($web_authn_authenticate_start_req === null || (is_array($web_authn_authenticate_start_req) && count($web_authn_authenticate_start_req) === 0)) { + // verify the required parameter 'web_authn_credential_exists_req' is set + if ($web_authn_credential_exists_req === null || (is_array($web_authn_credential_exists_req) && count($web_authn_credential_exists_req) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $web_authn_authenticate_start_req when calling webAuthnAuthenticateStart' + 'Missing the required parameter $web_authn_credential_exists_req when calling webAuthnCredentialExists' ); } - $resourcePath = '/v1/webauthn/authenticate/start'; + $resourcePath = '/v1/webauthn/credential/exists'; $formParams = []; $queryParams = []; $headerParams = []; @@ -706,12 +2218,12 @@ public function webAuthnAuthenticateStartRequest($web_authn_authenticate_start_r ); // for model (json/xml) - if (isset($web_authn_authenticate_start_req)) { + if (isset($web_authn_credential_exists_req)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_authn_authenticate_start_req)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_authn_credential_exists_req)); } else { - $httpBody = $web_authn_authenticate_start_req; + $httpBody = $web_authn_credential_exists_req; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -779,7 +2291,7 @@ public function webAuthnAuthenticateStartRequest($web_authn_authenticate_start_r * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebAuthnCredentialListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -800,7 +2312,7 @@ public function webAuthnCredentialList($remote_address = null, $user_agent = nul * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebAuthnCredentialListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -850,7 +2362,19 @@ public function webAuthnCredentialListWithHttpInfo($remote_address = null, $user } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebAuthnCredentialListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -865,7 +2389,19 @@ public function webAuthnCredentialListWithHttpInfo($remote_address = null, $user } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -882,7 +2418,19 @@ public function webAuthnCredentialListWithHttpInfo($remote_address = null, $user } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1048,8 +2596,8 @@ public function webAuthnCredentialListRequest($remote_address = null, $user_agen $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1066,8 +2614,8 @@ public function webAuthnCredentialListRequest($remote_address = null, $user_agen $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1075,8 +2623,8 @@ public function webAuthnCredentialListRequest($remote_address = null, $user_agen $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); @@ -1156,7 +2704,7 @@ public function webAuthnCredentialListRequest($remote_address = null, $user_agen * @param \Corbado\Generated\Model\WebAuthnCredentialReq $web_authn_credential_req web_authn_credential_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialUpdate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebAuthnCredentialRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -1173,7 +2721,7 @@ public function webAuthnCredentialUpdate($credential_id, $web_authn_credential_r * @param \Corbado\Generated\Model\WebAuthnCredentialReq $web_authn_credential_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnCredentialUpdate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebAuthnCredentialRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1223,7 +2771,19 @@ public function webAuthnCredentialUpdateWithHttpInfo($credential_id, $web_authn_ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebAuthnCredentialRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1238,7 +2798,19 @@ public function webAuthnCredentialUpdateWithHttpInfo($credential_id, $web_authn_ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1255,7 +2827,19 @@ public function webAuthnCredentialUpdateWithHttpInfo($credential_id, $web_authn_ } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1481,7 +3065,7 @@ public function webAuthnCredentialUpdateRequest($credential_id, $web_authn_crede * @param \Corbado\Generated\Model\WebAuthnMediationStartReq $web_authn_mediation_start_req web_authn_mediation_start_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnMediationStart'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebAuthnMediationStartRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -1497,7 +3081,7 @@ public function webAuthnMediationStart($web_authn_mediation_start_req, string $c * @param \Corbado\Generated\Model\WebAuthnMediationStartReq $web_authn_mediation_start_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnMediationStart'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebAuthnMediationStartRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1547,7 +3131,19 @@ public function webAuthnMediationStartWithHttpInfo($web_authn_mediation_start_re } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebAuthnMediationStartRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1562,7 +3158,19 @@ public function webAuthnMediationStartWithHttpInfo($web_authn_mediation_start_re } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1579,7 +3187,19 @@ public function webAuthnMediationStartWithHttpInfo($web_authn_mediation_start_re } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1787,7 +3407,7 @@ public function webAuthnMediationStartRequest($web_authn_mediation_start_req, st * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req web_authn_finish_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnRegisterFinish'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebAuthnRegisterFinishRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -1803,7 +3423,7 @@ public function webAuthnRegisterFinish($web_authn_finish_req, string $contentTyp * @param \Corbado\Generated\Model\WebAuthnFinishReq $web_authn_finish_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnRegisterFinish'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebAuthnRegisterFinishRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1853,7 +3473,19 @@ public function webAuthnRegisterFinishWithHttpInfo($web_authn_finish_req, string } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebAuthnRegisterFinishRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1868,7 +3500,19 @@ public function webAuthnRegisterFinishWithHttpInfo($web_authn_finish_req, string } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1885,7 +3529,19 @@ public function webAuthnRegisterFinishWithHttpInfo($web_authn_finish_req, string } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2093,7 +3749,7 @@ public function webAuthnRegisterFinishRequest($web_authn_finish_req, string $con * @param \Corbado\Generated\Model\WebAuthnRegisterStartReq $web_authn_register_start_req web_authn_register_start_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnRegisterStart'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebAuthnRegisterStartRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -2109,7 +3765,7 @@ public function webAuthnRegisterStart($web_authn_register_start_req = null, stri * @param \Corbado\Generated\Model\WebAuthnRegisterStartReq $web_authn_register_start_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnRegisterStart'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebAuthnRegisterStartRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -2159,7 +3815,19 @@ public function webAuthnRegisterStartWithHttpInfo($web_authn_register_start_req } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebAuthnRegisterStartRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2174,7 +3842,19 @@ public function webAuthnRegisterStartWithHttpInfo($web_authn_register_start_req } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2191,7 +3871,19 @@ public function webAuthnRegisterStartWithHttpInfo($web_authn_register_start_req } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2393,7 +4085,7 @@ public function webAuthnRegisterStartRequest($web_authn_register_start_req = nul * @param \Corbado\Generated\Model\WebauthnSettingCreateReq $webauthn_setting_create_req webauthn_setting_create_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebauthnSettingCreateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -2409,7 +4101,7 @@ public function webAuthnSettingCreate($webauthn_setting_create_req = null, strin * @param \Corbado\Generated\Model\WebauthnSettingCreateReq $webauthn_setting_create_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebauthnSettingCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -2459,7 +4151,19 @@ public function webAuthnSettingCreateWithHttpInfo($webauthn_setting_create_req = } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebauthnSettingCreateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2474,7 +4178,19 @@ public function webAuthnSettingCreateWithHttpInfo($webauthn_setting_create_req = } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2491,7 +4207,19 @@ public function webAuthnSettingCreateWithHttpInfo($webauthn_setting_create_req = } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2698,7 +4426,7 @@ public function webAuthnSettingCreateRequest($webauthn_setting_create_req = null * @param \Corbado\Generated\Model\WebauthnSettingDeleteReq $webauthn_setting_delete_req webauthn_setting_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -2715,7 +4443,7 @@ public function webAuthnSettingDelete($setting_id, $webauthn_setting_delete_req * @param \Corbado\Generated\Model\WebauthnSettingDeleteReq $webauthn_setting_delete_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -2765,7 +4493,19 @@ public function webAuthnSettingDeleteWithHttpInfo($setting_id, $webauthn_setting } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2780,7 +4520,19 @@ public function webAuthnSettingDeleteWithHttpInfo($setting_id, $webauthn_setting } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2797,7 +4549,19 @@ public function webAuthnSettingDeleteWithHttpInfo($setting_id, $webauthn_setting } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3021,7 +4785,7 @@ public function webAuthnSettingDeleteRequest($setting_id, $webauthn_setting_dele * @param string $setting_id ID from create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebauthnSettingGetRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -3037,7 +4801,7 @@ public function webAuthnSettingGet($setting_id, string $contentType = self::cont * @param string $setting_id ID from create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebauthnSettingGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -3087,7 +4851,19 @@ public function webAuthnSettingGetWithHttpInfo($setting_id, string $contentType } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebauthnSettingGetRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3102,7 +4878,19 @@ public function webAuthnSettingGetWithHttpInfo($setting_id, string $contentType } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3119,7 +4907,19 @@ public function webAuthnSettingGetWithHttpInfo($setting_id, string $contentType } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3337,7 +5137,7 @@ public function webAuthnSettingGetRequest($setting_id, string $contentType = sel * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebauthnSettingListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -3358,7 +5158,7 @@ public function webAuthnSettingList($remote_address = null, $user_agent = null, * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebauthnSettingListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -3408,7 +5208,19 @@ public function webAuthnSettingListWithHttpInfo($remote_address = null, $user_ag } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebauthnSettingListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3423,7 +5235,19 @@ public function webAuthnSettingListWithHttpInfo($remote_address = null, $user_ag } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3440,7 +5264,19 @@ public function webAuthnSettingListWithHttpInfo($remote_address = null, $user_ag } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3606,8 +5442,8 @@ public function webAuthnSettingListRequest($remote_address = null, $user_agent = $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -3624,8 +5460,8 @@ public function webAuthnSettingListRequest($remote_address = null, $user_agent = $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -3633,8 +5469,8 @@ public function webAuthnSettingListRequest($remote_address = null, $user_agent = $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); @@ -3714,7 +5550,7 @@ public function webAuthnSettingListRequest($remote_address = null, $user_agent = * @param \Corbado\Generated\Model\WebauthnSettingUpdateReq $webauthn_setting_update_req webauthn_setting_update_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingPut'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebauthnSettingUpdateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -3731,7 +5567,7 @@ public function webAuthnSettingPut($setting_id, $webauthn_setting_update_req = n * @param \Corbado\Generated\Model\WebauthnSettingUpdateReq $webauthn_setting_update_req (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webAuthnSettingPut'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebauthnSettingUpdateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -3781,7 +5617,19 @@ public function webAuthnSettingPutWithHttpInfo($setting_id, $webauthn_setting_up } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebauthnSettingUpdateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3796,7 +5644,19 @@ public function webAuthnSettingPutWithHttpInfo($setting_id, $webauthn_setting_up } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3813,7 +5673,19 @@ public function webAuthnSettingPutWithHttpInfo($setting_id, $webauthn_setting_up } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/ProjectConfigApi.php b/src/Generated/Api/ProjectConfigApi.php index 25ab88e..20cc046 100644 --- a/src/Generated/Api/ProjectConfigApi.php +++ b/src/Generated/Api/ProjectConfigApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -72,6 +72,9 @@ class ProjectConfigApi /** @var string[] $contentTypes **/ public const contentTypes = [ + 'projectActivate' => [ + 'application/json', + ], 'projectConfigGet' => [ 'application/json', ], @@ -83,7 +86,7 @@ class ProjectConfigApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -129,12 +132,358 @@ public function getConfig() return $this->config; } + /** + * Operation projectActivate + * + * @param \Corbado\Generated\Model\EmptyReq $empty_req empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectActivate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function projectActivate($empty_req, string $contentType = self::contentTypes['projectActivate'][0]) + { + list($response) = $this->projectActivateWithHttpInfo($empty_req, $contentType); + return $response; + } + + /** + * Operation projectActivateWithHttpInfo + * + * @param \Corbado\Generated\Model\EmptyReq $empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectActivate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function projectActivateWithHttpInfo($empty_req, string $contentType = self::contentTypes['projectActivate'][0]) + { + $request = $this->projectActivateRequest($empty_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\GenericRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\GenericRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\GenericRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\GenericRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation projectActivateAsync + * + * @param \Corbado\Generated\Model\EmptyReq $empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectActivate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function projectActivateAsync($empty_req, string $contentType = self::contentTypes['projectActivate'][0]) + { + return $this->projectActivateAsyncWithHttpInfo($empty_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation projectActivateAsyncWithHttpInfo + * + * @param \Corbado\Generated\Model\EmptyReq $empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectActivate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function projectActivateAsyncWithHttpInfo($empty_req, string $contentType = self::contentTypes['projectActivate'][0]) + { + $returnType = '\Corbado\Generated\Model\GenericRsp'; + $request = $this->projectActivateRequest($empty_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'projectActivate' + * + * @param \Corbado\Generated\Model\EmptyReq $empty_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectActivate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function projectActivateRequest($empty_req, string $contentType = self::contentTypes['projectActivate'][0]) + { + + // verify the required parameter 'empty_req' is set + if ($empty_req === null || (is_array($empty_req) && count($empty_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $empty_req when calling projectActivate' + ); + } + + + $resourcePath = '/v1/projects/activate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($empty_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($empty_req)); + } else { + $httpBody = $empty_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation projectConfigGet * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectConfigGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\ProjectConfigGetRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -149,7 +498,7 @@ public function projectConfigGet(string $contentType = self::contentTypes['proje * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectConfigGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\ProjectConfigGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -199,7 +548,19 @@ public function projectConfigGetWithHttpInfo(string $contentType = self::content } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ProjectConfigGetRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -214,7 +575,19 @@ public function projectConfigGetWithHttpInfo(string $contentType = self::content } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -231,7 +604,19 @@ public function projectConfigGetWithHttpInfo(string $contentType = self::content } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -426,7 +811,7 @@ public function projectConfigGetRequest(string $contentType = self::contentTypes * @param \Corbado\Generated\Model\ProjectConfigSaveReq $project_config_save_req project_config_save_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectConfigSave'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -442,7 +827,7 @@ public function projectConfigSave($project_config_save_req, string $contentType * @param \Corbado\Generated\Model\ProjectConfigSaveReq $project_config_save_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectConfigSave'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -492,7 +877,19 @@ public function projectConfigSaveWithHttpInfo($project_config_save_req, string $ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -507,7 +904,19 @@ public function projectConfigSaveWithHttpInfo($project_config_save_req, string $ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -524,7 +933,19 @@ public function projectConfigSaveWithHttpInfo($project_config_save_req, string $ } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -736,7 +1157,7 @@ public function projectConfigSaveRequest($project_config_save_req, string $conte * @param \Corbado\Generated\Model\ProjectConfigWebhookTestReq $project_config_webhook_test_req project_config_webhook_test_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectConfigWebhookTest'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\ProjectConfigWebhookTestRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -752,7 +1173,7 @@ public function projectConfigWebhookTest($project_config_webhook_test_req, strin * @param \Corbado\Generated\Model\ProjectConfigWebhookTestReq $project_config_webhook_test_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['projectConfigWebhookTest'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\ProjectConfigWebhookTestRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -802,7 +1223,19 @@ public function projectConfigWebhookTestWithHttpInfo($project_config_webhook_tes } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ProjectConfigWebhookTestRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -817,7 +1250,19 @@ public function projectConfigWebhookTestWithHttpInfo($project_config_webhook_tes } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -834,7 +1279,19 @@ public function projectConfigWebhookTestWithHttpInfo($project_config_webhook_tes } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/RequestLogsApi.php b/src/Generated/Api/RequestLogsApi.php index 3a3f759..9026bf1 100644 --- a/src/Generated/Api/RequestLogsApi.php +++ b/src/Generated/Api/RequestLogsApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -80,7 +80,7 @@ class RequestLogsApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -134,7 +134,7 @@ public function getConfig() * @param string $user_agent Client's user agent (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestLogGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\RequestLogGetRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -152,7 +152,7 @@ public function requestLogGet($request_id, $remote_address = null, $user_agent = * @param string $user_agent Client's user agent (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestLogGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\RequestLogGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -202,7 +202,19 @@ public function requestLogGetWithHttpInfo($request_id, $remote_address = null, $ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\RequestLogGetRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -217,7 +229,19 @@ public function requestLogGetWithHttpInfo($request_id, $remote_address = null, $ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -234,7 +258,19 @@ public function requestLogGetWithHttpInfo($request_id, $remote_address = null, $ } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -478,7 +514,7 @@ public function requestLogGetRequest($request_id, $remote_address = null, $user_ * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestLogsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\RequestLogsListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -499,7 +535,7 @@ public function requestLogsList($remote_address = null, $user_agent = null, $sor * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestLogsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\RequestLogsListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -549,7 +585,19 @@ public function requestLogsListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\RequestLogsListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -564,7 +612,19 @@ public function requestLogsListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -581,7 +641,19 @@ public function requestLogsListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -747,8 +819,8 @@ public function requestLogsListRequest($remote_address = null, $user_agent = nul $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -765,8 +837,8 @@ public function requestLogsListRequest($remote_address = null, $user_agent = nul $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -774,8 +846,8 @@ public function requestLogsListRequest($remote_address = null, $user_agent = nul $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); diff --git a/src/Generated/Api/SMSOTPApi.php b/src/Generated/Api/SMSOTPApi.php index 2e2c4fc..98e8c68 100644 --- a/src/Generated/Api/SMSOTPApi.php +++ b/src/Generated/Api/SMSOTPApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -80,7 +80,7 @@ class SMSOTPApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -132,7 +132,7 @@ public function getConfig() * @param \Corbado\Generated\Model\SmsCodeSendReq $sms_code_send_req sms_code_send_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smsCodeSend'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\SmsCodeSendRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -148,7 +148,7 @@ public function smsCodeSend($sms_code_send_req, string $contentType = self::cont * @param \Corbado\Generated\Model\SmsCodeSendReq $sms_code_send_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smsCodeSend'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\SmsCodeSendRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -198,7 +198,19 @@ public function smsCodeSendWithHttpInfo($sms_code_send_req, string $contentType } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\SmsCodeSendRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -213,7 +225,19 @@ public function smsCodeSendWithHttpInfo($sms_code_send_req, string $contentType } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -230,7 +254,19 @@ public function smsCodeSendWithHttpInfo($sms_code_send_req, string $contentType } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -439,7 +475,7 @@ public function smsCodeSendRequest($sms_code_send_req, string $contentType = sel * @param \Corbado\Generated\Model\SmsCodeValidateReq $sms_code_validate_req sms_code_validate_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smsCodeValidate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\SmsCodeValidateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -456,7 +492,7 @@ public function smsCodeValidate($sms_code_id, $sms_code_validate_req, string $co * @param \Corbado\Generated\Model\SmsCodeValidateReq $sms_code_validate_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smsCodeValidate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\SmsCodeValidateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -506,7 +542,19 @@ public function smsCodeValidateWithHttpInfo($sms_code_id, $sms_code_validate_req } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\SmsCodeValidateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -521,7 +569,19 @@ public function smsCodeValidateWithHttpInfo($sms_code_id, $sms_code_validate_req } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -538,7 +598,19 @@ public function smsCodeValidateWithHttpInfo($sms_code_id, $sms_code_validate_req } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/SMSTemplatesApi.php b/src/Generated/Api/SMSTemplatesApi.php index c2a4035..042c3c2 100644 --- a/src/Generated/Api/SMSTemplatesApi.php +++ b/src/Generated/Api/SMSTemplatesApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -80,7 +80,7 @@ class SMSTemplatesApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -132,7 +132,7 @@ public function getConfig() * @param \Corbado\Generated\Model\SmsTemplateCreateReq $sms_template_create_req sms_template_create_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smsTemplateCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\SmsTemplateCreateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -148,7 +148,7 @@ public function smsTemplateCreate($sms_template_create_req, string $contentType * @param \Corbado\Generated\Model\SmsTemplateCreateReq $sms_template_create_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smsTemplateCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\SmsTemplateCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -198,7 +198,19 @@ public function smsTemplateCreateWithHttpInfo($sms_template_create_req, string $ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\SmsTemplateCreateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -213,7 +225,19 @@ public function smsTemplateCreateWithHttpInfo($sms_template_create_req, string $ } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -230,7 +254,19 @@ public function smsTemplateCreateWithHttpInfo($sms_template_create_req, string $ } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -435,7 +471,7 @@ public function smsTemplateCreateRequest($sms_template_create_req, string $conte * @param \Corbado\Generated\Model\SmsTemplateDeleteReq $sms_template_delete_req sms_template_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smsTemplateDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -452,7 +488,7 @@ public function smsTemplateDelete($sms_template_id, $sms_template_delete_req, st * @param \Corbado\Generated\Model\SmsTemplateDeleteReq $sms_template_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['smsTemplateDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -502,7 +538,19 @@ public function smsTemplateDeleteWithHttpInfo($sms_template_id, $sms_template_de } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -517,7 +565,19 @@ public function smsTemplateDeleteWithHttpInfo($sms_template_id, $sms_template_de } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -534,7 +594,19 @@ public function smsTemplateDeleteWithHttpInfo($sms_template_id, $sms_template_de } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/SessionConfigApi.php b/src/Generated/Api/SessionConfigApi.php new file mode 100644 index 0000000..9937e1b --- /dev/null +++ b/src/Generated/Api/SessionConfigApi.php @@ -0,0 +1,835 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Api; + +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use Corbado\Generated\ApiException; +use Corbado\Generated\Configuration; +use Corbado\Generated\HeaderSelector; +use Corbado\Generated\ObjectSerializer; + +/** + * SessionConfigApi Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class SessionConfigApi +{ + /** + * @var ClientInterface + */ + protected $client; + + /** + * @var Configuration + */ + protected $config; + + /** + * @var HeaderSelector + */ + protected $headerSelector; + + /** + * @var int Host index + */ + protected $hostIndex; + + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'sessionConfigGet' => [ + 'application/json', + ], + 'sessionConfigUpdate' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation sessionConfigGet + * + * @param AppType $app_type Application type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigGet'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\SessionConfigGetRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function sessionConfigGet($app_type = null, string $contentType = self::contentTypes['sessionConfigGet'][0]) + { + list($response) = $this->sessionConfigGetWithHttpInfo($app_type, $contentType); + return $response; + } + + /** + * Operation sessionConfigGetWithHttpInfo + * + * @param AppType $app_type Application type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigGet'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\SessionConfigGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function sessionConfigGetWithHttpInfo($app_type = null, string $contentType = self::contentTypes['sessionConfigGet'][0]) + { + $request = $this->sessionConfigGetRequest($app_type, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\SessionConfigGetRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\SessionConfigGetRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\SessionConfigGetRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\SessionConfigGetRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\SessionConfigGetRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sessionConfigGetAsync + * + * @param AppType $app_type Application type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sessionConfigGetAsync($app_type = null, string $contentType = self::contentTypes['sessionConfigGet'][0]) + { + return $this->sessionConfigGetAsyncWithHttpInfo($app_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sessionConfigGetAsyncWithHttpInfo + * + * @param AppType $app_type Application type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sessionConfigGetAsyncWithHttpInfo($app_type = null, string $contentType = self::contentTypes['sessionConfigGet'][0]) + { + $returnType = '\Corbado\Generated\Model\SessionConfigGetRsp'; + $request = $this->sessionConfigGetRequest($app_type, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sessionConfigGet' + * + * @param AppType $app_type Application type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sessionConfigGetRequest($app_type = null, string $contentType = self::contentTypes['sessionConfigGet'][0]) + { + + + + $resourcePath = '/v1/sessionConfig'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $app_type, + 'appType', // param base name + 'AppType', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sessionConfigUpdate + * + * @param \Corbado\Generated\Model\SessionConfigUpdateReq $session_config_update_req session_config_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigUpdate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function sessionConfigUpdate($session_config_update_req, string $contentType = self::contentTypes['sessionConfigUpdate'][0]) + { + list($response) = $this->sessionConfigUpdateWithHttpInfo($session_config_update_req, $contentType); + return $response; + } + + /** + * Operation sessionConfigUpdateWithHttpInfo + * + * @param \Corbado\Generated\Model\SessionConfigUpdateReq $session_config_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigUpdate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function sessionConfigUpdateWithHttpInfo($session_config_update_req, string $contentType = self::contentTypes['sessionConfigUpdate'][0]) + { + $request = $this->sessionConfigUpdateRequest($session_config_update_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\GenericRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\GenericRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\GenericRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\GenericRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sessionConfigUpdateAsync + * + * @param \Corbado\Generated\Model\SessionConfigUpdateReq $session_config_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sessionConfigUpdateAsync($session_config_update_req, string $contentType = self::contentTypes['sessionConfigUpdate'][0]) + { + return $this->sessionConfigUpdateAsyncWithHttpInfo($session_config_update_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sessionConfigUpdateAsyncWithHttpInfo + * + * @param \Corbado\Generated\Model\SessionConfigUpdateReq $session_config_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sessionConfigUpdateAsyncWithHttpInfo($session_config_update_req, string $contentType = self::contentTypes['sessionConfigUpdate'][0]) + { + $returnType = '\Corbado\Generated\Model\GenericRsp'; + $request = $this->sessionConfigUpdateRequest($session_config_update_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sessionConfigUpdate' + * + * @param \Corbado\Generated\Model\SessionConfigUpdateReq $session_config_update_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionConfigUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sessionConfigUpdateRequest($session_config_update_req, string $contentType = self::contentTypes['sessionConfigUpdate'][0]) + { + + // verify the required parameter 'session_config_update_req' is set + if ($session_config_update_req === null || (is_array($session_config_update_req) && count($session_config_update_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $session_config_update_req when calling sessionConfigUpdate' + ); + } + + + $resourcePath = '/v1/sessionConfig'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($session_config_update_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($session_config_update_req)); + } else { + $httpBody = $session_config_update_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Generated/Api/UserApi.php b/src/Generated/Api/UserApi.php index 29c6cfd..e286834 100644 --- a/src/Generated/Api/UserApi.php +++ b/src/Generated/Api/UserApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -78,6 +78,15 @@ class UserApi 'userCreate' => [ 'application/json', ], + 'userCustomLoginIdentifierCreate' => [ + 'application/json', + ], + 'userCustomLoginIdentifierDelete' => [ + 'application/json', + ], + 'userCustomLoginIdentifierGet' => [ + 'application/json', + ], 'userDelete' => [ 'application/json', ], @@ -116,7 +125,7 @@ class UserApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -173,7 +182,7 @@ public function getConfig() * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userAuthLogList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserAuthLogListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -194,7 +203,7 @@ public function userAuthLogList($remote_address = null, $user_agent = null, $sor * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userAuthLogList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserAuthLogListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -244,7 +253,19 @@ public function userAuthLogListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserAuthLogListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -259,7 +280,19 @@ public function userAuthLogListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -276,7 +309,19 @@ public function userAuthLogListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -402,79 +447,1170 @@ function ($exception) { * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function userAuthLogListRequest($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['userAuthLogList'][0]) + public function userAuthLogListRequest($remote_address = null, $user_agent = null, $sort = null, $filter = null, $page = 1, $page_size = 10, string $contentType = self::contentTypes['userAuthLogList'][0]) + { + + + + + + + + + $resourcePath = '/v1/userauthlogs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $remote_address, + 'remoteAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $user_agent, + 'userAgent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + 'filter[]', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'pageSize', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation userCreate + * + * @param \Corbado\Generated\Model\UserCreateReq $user_create_req user_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\UserCreateRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function userCreate($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + { + list($response) = $this->userCreateWithHttpInfo($user_create_req, $contentType); + return $response; + } + + /** + * Operation userCreateWithHttpInfo + * + * @param \Corbado\Generated\Model\UserCreateReq $user_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\UserCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function userCreateWithHttpInfo($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + { + $request = $this->userCreateRequest($user_create_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\UserCreateRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\UserCreateRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\UserCreateRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\UserCreateRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\UserCreateRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation userCreateAsync + * + * @param \Corbado\Generated\Model\UserCreateReq $user_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userCreateAsync($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + { + return $this->userCreateAsyncWithHttpInfo($user_create_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation userCreateAsyncWithHttpInfo + * + * @param \Corbado\Generated\Model\UserCreateReq $user_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userCreateAsyncWithHttpInfo($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + { + $returnType = '\Corbado\Generated\Model\UserCreateRsp'; + $request = $this->userCreateRequest($user_create_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'userCreate' + * + * @param \Corbado\Generated\Model\UserCreateReq $user_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function userCreateRequest($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + { + + // verify the required parameter 'user_create_req' is set + if ($user_create_req === null || (is_array($user_create_req) && count($user_create_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_create_req when calling userCreate' + ); + } + + + $resourcePath = '/v1/users'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($user_create_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_create_req)); + } else { + $httpBody = $user_create_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation userCustomLoginIdentifierCreate + * + * @param string $user_id ID of user (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierCreateReq $user_custom_login_identifier_create_req user_custom_login_identifier_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierCreate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\UserCustomLoginIdentifierCreateRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function userCustomLoginIdentifierCreate($user_id, $user_custom_login_identifier_create_req, string $contentType = self::contentTypes['userCustomLoginIdentifierCreate'][0]) + { + list($response) = $this->userCustomLoginIdentifierCreateWithHttpInfo($user_id, $user_custom_login_identifier_create_req, $contentType); + return $response; + } + + /** + * Operation userCustomLoginIdentifierCreateWithHttpInfo + * + * @param string $user_id ID of user (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierCreateReq $user_custom_login_identifier_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierCreate'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\UserCustomLoginIdentifierCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function userCustomLoginIdentifierCreateWithHttpInfo($user_id, $user_custom_login_identifier_create_req, string $contentType = self::contentTypes['userCustomLoginIdentifierCreate'][0]) + { + $request = $this->userCustomLoginIdentifierCreateRequest($user_id, $user_custom_login_identifier_create_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\UserCustomLoginIdentifierCreateRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\UserCustomLoginIdentifierCreateRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\UserCustomLoginIdentifierCreateRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\UserCustomLoginIdentifierCreateRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\UserCustomLoginIdentifierCreateRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation userCustomLoginIdentifierCreateAsync + * + * @param string $user_id ID of user (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierCreateReq $user_custom_login_identifier_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userCustomLoginIdentifierCreateAsync($user_id, $user_custom_login_identifier_create_req, string $contentType = self::contentTypes['userCustomLoginIdentifierCreate'][0]) + { + return $this->userCustomLoginIdentifierCreateAsyncWithHttpInfo($user_id, $user_custom_login_identifier_create_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation userCustomLoginIdentifierCreateAsyncWithHttpInfo + * + * @param string $user_id ID of user (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierCreateReq $user_custom_login_identifier_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userCustomLoginIdentifierCreateAsyncWithHttpInfo($user_id, $user_custom_login_identifier_create_req, string $contentType = self::contentTypes['userCustomLoginIdentifierCreate'][0]) + { + $returnType = '\Corbado\Generated\Model\UserCustomLoginIdentifierCreateRsp'; + $request = $this->userCustomLoginIdentifierCreateRequest($user_id, $user_custom_login_identifier_create_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'userCustomLoginIdentifierCreate' + * + * @param string $user_id ID of user (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierCreateReq $user_custom_login_identifier_create_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function userCustomLoginIdentifierCreateRequest($user_id, $user_custom_login_identifier_create_req, string $contentType = self::contentTypes['userCustomLoginIdentifierCreate'][0]) + { + + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling userCustomLoginIdentifierCreate' + ); + } + + // verify the required parameter 'user_custom_login_identifier_create_req' is set + if ($user_custom_login_identifier_create_req === null || (is_array($user_custom_login_identifier_create_req) && count($user_custom_login_identifier_create_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_custom_login_identifier_create_req when calling userCustomLoginIdentifierCreate' + ); + } + + + $resourcePath = '/v1/users/{userID}/customLoginIdentifiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'userID' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($user_custom_login_identifier_create_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_custom_login_identifier_create_req)); + } else { + $httpBody = $user_custom_login_identifier_create_req; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-Corbado-ProjectID'); + if ($apiKey !== null) { + $headers['X-Corbado-ProjectID'] = $apiKey; + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation userCustomLoginIdentifierDelete + * + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierDeleteReq $user_custom_login_identifier_delete_req user_custom_login_identifier_delete_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierDelete'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp + */ + public function userCustomLoginIdentifierDelete($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, string $contentType = self::contentTypes['userCustomLoginIdentifierDelete'][0]) + { + list($response) = $this->userCustomLoginIdentifierDeleteWithHttpInfo($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, $contentType); + return $response; + } + + /** + * Operation userCustomLoginIdentifierDeleteWithHttpInfo + * + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierDeleteReq $user_custom_login_identifier_delete_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierDelete'] to see the possible values for this operation + * + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + */ + public function userCustomLoginIdentifierDeleteWithHttpInfo($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, string $contentType = self::contentTypes['userCustomLoginIdentifierDelete'][0]) + { + $request = $this->userCustomLoginIdentifierDeleteRequest($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Corbado\Generated\Model\GenericRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\GenericRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Corbado\Generated\Model\ErrorRsp' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\ErrorRsp', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Corbado\Generated\Model\GenericRsp'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\GenericRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Corbado\Generated\Model\ErrorRsp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation userCustomLoginIdentifierDeleteAsync + * + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierDeleteReq $user_custom_login_identifier_delete_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userCustomLoginIdentifierDeleteAsync($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, string $contentType = self::contentTypes['userCustomLoginIdentifierDelete'][0]) + { + return $this->userCustomLoginIdentifierDeleteAsyncWithHttpInfo($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation userCustomLoginIdentifierDeleteAsyncWithHttpInfo + * + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierDeleteReq $user_custom_login_identifier_delete_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userCustomLoginIdentifierDeleteAsyncWithHttpInfo($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, string $contentType = self::contentTypes['userCustomLoginIdentifierDelete'][0]) + { + $returnType = '\Corbado\Generated\Model\GenericRsp'; + $request = $this->userCustomLoginIdentifierDeleteRequest($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'userCustomLoginIdentifierDelete' + * + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierDeleteReq $user_custom_login_identifier_delete_req (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function userCustomLoginIdentifierDeleteRequest($user_id, $custom_login_identifier_id, $user_custom_login_identifier_delete_req, string $contentType = self::contentTypes['userCustomLoginIdentifierDelete'][0]) { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling userCustomLoginIdentifierDelete' + ); + } + // verify the required parameter 'custom_login_identifier_id' is set + if ($custom_login_identifier_id === null || (is_array($custom_login_identifier_id) && count($custom_login_identifier_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $custom_login_identifier_id when calling userCustomLoginIdentifierDelete' + ); + } + // verify the required parameter 'user_custom_login_identifier_delete_req' is set + if ($user_custom_login_identifier_delete_req === null || (is_array($user_custom_login_identifier_delete_req) && count($user_custom_login_identifier_delete_req) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_custom_login_identifier_delete_req when calling userCustomLoginIdentifierDelete' + ); + } - - - - $resourcePath = '/v1/userauthlogs'; + $resourcePath = '/v1/users/{userID}/customLoginIdentifiers/{customLoginIdentifierID}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $remote_address, - 'remoteAddress', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $user_agent, - 'userAgent', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $sort, - 'sort', // param base name - 'string', // openApiType - '', // style - false, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $filter, - 'filter[]', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $page, - 'page', // param base name - 'integer', // openApiType - '', // style - false, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $page_size, - 'pageSize', // param base name - 'integer', // openApiType - '', // style - false, // explode - false // required - ) ?? []); + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'userID' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + // path params + if ($custom_login_identifier_id !== null) { + $resourcePath = str_replace( + '{' . 'customLoginIdentifierID' . '}', + ObjectSerializer::toPathValue($custom_login_identifier_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -484,7 +1620,14 @@ public function userAuthLogListRequest($remote_address = null, $user_agent = nul ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($user_custom_login_identifier_delete_req)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_custom_login_identifier_delete_req)); + } else { + $httpBody = $user_custom_login_identifier_delete_req; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -536,7 +1679,7 @@ public function userAuthLogListRequest($remote_address = null, $user_agent = nul $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'DELETE', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -544,34 +1687,40 @@ public function userAuthLogListRequest($remote_address = null, $user_agent = nul } /** - * Operation userCreate + * Operation userCustomLoginIdentifierGet * - * @param \Corbado\Generated\Model\UserCreateReq $user_create_req user_create_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \Corbado\Generated\Model\UserCreateRsp|\Corbado\Generated\Model\ErrorRsp + * @return \Corbado\Generated\Model\UserCustomLoginIdentifierGetRsp|\Corbado\Generated\Model\ErrorRsp */ - public function userCreate($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + public function userCustomLoginIdentifierGet($user_id, $custom_login_identifier_id, $remote_address = null, $user_agent = null, string $contentType = self::contentTypes['userCustomLoginIdentifierGet'][0]) { - list($response) = $this->userCreateWithHttpInfo($user_create_req, $contentType); + list($response) = $this->userCustomLoginIdentifierGetWithHttpInfo($user_id, $custom_login_identifier_id, $remote_address, $user_agent, $contentType); return $response; } /** - * Operation userCreateWithHttpInfo + * Operation userCustomLoginIdentifierGetWithHttpInfo * - * @param \Corbado\Generated\Model\UserCreateReq $user_create_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \Corbado\Generated\Model\UserCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) + * @return array of \Corbado\Generated\Model\UserCustomLoginIdentifierGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ - public function userCreateWithHttpInfo($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + public function userCustomLoginIdentifierGetWithHttpInfo($user_id, $custom_login_identifier_id, $remote_address = null, $user_agent = null, string $contentType = self::contentTypes['userCustomLoginIdentifierGet'][0]) { - $request = $this->userCreateRequest($user_create_req, $contentType); + $request = $this->userCustomLoginIdentifierGetRequest($user_id, $custom_login_identifier_id, $remote_address, $user_agent, $contentType); try { $options = $this->createHttpClientOption(); @@ -610,17 +1759,29 @@ public function userCreateWithHttpInfo($user_create_req, string $contentType = s switch($statusCode) { case 200: - if ('\Corbado\Generated\Model\UserCreateRsp' === '\SplFileObject') { + if ('\Corbado\Generated\Model\UserCustomLoginIdentifierGetRsp' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Corbado\Generated\Model\UserCreateRsp' !== 'string') { - $content = json_decode($content); + if ('\Corbado\Generated\Model\UserCustomLoginIdentifierGetRsp' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } return [ - ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\UserCreateRsp', []), + ObjectSerializer::deserialize($content, '\Corbado\Generated\Model\UserCustomLoginIdentifierGetRsp', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -630,7 +1791,19 @@ public function userCreateWithHttpInfo($user_create_req, string $contentType = s } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -641,13 +1814,25 @@ public function userCreateWithHttpInfo($user_create_req, string $contentType = s ]; } - $returnType = '\Corbado\Generated\Model\UserCreateRsp'; + $returnType = '\Corbado\Generated\Model\UserCustomLoginIdentifierGetRsp'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -662,7 +1847,7 @@ public function userCreateWithHttpInfo($user_create_req, string $contentType = s case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Corbado\Generated\Model\UserCreateRsp', + '\Corbado\Generated\Model\UserCustomLoginIdentifierGetRsp', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -681,17 +1866,20 @@ public function userCreateWithHttpInfo($user_create_req, string $contentType = s } /** - * Operation userCreateAsync + * Operation userCustomLoginIdentifierGetAsync * - * @param \Corbado\Generated\Model\UserCreateReq $user_create_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function userCreateAsync($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + public function userCustomLoginIdentifierGetAsync($user_id, $custom_login_identifier_id, $remote_address = null, $user_agent = null, string $contentType = self::contentTypes['userCustomLoginIdentifierGet'][0]) { - return $this->userCreateAsyncWithHttpInfo($user_create_req, $contentType) + return $this->userCustomLoginIdentifierGetAsyncWithHttpInfo($user_id, $custom_login_identifier_id, $remote_address, $user_agent, $contentType) ->then( function ($response) { return $response[0]; @@ -700,18 +1888,21 @@ function ($response) { } /** - * Operation userCreateAsyncWithHttpInfo + * Operation userCustomLoginIdentifierGetAsyncWithHttpInfo * - * @param \Corbado\Generated\Model\UserCreateReq $user_create_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function userCreateAsyncWithHttpInfo($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + public function userCustomLoginIdentifierGetAsyncWithHttpInfo($user_id, $custom_login_identifier_id, $remote_address = null, $user_agent = null, string $contentType = self::contentTypes['userCustomLoginIdentifierGet'][0]) { - $returnType = '\Corbado\Generated\Model\UserCreateRsp'; - $request = $this->userCreateRequest($user_create_req, $contentType); + $returnType = '\Corbado\Generated\Model\UserCustomLoginIdentifierGetRsp'; + $request = $this->userCustomLoginIdentifierGetRequest($user_id, $custom_login_identifier_id, $remote_address, $user_agent, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -750,34 +1941,80 @@ function ($exception) { } /** - * Create request for operation 'userCreate' + * Create request for operation 'userCustomLoginIdentifierGet' * - * @param \Corbado\Generated\Model\UserCreateReq $user_create_req (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCreate'] to see the possible values for this operation + * @param string $user_id ID of user (required) + * @param string $custom_login_identifier_id ID of custom login identifier (required) + * @param string $remote_address Client's remote address (optional) + * @param string $user_agent Client's user agent (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userCustomLoginIdentifierGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function userCreateRequest($user_create_req, string $contentType = self::contentTypes['userCreate'][0]) + public function userCustomLoginIdentifierGetRequest($user_id, $custom_login_identifier_id, $remote_address = null, $user_agent = null, string $contentType = self::contentTypes['userCustomLoginIdentifierGet'][0]) { - // verify the required parameter 'user_create_req' is set - if ($user_create_req === null || (is_array($user_create_req) && count($user_create_req) === 0)) { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $user_create_req when calling userCreate' + 'Missing the required parameter $user_id when calling userCustomLoginIdentifierGet' + ); + } + + // verify the required parameter 'custom_login_identifier_id' is set + if ($custom_login_identifier_id === null || (is_array($custom_login_identifier_id) && count($custom_login_identifier_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $custom_login_identifier_id when calling userCustomLoginIdentifierGet' ); } - $resourcePath = '/v1/users'; + + + $resourcePath = '/v1/users/{userID}/customLoginIdentifiers/{customLoginIdentifierID}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $remote_address, + 'remoteAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $user_agent, + 'userAgent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'userID' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + // path params + if ($custom_login_identifier_id !== null) { + $resourcePath = str_replace( + '{' . 'customLoginIdentifierID' . '}', + ObjectSerializer::toPathValue($custom_login_identifier_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -787,14 +2024,7 @@ public function userCreateRequest($user_create_req, string $contentType = self:: ); // for model (json/xml) - if (isset($user_create_req)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_create_req)); - } else { - $httpBody = $user_create_req; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -846,7 +2076,7 @@ public function userCreateRequest($user_create_req, string $contentType = self:: $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -860,7 +2090,7 @@ public function userCreateRequest($user_create_req, string $contentType = self:: * @param \Corbado\Generated\Model\UserDeleteReq $user_delete_req user_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -877,7 +2107,7 @@ public function userDelete($user_id, $user_delete_req, string $contentType = sel * @param \Corbado\Generated\Model\UserDeleteReq $user_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -927,7 +2157,19 @@ public function userDeleteWithHttpInfo($user_id, $user_delete_req, string $conte } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -942,7 +2184,19 @@ public function userDeleteWithHttpInfo($user_id, $user_delete_req, string $conte } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -959,7 +2213,19 @@ public function userDeleteWithHttpInfo($user_id, $user_delete_req, string $conte } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1195,7 +2461,7 @@ public function userDeleteRequest($user_id, $user_delete_req, string $contentTyp * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userDeviceList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserDeviceListRsp */ @@ -1217,7 +2483,7 @@ public function userDeviceList($user_id, $remote_address = null, $user_agent = n * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userDeviceList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserDeviceListRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1267,7 +2533,19 @@ public function userDeviceListWithHttpInfo($user_id, $remote_address = null, $us } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserDeviceListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1284,7 +2562,19 @@ public function userDeviceListWithHttpInfo($user_id, $remote_address = null, $us } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1452,8 +2742,8 @@ public function userDeviceListRequest($user_id, $remote_address = null, $user_ag $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1470,8 +2760,8 @@ public function userDeviceListRequest($user_id, $remote_address = null, $user_ag $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -1479,8 +2769,8 @@ public function userDeviceListRequest($user_id, $remote_address = null, $user_ag $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); @@ -1568,7 +2858,7 @@ public function userDeviceListRequest($user_id, $remote_address = null, $user_ag * @param \Corbado\Generated\Model\UserEmailCreateReq $user_email_create_req user_email_create_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userEmailCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserEmailCreateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -1585,7 +2875,7 @@ public function userEmailCreate($user_id, $user_email_create_req, string $conten * @param \Corbado\Generated\Model\UserEmailCreateReq $user_email_create_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userEmailCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserEmailCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1635,7 +2925,19 @@ public function userEmailCreateWithHttpInfo($user_id, $user_email_create_req, st } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserEmailCreateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1650,7 +2952,19 @@ public function userEmailCreateWithHttpInfo($user_id, $user_email_create_req, st } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1667,7 +2981,19 @@ public function userEmailCreateWithHttpInfo($user_id, $user_email_create_req, st } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1899,7 +3225,7 @@ public function userEmailCreateRequest($user_id, $user_email_create_req, string * @param \Corbado\Generated\Model\UserEmailDeleteReq $user_email_delete_req user_email_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userEmailDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -1917,7 +3243,7 @@ public function userEmailDelete($user_id, $email_id, $user_email_delete_req, str * @param \Corbado\Generated\Model\UserEmailDeleteReq $user_email_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userEmailDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -1967,7 +3293,19 @@ public function userEmailDeleteWithHttpInfo($user_id, $email_id, $user_email_del } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1982,7 +3320,19 @@ public function userEmailDeleteWithHttpInfo($user_id, $email_id, $user_email_del } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1999,7 +3349,19 @@ public function userEmailDeleteWithHttpInfo($user_id, $email_id, $user_email_del } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2250,7 +3612,7 @@ public function userEmailDeleteRequest($user_id, $email_id, $user_email_delete_r * @param string $user_agent Client's user agent (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userEmailGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserEmailGetRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -2269,7 +3631,7 @@ public function userEmailGet($user_id, $email_id, $remote_address = null, $user_ * @param string $user_agent Client's user agent (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userEmailGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserEmailGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -2319,7 +3681,19 @@ public function userEmailGetWithHttpInfo($user_id, $email_id, $remote_address = } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserEmailGetRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2334,7 +3708,19 @@ public function userEmailGetWithHttpInfo($user_id, $email_id, $remote_address = } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2351,7 +3737,19 @@ public function userEmailGetWithHttpInfo($user_id, $email_id, $remote_address = } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2610,7 +4008,7 @@ public function userEmailGetRequest($user_id, $email_id, $remote_address = null, * @param string $user_agent Client's user agent (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserGetRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -2628,7 +4026,7 @@ public function userGet($user_id, $remote_address = null, $user_agent = null, st * @param string $user_agent Client's user agent (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -2678,7 +4076,19 @@ public function userGetWithHttpInfo($user_id, $remote_address = null, $user_agen } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserGetRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2693,7 +4103,19 @@ public function userGetWithHttpInfo($user_id, $remote_address = null, $user_agen } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2710,7 +4132,19 @@ public function userGetWithHttpInfo($user_id, $remote_address = null, $user_agen } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -2954,7 +4388,7 @@ public function userGetRequest($user_id, $remote_address = null, $user_agent = n * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -2975,7 +4409,7 @@ public function userList($remote_address = null, $user_agent = null, $sort = nul * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -3025,7 +4459,19 @@ public function userListWithHttpInfo($remote_address = null, $user_agent = null, } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3040,7 +4486,19 @@ public function userListWithHttpInfo($remote_address = null, $user_agent = null, } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3057,7 +4515,19 @@ public function userListWithHttpInfo($remote_address = null, $user_agent = null, } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3223,8 +4693,8 @@ public function userListRequest($remote_address = null, $user_agent = null, $sor $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -3241,8 +4711,8 @@ public function userListRequest($remote_address = null, $user_agent = null, $sor $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -3250,8 +4720,8 @@ public function userListRequest($remote_address = null, $user_agent = null, $sor $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); @@ -3331,7 +4801,7 @@ public function userListRequest($remote_address = null, $user_agent = null, $sor * @param \Corbado\Generated\Model\UserPhoneNumberCreateReq $user_phone_number_create_req user_phone_number_create_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPhoneNumberCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserPhoneNumberCreateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -3348,7 +4818,7 @@ public function userPhoneNumberCreate($user_id, $user_phone_number_create_req, s * @param \Corbado\Generated\Model\UserPhoneNumberCreateReq $user_phone_number_create_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPhoneNumberCreate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserPhoneNumberCreateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -3398,7 +4868,19 @@ public function userPhoneNumberCreateWithHttpInfo($user_id, $user_phone_number_c } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserPhoneNumberCreateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3413,7 +4895,19 @@ public function userPhoneNumberCreateWithHttpInfo($user_id, $user_phone_number_c } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3430,7 +4924,19 @@ public function userPhoneNumberCreateWithHttpInfo($user_id, $user_phone_number_c } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3662,7 +5168,7 @@ public function userPhoneNumberCreateRequest($user_id, $user_phone_number_create * @param \Corbado\Generated\Model\UserPhoneNumberDeleteReq $user_phone_number_delete_req user_phone_number_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPhoneNumberDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -3680,7 +5186,7 @@ public function userPhoneNumberDelete($user_id, $phone_number_id, $user_phone_nu * @param \Corbado\Generated\Model\UserPhoneNumberDeleteReq $user_phone_number_delete_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPhoneNumberDelete'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\GenericRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -3730,7 +5236,19 @@ public function userPhoneNumberDeleteWithHttpInfo($user_id, $phone_number_id, $u } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\GenericRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3745,7 +5263,19 @@ public function userPhoneNumberDeleteWithHttpInfo($user_id, $phone_number_id, $u } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -3762,7 +5292,19 @@ public function userPhoneNumberDeleteWithHttpInfo($user_id, $phone_number_id, $u } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4013,7 +5555,7 @@ public function userPhoneNumberDeleteRequest($user_id, $phone_number_id, $user_p * @param string $user_agent Client's user agent (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPhoneNumberGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserPhoneNumberGetRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -4032,7 +5574,7 @@ public function userPhoneNumberGet($user_id, $phone_number_id, $remote_address = * @param string $user_agent Client's user agent (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPhoneNumberGet'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserPhoneNumberGetRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -4082,7 +5624,19 @@ public function userPhoneNumberGetWithHttpInfo($user_id, $phone_number_id, $remo } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserPhoneNumberGetRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4097,7 +5651,19 @@ public function userPhoneNumberGetWithHttpInfo($user_id, $phone_number_id, $remo } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4114,7 +5680,19 @@ public function userPhoneNumberGetWithHttpInfo($user_id, $phone_number_id, $remo } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4369,7 +5947,7 @@ public function userPhoneNumberGetRequest($user_id, $phone_number_id, $remote_ad * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserStatsListRsp */ @@ -4391,7 +5969,7 @@ public function userStatsList($granularity, $remote_address = null, $user_agent * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserStatsListRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -4441,7 +6019,19 @@ public function userStatsListWithHttpInfo($granularity, $remote_address = null, } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserStatsListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4458,7 +6048,19 @@ public function userStatsListWithHttpInfo($granularity, $remote_address = null, } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4626,8 +6228,8 @@ public function userStatsListRequest($granularity, $remote_address = null, $user $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -4644,8 +6246,8 @@ public function userStatsListRequest($granularity, $remote_address = null, $user $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -4653,8 +6255,8 @@ public function userStatsListRequest($granularity, $remote_address = null, $user $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -4743,7 +6345,7 @@ public function userStatsListRequest($granularity, $remote_address = null, $user * @param \Corbado\Generated\Model\UserUpdateReq $user_update_req user_update_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userUpdate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\UserUpdateRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -4760,7 +6362,7 @@ public function userUpdate($user_id, $user_update_req, string $contentType = sel * @param \Corbado\Generated\Model\UserUpdateReq $user_update_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userUpdate'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\UserUpdateRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -4810,7 +6412,19 @@ public function userUpdateWithHttpInfo($user_id, $user_update_req, string $conte } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\UserUpdateRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4825,7 +6439,19 @@ public function userUpdateWithHttpInfo($user_id, $user_update_req, string $conte } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -4842,7 +6468,19 @@ public function userUpdateWithHttpInfo($user_id, $user_update_req, string $conte } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/ValidationApi.php b/src/Generated/Api/ValidationApi.php index 0ad445f..0a54c38 100644 --- a/src/Generated/Api/ValidationApi.php +++ b/src/Generated/Api/ValidationApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -80,7 +80,7 @@ class ValidationApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -132,7 +132,7 @@ public function getConfig() * @param \Corbado\Generated\Model\ValidateEmailReq $validate_email_req validate_email_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\ValidateEmailRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -148,7 +148,7 @@ public function validateEmail($validate_email_req, string $contentType = self::c * @param \Corbado\Generated\Model\ValidateEmailReq $validate_email_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\ValidateEmailRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -198,7 +198,19 @@ public function validateEmailWithHttpInfo($validate_email_req, string $contentTy } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ValidateEmailRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -213,7 +225,19 @@ public function validateEmailWithHttpInfo($validate_email_req, string $contentTy } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -230,7 +254,19 @@ public function validateEmailWithHttpInfo($validate_email_req, string $contentTy } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -438,7 +474,7 @@ public function validateEmailRequest($validate_email_req, string $contentType = * @param \Corbado\Generated\Model\ValidatePhoneNumberReq $validate_phone_number_req validate_phone_number_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validatePhoneNumber'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\ValidatePhoneNumberRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -454,7 +490,7 @@ public function validatePhoneNumber($validate_phone_number_req, string $contentT * @param \Corbado\Generated\Model\ValidatePhoneNumberReq $validate_phone_number_req (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validatePhoneNumber'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\ValidatePhoneNumberRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -504,7 +540,19 @@ public function validatePhoneNumberWithHttpInfo($validate_phone_number_req, stri } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ValidatePhoneNumberRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -519,7 +567,19 @@ public function validatePhoneNumberWithHttpInfo($validate_phone_number_req, stri } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -536,7 +596,19 @@ public function validatePhoneNumberWithHttpInfo($validate_phone_number_req, stri } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Generated/Api/WebhookLogsApi.php b/src/Generated/Api/WebhookLogsApi.php index ef70a3c..94dbb61 100644 --- a/src/Generated/Api/WebhookLogsApi.php +++ b/src/Generated/Api/WebhookLogsApi.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -77,7 +77,7 @@ class WebhookLogsApi ], ]; -/** + /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector @@ -134,7 +134,7 @@ public function getConfig() * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webhookLogsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Corbado\Generated\Model\WebhookLogsListRsp|\Corbado\Generated\Model\ErrorRsp */ @@ -155,7 +155,7 @@ public function webhookLogsList($remote_address = null, $user_agent = null, $sor * @param int $page_size Number of items per page (optional, default to 10) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webhookLogsList'] to see the possible values for this operation * - * @throws \Corbado\Generated\ApiException on non-2xx response + * @throws \Corbado\Generated\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Corbado\Generated\Model\WebhookLogsListRsp|\Corbado\Generated\Model\ErrorRsp, HTTP status code, HTTP response headers (array of strings) */ @@ -205,7 +205,19 @@ public function webhookLogsListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\WebhookLogsListRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -220,7 +232,19 @@ public function webhookLogsListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ('\Corbado\Generated\Model\ErrorRsp' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -237,7 +261,19 @@ public function webhookLogsListWithHttpInfo($remote_address = null, $user_agent } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -403,8 +439,8 @@ public function webhookLogsListRequest($remote_address = null, $user_agent = nul $sort, 'sort', // param base name 'string', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -421,8 +457,8 @@ public function webhookLogsListRequest($remote_address = null, $user_agent = nul $page, 'page', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); // query params @@ -430,8 +466,8 @@ public function webhookLogsListRequest($remote_address = null, $user_agent = nul $page_size, 'pageSize', // param base name 'integer', // openApiType - '', // style - false, // explode + 'form', // style + true, // explode false // required ) ?? []); diff --git a/src/Generated/ApiException.php b/src/Generated/ApiException.php index 1e0c0a7..7ca137b 100644 --- a/src/Generated/ApiException.php +++ b/src/Generated/ApiException.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Configuration.php b/src/Generated/Configuration.php index 07bdd08..99c88fc 100644 --- a/src/Generated/Configuration.php +++ b/src/Generated/Configuration.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -94,7 +94,7 @@ class Configuration * * @var string */ - protected $host = 'https://api.corbado.com'; + protected $host = 'https://backendapi.corbado.io'; /** * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default @@ -210,7 +210,7 @@ public function getAccessToken() /** * Sets boolean format for query string. * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $booleanFormat Boolean format for query string * * @return $this */ @@ -473,7 +473,7 @@ public function getHostSettings() { return [ [ - "url" => "https://api.corbado.com", + "url" => "https://backendapi.corbado.io", "description" => "No description provided", ] ]; @@ -487,7 +487,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; diff --git a/src/Generated/HeaderSelector.php b/src/Generated/HeaderSelector.php index 2df2a95..0f0f37f 100644 --- a/src/Generated/HeaderSelector.php +++ b/src/Generated/HeaderSelector.php @@ -17,7 +17,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/AndroidAppConfigDeleteReq.php b/src/Generated/Model/AndroidAppConfigDeleteReq.php index 00b9317..f4e4898 100644 --- a/src/Generated/Model/AndroidAppConfigDeleteReq.php +++ b/src/Generated/Model/AndroidAppConfigDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class AndroidAppConfigDeleteReq implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/AndroidAppConfigItem.php b/src/Generated/Model/AndroidAppConfigItem.php index c1847e4..39f3464 100644 --- a/src/Generated/Model/AndroidAppConfigItem.php +++ b/src/Generated/Model/AndroidAppConfigItem.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -91,12 +91,12 @@ class AndroidAppConfigItem implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'id' => false, - 'project_id' => false, - 'package_name' => false, - 'fingerprint' => false, - 'base64_url' => false, - 'created' => false, - 'updated' => false + 'project_id' => false, + 'package_name' => false, + 'fingerprint' => false, + 'base64_url' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/AndroidAppConfigListRsp.php b/src/Generated/Model/AndroidAppConfigListRsp.php index 8210b38..084b301 100644 --- a/src/Generated/Model/AndroidAppConfigListRsp.php +++ b/src/Generated/Model/AndroidAppConfigListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class AndroidAppConfigListRsp implements ModelInterface, ArrayAccess, \JsonSeria */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'rows' => false, - 'paging' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'rows' => false, + 'paging' => false ]; /** diff --git a/src/Generated/Model/AndroidAppConfigSaveReq.php b/src/Generated/Model/AndroidAppConfigSaveReq.php index 2d4e338..f691b75 100644 --- a/src/Generated/Model/AndroidAppConfigSaveReq.php +++ b/src/Generated/Model/AndroidAppConfigSaveReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class AndroidAppConfigSaveReq implements ModelInterface, ArrayAccess, \JsonSeria */ protected static array $openAPINullables = [ 'package_name' => false, - 'fingerprint' => false, - 'request_id' => false, - 'client_info' => false + 'fingerprint' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/AndroidAppConfigSaveRsp.php b/src/Generated/Model/AndroidAppConfigSaveRsp.php index b9f4f5c..bd4906e 100644 --- a/src/Generated/Model/AndroidAppConfigSaveRsp.php +++ b/src/Generated/Model/AndroidAppConfigSaveRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -99,16 +99,16 @@ class AndroidAppConfigSaveRsp implements ModelInterface, ArrayAccess, \JsonSeria */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'id' => false, - 'project_id' => false, - 'package_name' => false, - 'fingerprint' => false, - 'base64_url' => false, - 'created' => false, - 'updated' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'id' => false, + 'project_id' => false, + 'package_name' => false, + 'fingerprint' => false, + 'base64_url' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/AndroidAppConfigUpdateReq.php b/src/Generated/Model/AndroidAppConfigUpdateReq.php index 50114af..21b0b5d 100644 --- a/src/Generated/Model/AndroidAppConfigUpdateReq.php +++ b/src/Generated/Model/AndroidAppConfigUpdateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class AndroidAppConfigUpdateReq implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'package_name' => false, - 'fingerprint' => false, - 'request_id' => false, - 'client_info' => false + 'fingerprint' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/AndroidAppConfigUpdateRsp.php b/src/Generated/Model/AndroidAppConfigUpdateRsp.php index 012d643..d90d60d 100644 --- a/src/Generated/Model/AndroidAppConfigUpdateRsp.php +++ b/src/Generated/Model/AndroidAppConfigUpdateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -99,16 +99,16 @@ class AndroidAppConfigUpdateRsp implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'id' => false, - 'project_id' => false, - 'package_name' => false, - 'fingerprint' => false, - 'base64_url' => false, - 'created' => false, - 'updated' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'id' => false, + 'project_id' => false, + 'package_name' => false, + 'fingerprint' => false, + 'base64_url' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/AppType.php b/src/Generated/Model/AppType.php new file mode 100644 index 0000000..5586adf --- /dev/null +++ b/src/Generated/Model/AppType.php @@ -0,0 +1,67 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; +use \Corbado\Generated\ObjectSerializer; + +/** + * AppType Class Doc Comment + * + * @category Class + * @description Application type + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class AppType +{ + /** + * Possible values of this enum + */ + public const _EMPTY = 'empty'; + + public const WEB = 'web'; + + public const NATIVE = 'native'; + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::_EMPTY, + self::WEB, + self::NATIVE + ]; + } +} + + diff --git a/src/Generated/Model/AssociationTokenCreateReq.php b/src/Generated/Model/AssociationTokenCreateReq.php new file mode 100644 index 0000000..cdcdad3 --- /dev/null +++ b/src/Generated/Model/AssociationTokenCreateReq.php @@ -0,0 +1,521 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * AssociationTokenCreateReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class AssociationTokenCreateReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'associationTokenCreateReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'login_identifier' => 'string', + 'login_identifier_type' => '\Corbado\Generated\Model\LoginIdentifierType', + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'login_identifier' => null, + 'login_identifier_type' => null, + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'login_identifier' => false, + 'login_identifier_type' => false, + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'login_identifier' => 'loginIdentifier', + 'login_identifier_type' => 'loginIdentifierType', + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'login_identifier' => 'setLoginIdentifier', + 'login_identifier_type' => 'setLoginIdentifierType', + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'login_identifier' => 'getLoginIdentifier', + 'login_identifier_type' => 'getLoginIdentifierType', + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('login_identifier', $data ?? [], null); + $this->setIfExists('login_identifier_type', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['login_identifier'] === null) { + $invalidProperties[] = "'login_identifier' can't be null"; + } + if ($this->container['login_identifier_type'] === null) { + $invalidProperties[] = "'login_identifier_type' can't be null"; + } + if ($this->container['client_info'] === null) { + $invalidProperties[] = "'client_info' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets login_identifier + * + * @return string + */ + public function getLoginIdentifier() + { + return $this->container['login_identifier']; + } + + /** + * Sets login_identifier + * + * @param string $login_identifier login_identifier + * + * @return self + */ + public function setLoginIdentifier($login_identifier) + { + if (is_null($login_identifier)) { + throw new \InvalidArgumentException('non-nullable login_identifier cannot be null'); + } + $this->container['login_identifier'] = $login_identifier; + + return $this; + } + + /** + * Gets login_identifier_type + * + * @return \Corbado\Generated\Model\LoginIdentifierType + */ + public function getLoginIdentifierType() + { + return $this->container['login_identifier_type']; + } + + /** + * Sets login_identifier_type + * + * @param \Corbado\Generated\Model\LoginIdentifierType $login_identifier_type login_identifier_type + * + * @return self + */ + public function setLoginIdentifierType($login_identifier_type) + { + if (is_null($login_identifier_type)) { + throw new \InvalidArgumentException('non-nullable login_identifier_type cannot be null'); + } + $this->container['login_identifier_type'] = $login_identifier_type; + + return $this; + } + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/AssociationTokenCreateRsp.php b/src/Generated/Model/AssociationTokenCreateRsp.php new file mode 100644 index 0000000..d9f6fd3 --- /dev/null +++ b/src/Generated/Model/AssociationTokenCreateRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * AssociationTokenCreateRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class AssociationTokenCreateRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'associationTokenCreateRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'data' => '\Corbado\Generated\Model\AssociationTokenCreateRspAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling AssociationTokenCreateRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling AssociationTokenCreateRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets data + * + * @return \Corbado\Generated\Model\AssociationTokenCreateRspAllOfData + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Corbado\Generated\Model\AssociationTokenCreateRspAllOfData $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/AssociationTokenCreateRspAllOfData.php b/src/Generated/Model/AssociationTokenCreateRspAllOfData.php new file mode 100644 index 0000000..f009b14 --- /dev/null +++ b/src/Generated/Model/AssociationTokenCreateRspAllOfData.php @@ -0,0 +1,444 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * AssociationTokenCreateRspAllOfData Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class AssociationTokenCreateRspAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'associationTokenCreateRsp_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'token' => 'string', + 'rejection_reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'token' => null, + 'rejection_reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'token' => false, + 'rejection_reason' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'token' => 'token', + 'rejection_reason' => 'rejectionReason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'token' => 'setToken', + 'rejection_reason' => 'setRejectionReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'token' => 'getToken', + 'rejection_reason' => 'getRejectionReason' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('rejection_reason', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets token + * + * @return string|null + */ + public function getToken() + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string|null $token token + * + * @return self + */ + public function setToken($token) + { + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + + /** + * Gets rejection_reason + * + * @return string|null + */ + public function getRejectionReason() + { + return $this->container['rejection_reason']; + } + + /** + * Sets rejection_reason + * + * @param string|null $rejection_reason rejection_reason + * + * @return self + */ + public function setRejectionReason($rejection_reason) + { + if (is_null($rejection_reason)) { + throw new \InvalidArgumentException('non-nullable rejection_reason cannot be null'); + } + $this->container['rejection_reason'] = $rejection_reason; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/AuthMethod.php b/src/Generated/Model/AuthMethod.php index 88693f8..549e9c6 100644 --- a/src/Generated/Model/AuthMethod.php +++ b/src/Generated/Model/AuthMethod.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/AuthMethodsListReq.php b/src/Generated/Model/AuthMethodsListReq.php index b87011d..55b3187 100644 --- a/src/Generated/Model/AuthMethodsListReq.php +++ b/src/Generated/Model/AuthMethodsListReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class AuthMethodsListReq implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'username' => false, - 'request_id' => false, - 'client_info' => false + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/AuthMethodsListRsp.php b/src/Generated/Model/AuthMethodsListRsp.php index a5c6b0f..417ba8d 100644 --- a/src/Generated/Model/AuthMethodsListRsp.php +++ b/src/Generated/Model/AuthMethodsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class AuthMethodsListRsp implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/AuthMethodsListRspAllOfData.php b/src/Generated/Model/AuthMethodsListRspAllOfData.php index 3f29c5a..996ae5f 100644 --- a/src/Generated/Model/AuthMethodsListRspAllOfData.php +++ b/src/Generated/Model/AuthMethodsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class AuthMethodsListRspAllOfData implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'select_methods' => false, - 'possible_methods' => false, - 'paging' => false + 'possible_methods' => false, + 'paging' => false ]; /** diff --git a/src/Generated/Model/AuthTokenValidateReq.php b/src/Generated/Model/AuthTokenValidateReq.php index 1fed010..05f85a4 100644 --- a/src/Generated/Model/AuthTokenValidateReq.php +++ b/src/Generated/Model/AuthTokenValidateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class AuthTokenValidateReq implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'token' => false, - 'request_id' => false, - 'client_info' => false + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/AuthTokenValidateRsp.php b/src/Generated/Model/AuthTokenValidateRsp.php index 134f89b..3263551 100644 --- a/src/Generated/Model/AuthTokenValidateRsp.php +++ b/src/Generated/Model/AuthTokenValidateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class AuthTokenValidateRsp implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/ClientInfo.php b/src/Generated/Model/ClientInfo.php index aa3a382..acde1e9 100644 --- a/src/Generated/Model/ClientInfo.php +++ b/src/Generated/Model/ClientInfo.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class ClientInfo implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'remote_address' => false, - 'user_agent' => false + 'user_agent' => false ]; /** diff --git a/src/Generated/Model/CustomLoginIdentifier.php b/src/Generated/Model/CustomLoginIdentifier.php new file mode 100644 index 0000000..ab77f8b --- /dev/null +++ b/src/Generated/Model/CustomLoginIdentifier.php @@ -0,0 +1,558 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * CustomLoginIdentifier Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class CustomLoginIdentifier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'customLoginIdentifier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'identifier' => 'string', + 'additional_data' => 'string', + 'created' => 'string', + 'updated' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'identifier' => null, + 'additional_data' => null, + 'created' => null, + 'updated' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'identifier' => false, + 'additional_data' => false, + 'created' => false, + 'updated' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'ID', + 'identifier' => 'identifier', + 'additional_data' => 'additionalData', + 'created' => 'created', + 'updated' => 'updated' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'identifier' => 'setIdentifier', + 'additional_data' => 'setAdditionalData', + 'created' => 'setCreated', + 'updated' => 'setUpdated' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'identifier' => 'getIdentifier', + 'additional_data' => 'getAdditionalData', + 'created' => 'getCreated', + 'updated' => 'getUpdated' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('identifier', $data ?? [], null); + $this->setIfExists('additional_data', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['identifier'] === null) { + $invalidProperties[] = "'identifier' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the phone number + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets identifier + * + * @return string + */ + public function getIdentifier() + { + return $this->container['identifier']; + } + + /** + * Sets identifier + * + * @param string $identifier identifier + * + * @return self + */ + public function setIdentifier($identifier) + { + if (is_null($identifier)) { + throw new \InvalidArgumentException('non-nullable identifier cannot be null'); + } + $this->container['identifier'] = $identifier; + + return $this; + } + + /** + * Gets additional_data + * + * @return string|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param string|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data) + { + if (is_null($additional_data)) { + throw new \InvalidArgumentException('non-nullable additional_data cannot be null'); + } + $this->container['additional_data'] = $additional_data; + + return $this; + } + + /** + * Gets created + * + * @return string + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param string $created Timestamp of when the entity was created in yyyy-MM-dd'T'HH:mm:ss format + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return string + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param string $updated Timestamp of when the entity was last updated in yyyy-MM-dd'T'HH:mm:ss format + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/Email.php b/src/Generated/Model/Email.php index 130e58f..14a19b8 100644 --- a/src/Generated/Model/Email.php +++ b/src/Generated/Model/Email.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class Email implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'email' => false, - 'created' => false, - 'updated' => false, - 'deleted' => false, - 'status' => false + 'email' => false, + 'created' => false, + 'updated' => false, + 'deleted' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/EmailCode.php b/src/Generated/Model/EmailCode.php new file mode 100644 index 0000000..323bf35 --- /dev/null +++ b/src/Generated/Model/EmailCode.php @@ -0,0 +1,703 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmailCode Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmailCode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emailCode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'email' => 'string', + 'user_full_name' => 'string', + 'additional_payload' => 'string', + 'created' => 'string', + 'updated' => 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'user_id' => null, + 'email' => null, + 'user_full_name' => null, + 'additional_payload' => null, + 'created' => null, + 'updated' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'email' => false, + 'user_full_name' => false, + 'additional_payload' => false, + 'created' => false, + 'updated' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'ID', + 'user_id' => 'userID', + 'email' => 'email', + 'user_full_name' => 'userFullName', + 'additional_payload' => 'additionalPayload', + 'created' => 'created', + 'updated' => 'updated', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'email' => 'setEmail', + 'user_full_name' => 'setUserFullName', + 'additional_payload' => 'setAdditionalPayload', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'email' => 'getEmail', + 'user_full_name' => 'getUserFullName', + 'additional_payload' => 'getAdditionalPayload', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_ACTIVE = 'active'; + public const STATUS_CONFIRMED = 'confirmed'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_ACTIVE, + self::STATUS_CONFIRMED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('user_full_name', $data ?? [], null); + $this->setIfExists('additional_payload', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + if ($this->container['additional_payload'] === null) { + $invalidProperties[] = "'additional_payload' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the email OTP + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id ID of the user + * + * @return self + */ + public function setUserId($user_id) + { + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email email + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets user_full_name + * + * @return string|null + */ + public function getUserFullName() + { + return $this->container['user_full_name']; + } + + /** + * Sets user_full_name + * + * @param string|null $user_full_name user_full_name + * + * @return self + */ + public function setUserFullName($user_full_name) + { + if (is_null($user_full_name)) { + throw new \InvalidArgumentException('non-nullable user_full_name cannot be null'); + } + $this->container['user_full_name'] = $user_full_name; + + return $this; + } + + /** + * Gets additional_payload + * + * @return string + */ + public function getAdditionalPayload() + { + return $this->container['additional_payload']; + } + + /** + * Sets additional_payload + * + * @param string $additional_payload Additional payload in JSON format + * + * @return self + */ + public function setAdditionalPayload($additional_payload) + { + if (is_null($additional_payload)) { + throw new \InvalidArgumentException('non-nullable additional_payload cannot be null'); + } + $this->container['additional_payload'] = $additional_payload; + + return $this; + } + + /** + * Gets created + * + * @return string + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param string $created Timestamp of when the entity was created in yyyy-MM-dd'T'HH:mm:ss format + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return string + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param string $updated Timestamp of when the entity was last updated in yyyy-MM-dd'T'HH:mm:ss format + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status values of an email OTP + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/EmailCodeGetRsp.php b/src/Generated/Model/EmailCodeGetRsp.php new file mode 100644 index 0000000..8b06a4e --- /dev/null +++ b/src/Generated/Model/EmailCodeGetRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmailCodeGetRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmailCodeGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emailCodeGetRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'data' => '\Corbado\Generated\Model\EmailCodeGetRspAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling EmailCodeGetRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling EmailCodeGetRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets data + * + * @return \Corbado\Generated\Model\EmailCodeGetRspAllOfData + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Corbado\Generated\Model\EmailCodeGetRspAllOfData $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/EmailCodeGetRspAllOfData.php b/src/Generated/Model/EmailCodeGetRspAllOfData.php new file mode 100644 index 0000000..a69123e --- /dev/null +++ b/src/Generated/Model/EmailCodeGetRspAllOfData.php @@ -0,0 +1,413 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmailCodeGetRspAllOfData Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmailCodeGetRspAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emailCodeGetRsp_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_code' => '\Corbado\Generated\Model\EmailCode' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email_code' => 'emailCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_code' => 'setEmailCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_code' => 'getEmailCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['email_code'] === null) { + $invalidProperties[] = "'email_code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email_code + * + * @return \Corbado\Generated\Model\EmailCode + */ + public function getEmailCode() + { + return $this->container['email_code']; + } + + /** + * Sets email_code + * + * @param \Corbado\Generated\Model\EmailCode $email_code email_code + * + * @return self + */ + public function setEmailCode($email_code) + { + if (is_null($email_code)) { + throw new \InvalidArgumentException('non-nullable email_code cannot be null'); + } + $this->container['email_code'] = $email_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/EmailCodeSendReq.php b/src/Generated/Model/EmailCodeSendReq.php new file mode 100644 index 0000000..1ba4491 --- /dev/null +++ b/src/Generated/Model/EmailCodeSendReq.php @@ -0,0 +1,654 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmailCodeSendReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmailCodeSendReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emailCodeSendReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email' => 'string', + 'create' => 'bool', + 'token_lifetime' => 'string', + 'user_full_name' => 'string', + 'template_name' => 'string', + 'additional_payload' => 'string', + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email' => null, + 'create' => null, + 'token_lifetime' => null, + 'user_full_name' => null, + 'template_name' => null, + 'additional_payload' => null, + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email' => false, + 'create' => false, + 'token_lifetime' => false, + 'user_full_name' => false, + 'template_name' => false, + 'additional_payload' => false, + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email' => 'email', + 'create' => 'create', + 'token_lifetime' => 'tokenLifetime', + 'user_full_name' => 'userFullName', + 'template_name' => 'templateName', + 'additional_payload' => 'additionalPayload', + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email' => 'setEmail', + 'create' => 'setCreate', + 'token_lifetime' => 'setTokenLifetime', + 'user_full_name' => 'setUserFullName', + 'template_name' => 'setTemplateName', + 'additional_payload' => 'setAdditionalPayload', + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email' => 'getEmail', + 'create' => 'getCreate', + 'token_lifetime' => 'getTokenLifetime', + 'user_full_name' => 'getUserFullName', + 'template_name' => 'getTemplateName', + 'additional_payload' => 'getAdditionalPayload', + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('create', $data ?? [], null); + $this->setIfExists('token_lifetime', $data ?? [], null); + $this->setIfExists('user_full_name', $data ?? [], null); + $this->setIfExists('template_name', $data ?? [], null); + $this->setIfExists('additional_payload', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + if ($this->container['create'] === null) { + $invalidProperties[] = "'create' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email + * + * @return string + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email Recipient email address + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets create + * + * @return bool + */ + public function getCreate() + { + return $this->container['create']; + } + + /** + * Sets create + * + * @param bool $create Defines if user email should be created if not found + * + * @return self + */ + public function setCreate($create) + { + if (is_null($create)) { + throw new \InvalidArgumentException('non-nullable create cannot be null'); + } + $this->container['create'] = $create; + + return $this; + } + + /** + * Gets token_lifetime + * + * @return string|null + */ + public function getTokenLifetime() + { + return $this->container['token_lifetime']; + } + + /** + * Sets token_lifetime + * + * @param string|null $token_lifetime Defines the lifetime of the token that needs to be validated + * + * @return self + */ + public function setTokenLifetime($token_lifetime) + { + if (is_null($token_lifetime)) { + throw new \InvalidArgumentException('non-nullable token_lifetime cannot be null'); + } + $this->container['token_lifetime'] = $token_lifetime; + + return $this; + } + + /** + * Gets user_full_name + * + * @return string|null + */ + public function getUserFullName() + { + return $this->container['user_full_name']; + } + + /** + * Sets user_full_name + * + * @param string|null $user_full_name Optional user's full name to be used if the user wasn't found and needs to be created first + * + * @return self + */ + public function setUserFullName($user_full_name) + { + if (is_null($user_full_name)) { + throw new \InvalidArgumentException('non-nullable user_full_name cannot be null'); + } + $this->container['user_full_name'] = $user_full_name; + + return $this; + } + + /** + * Gets template_name + * + * @return string|null + */ + public function getTemplateName() + { + return $this->container['template_name']; + } + + /** + * Sets template_name + * + * @param string|null $template_name Template name of email to send + * + * @return self + */ + public function setTemplateName($template_name) + { + if (is_null($template_name)) { + throw new \InvalidArgumentException('non-nullable template_name cannot be null'); + } + $this->container['template_name'] = $template_name; + + return $this; + } + + /** + * Gets additional_payload + * + * @return string|null + */ + public function getAdditionalPayload() + { + return $this->container['additional_payload']; + } + + /** + * Sets additional_payload + * + * @param string|null $additional_payload Additional payload in JSON format + * + * @return self + */ + public function setAdditionalPayload($additional_payload) + { + if (is_null($additional_payload)) { + throw new \InvalidArgumentException('non-nullable additional_payload cannot be null'); + } + $this->container['additional_payload'] = $additional_payload; + + return $this; + } + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo|null + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo|null $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/EmailCodeSendRsp.php b/src/Generated/Model/EmailCodeSendRsp.php new file mode 100644 index 0000000..291fa1b --- /dev/null +++ b/src/Generated/Model/EmailCodeSendRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmailCodeSendRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmailCodeSendRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emailCodeSendRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'data' => '\Corbado\Generated\Model\EmailCodeSendRspAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling EmailCodeSendRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling EmailCodeSendRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets data + * + * @return \Corbado\Generated\Model\EmailCodeSendRspAllOfData + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Corbado\Generated\Model\EmailCodeSendRspAllOfData $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/EmailCodeSendRspAllOfData.php b/src/Generated/Model/EmailCodeSendRspAllOfData.php new file mode 100644 index 0000000..916ebf1 --- /dev/null +++ b/src/Generated/Model/EmailCodeSendRspAllOfData.php @@ -0,0 +1,413 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmailCodeSendRspAllOfData Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmailCodeSendRspAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emailCodeSendRsp_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_code_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_code_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_code_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email_code_id' => 'emailCodeID' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_code_id' => 'setEmailCodeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_code_id' => 'getEmailCodeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email_code_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['email_code_id'] === null) { + $invalidProperties[] = "'email_code_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email_code_id + * + * @return string + */ + public function getEmailCodeId() + { + return $this->container['email_code_id']; + } + + /** + * Sets email_code_id + * + * @param string $email_code_id email_code_id + * + * @return self + */ + public function setEmailCodeId($email_code_id) + { + if (is_null($email_code_id)) { + throw new \InvalidArgumentException('non-nullable email_code_id cannot be null'); + } + $this->container['email_code_id'] = $email_code_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/EmailCodeValidateReq.php b/src/Generated/Model/EmailCodeValidateReq.php new file mode 100644 index 0000000..84a960a --- /dev/null +++ b/src/Generated/Model/EmailCodeValidateReq.php @@ -0,0 +1,515 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmailCodeValidateReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmailCodeValidateReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emailCodeValidateReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'create_login_token' => 'bool', + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'create_login_token' => null, + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => false, + 'create_login_token' => false, + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'code' => 'code', + 'create_login_token' => 'createLoginToken', + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'create_login_token' => 'setCreateLoginToken', + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'create_login_token' => 'getCreateLoginToken', + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('create_login_token', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return string + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code Email OTP to validate + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets create_login_token + * + * @return bool|null + */ + public function getCreateLoginToken() + { + return $this->container['create_login_token']; + } + + /** + * Sets create_login_token + * + * @param bool|null $create_login_token create_login_token + * + * @return self + */ + public function setCreateLoginToken($create_login_token) + { + if (is_null($create_login_token)) { + throw new \InvalidArgumentException('non-nullable create_login_token cannot be null'); + } + $this->container['create_login_token'] = $create_login_token; + + return $this; + } + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo|null + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo|null $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/EmailCodeValidateRsp.php b/src/Generated/Model/EmailCodeValidateRsp.php new file mode 100644 index 0000000..df5b59e --- /dev/null +++ b/src/Generated/Model/EmailCodeValidateRsp.php @@ -0,0 +1,719 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmailCodeValidateRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmailCodeValidateRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emailCodeValidateRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'additional_payload' => 'string', + 'user_id' => 'string', + 'user_full_name' => 'string', + 'user_email' => 'string', + 'login_token' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'additional_payload' => null, + 'user_id' => null, + 'user_full_name' => null, + 'user_email' => null, + 'login_token' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'additional_payload' => false, + 'user_id' => false, + 'user_full_name' => false, + 'user_email' => false, + 'login_token' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'additional_payload' => 'additionalPayload', + 'user_id' => 'userID', + 'user_full_name' => 'userFullName', + 'user_email' => 'userEmail', + 'login_token' => 'loginToken' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'additional_payload' => 'setAdditionalPayload', + 'user_id' => 'setUserId', + 'user_full_name' => 'setUserFullName', + 'user_email' => 'setUserEmail', + 'login_token' => 'setLoginToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'additional_payload' => 'getAdditionalPayload', + 'user_id' => 'getUserId', + 'user_full_name' => 'getUserFullName', + 'user_email' => 'getUserEmail', + 'login_token' => 'getLoginToken' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('additional_payload', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('user_full_name', $data ?? [], null); + $this->setIfExists('user_email', $data ?? [], null); + $this->setIfExists('login_token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['user_full_name'] === null) { + $invalidProperties[] = "'user_full_name' can't be null"; + } + if ($this->container['user_email'] === null) { + $invalidProperties[] = "'user_email' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling EmailCodeValidateRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling EmailCodeValidateRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets additional_payload + * + * @return string|null + */ + public function getAdditionalPayload() + { + return $this->container['additional_payload']; + } + + /** + * Sets additional_payload + * + * @param string|null $additional_payload Additional payload in JSON format + * + * @return self + */ + public function setAdditionalPayload($additional_payload) + { + if (is_null($additional_payload)) { + throw new \InvalidArgumentException('non-nullable additional_payload cannot be null'); + } + $this->container['additional_payload'] = $additional_payload; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id ID of the user + * + * @return self + */ + public function setUserId($user_id) + { + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets user_full_name + * + * @return string + */ + public function getUserFullName() + { + return $this->container['user_full_name']; + } + + /** + * Sets user_full_name + * + * @param string $user_full_name user_full_name + * + * @return self + */ + public function setUserFullName($user_full_name) + { + if (is_null($user_full_name)) { + throw new \InvalidArgumentException('non-nullable user_full_name cannot be null'); + } + $this->container['user_full_name'] = $user_full_name; + + return $this; + } + + /** + * Gets user_email + * + * @return string + */ + public function getUserEmail() + { + return $this->container['user_email']; + } + + /** + * Sets user_email + * + * @param string $user_email user_email + * + * @return self + */ + public function setUserEmail($user_email) + { + if (is_null($user_email)) { + throw new \InvalidArgumentException('non-nullable user_email cannot be null'); + } + $this->container['user_email'] = $user_email; + + return $this; + } + + /** + * Gets login_token + * + * @return string|null + */ + public function getLoginToken() + { + return $this->container['login_token']; + } + + /** + * Sets login_token + * + * @param string|null $login_token login_token + * + * @return self + */ + public function setLoginToken($login_token) + { + if (is_null($login_token)) { + throw new \InvalidArgumentException('non-nullable login_token cannot be null'); + } + $this->container['login_token'] = $login_token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/EmailLink.php b/src/Generated/Model/EmailLink.php index e9ac130..9ebb47c 100644 --- a/src/Generated/Model/EmailLink.php +++ b/src/Generated/Model/EmailLink.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class EmailLink implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'user_id' => false, - 'email' => false, - 'user_full_name' => false, - 'purpose' => false, - 'created' => false, - 'updated' => false, - 'status' => false, - 'additional_payload' => false + 'user_id' => false, + 'email' => false, + 'user_full_name' => false, + 'purpose' => false, + 'created' => false, + 'updated' => false, + 'status' => false, + 'additional_payload' => false ]; /** @@ -630,7 +630,7 @@ public function getAdditionalPayload() /** * Sets additional_payload * - * @param string $additional_payload Additional payload + * @param string $additional_payload Additional payload in JSON format * * @return self */ diff --git a/src/Generated/Model/EmailLinkGetRsp.php b/src/Generated/Model/EmailLinkGetRsp.php index 3dcf05b..e5d5a27 100644 --- a/src/Generated/Model/EmailLinkGetRsp.php +++ b/src/Generated/Model/EmailLinkGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class EmailLinkGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/EmailLinkGetRspAllOfData.php b/src/Generated/Model/EmailLinkGetRspAllOfData.php index d964c33..a1abff4 100644 --- a/src/Generated/Model/EmailLinkGetRspAllOfData.php +++ b/src/Generated/Model/EmailLinkGetRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/EmailLinkSendReq.php b/src/Generated/Model/EmailLinkSendReq.php index 8097448..875269c 100644 --- a/src/Generated/Model/EmailLinkSendReq.php +++ b/src/Generated/Model/EmailLinkSendReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -97,15 +97,15 @@ class EmailLinkSendReq implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'email' => false, - 'create' => false, - 'token_lifetime' => false, - 'user_full_name' => false, - 'template_name' => false, - 'purpose' => false, - 'redirect' => false, - 'additional_payload' => false, - 'request_id' => false, - 'client_info' => false + 'create' => false, + 'token_lifetime' => false, + 'user_full_name' => false, + 'template_name' => false, + 'purpose' => false, + 'redirect' => false, + 'additional_payload' => false, + 'request_id' => false, + 'client_info' => false ]; /** @@ -600,7 +600,7 @@ public function getAdditionalPayload() /** * Sets additional_payload * - * @param string|null $additional_payload Additional payload + * @param string|null $additional_payload Additional payload in JSON format * * @return self */ diff --git a/src/Generated/Model/EmailLinkSendRsp.php b/src/Generated/Model/EmailLinkSendRsp.php index ede934f..6672290 100644 --- a/src/Generated/Model/EmailLinkSendRsp.php +++ b/src/Generated/Model/EmailLinkSendRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class EmailLinkSendRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/EmailLinkSendRspAllOfData.php b/src/Generated/Model/EmailLinkSendRspAllOfData.php index fb7e9bd..68f311a 100644 --- a/src/Generated/Model/EmailLinkSendRspAllOfData.php +++ b/src/Generated/Model/EmailLinkSendRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/EmailLinkValidateRsp.php b/src/Generated/Model/EmailLinkValidateRsp.php index b7320d9..82ebfc6 100644 --- a/src/Generated/Model/EmailLinkValidateRsp.php +++ b/src/Generated/Model/EmailLinkValidateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class EmailLinkValidateRsp implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'additional_payload' => false, - 'user_id' => false, - 'user_full_name' => false, - 'user_email' => false, - 'login_token' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'additional_payload' => false, + 'user_id' => false, + 'user_full_name' => false, + 'user_email' => false, + 'login_token' => false ]; /** @@ -504,7 +504,7 @@ public function getAdditionalPayload() /** * Sets additional_payload * - * @param string|null $additional_payload additional_payload + * @param string|null $additional_payload Additional payload in JSON format * * @return self */ diff --git a/src/Generated/Model/EmailLinksDeleteReq.php b/src/Generated/Model/EmailLinksDeleteReq.php index 7fe9a24..2405911 100644 --- a/src/Generated/Model/EmailLinksDeleteReq.php +++ b/src/Generated/Model/EmailLinksDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class EmailLinksDeleteReq implements ModelInterface, ArrayAccess, \JsonSerializa */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/EmailLinksValidateReq.php b/src/Generated/Model/EmailLinksValidateReq.php index 557e053..309d506 100644 --- a/src/Generated/Model/EmailLinksValidateReq.php +++ b/src/Generated/Model/EmailLinksValidateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class EmailLinksValidateReq implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'token' => false, - 'create_login_token' => false, - 'request_id' => false, - 'client_info' => false + 'create_login_token' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/EmailTemplateCreateReq.php b/src/Generated/Model/EmailTemplateCreateReq.php index 47275dc..7918ba4 100644 --- a/src/Generated/Model/EmailTemplateCreateReq.php +++ b/src/Generated/Model/EmailTemplateCreateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -58,6 +58,7 @@ class EmailTemplateCreateReq implements ModelInterface, ArrayAccess, \JsonSerial * @var string[] */ protected static $openAPITypes = [ + 'lang' => 'string', 'type' => 'string', 'name' => 'string', 'subject' => 'string', @@ -84,6 +85,7 @@ class EmailTemplateCreateReq implements ModelInterface, ArrayAccess, \JsonSerial * @psalm-var array */ protected static $openAPIFormats = [ + 'lang' => null, 'type' => null, 'name' => null, 'subject' => null, @@ -108,22 +110,23 @@ class EmailTemplateCreateReq implements ModelInterface, ArrayAccess, \JsonSerial * @var boolean[] */ protected static array $openAPINullables = [ + 'lang' => false, 'type' => false, - 'name' => false, - 'subject' => false, - 'action' => false, - 'plain_text_body' => false, - 'html_text_title' => false, - 'html_text_body' => false, - 'html_text_button' => false, - 'html_color_font' => false, - 'html_color_background_outer' => false, - 'html_color_background_inner' => false, - 'html_color_button' => false, - 'html_color_button_font' => false, - 'is_default' => false, - 'request_id' => false, - 'client_info' => false + 'name' => false, + 'subject' => false, + 'action' => false, + 'plain_text_body' => false, + 'html_text_title' => false, + 'html_text_body' => false, + 'html_text_button' => false, + 'html_color_font' => false, + 'html_color_background_outer' => false, + 'html_color_background_inner' => false, + 'html_color_button' => false, + 'html_color_button_font' => false, + 'is_default' => false, + 'request_id' => false, + 'client_info' => false ]; /** @@ -212,6 +215,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'lang' => 'lang', 'type' => 'type', 'name' => 'name', 'subject' => 'subject', @@ -236,6 +240,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'lang' => 'setLang', 'type' => 'setType', 'name' => 'setName', 'subject' => 'setSubject', @@ -260,6 +265,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'lang' => 'getLang', 'type' => 'getType', 'name' => 'getName', 'subject' => 'getSubject', @@ -319,9 +325,28 @@ public function getModelName() return self::$openAPIModelName; } + public const LANG_EN = 'en'; + public const LANG_DE = 'de'; + public const LANG_FR = 'fr'; public const TYPE_EMAIL_LINK = 'email_link'; + public const TYPE_EMAIL_LINK_LOGIN = 'email_link_login'; public const TYPE_LOGIN_NOTIFICATION = 'login_notification'; public const TYPE_PASSKEY_NOTIFICATION = 'passkey_notification'; + public const TYPE_EMAIL_CODE = 'email_code'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLangAllowableValues() + { + return [ + self::LANG_EN, + self::LANG_DE, + self::LANG_FR, + ]; + } /** * Gets allowable values of the enum @@ -332,8 +357,10 @@ public function getTypeAllowableValues() { return [ self::TYPE_EMAIL_LINK, + self::TYPE_EMAIL_LINK_LOGIN, self::TYPE_LOGIN_NOTIFICATION, self::TYPE_PASSKEY_NOTIFICATION, + self::TYPE_EMAIL_CODE, ]; } @@ -352,6 +379,7 @@ public function getTypeAllowableValues() */ public function __construct(array $data = null) { + $this->setIfExists('lang', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('subject', $data ?? [], null); @@ -397,6 +425,18 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['lang'] === null) { + $invalidProperties[] = "'lang' can't be null"; + } + $allowedValues = $this->getLangAllowableValues(); + if (!is_null($this->container['lang']) && !in_array($this->container['lang'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'lang', must be one of '%s'", + $this->container['lang'], + implode("', '", $allowedValues) + ); + } + if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } @@ -460,6 +500,43 @@ public function valid() } + /** + * Gets lang + * + * @return string + */ + public function getLang() + { + return $this->container['lang']; + } + + /** + * Sets lang + * + * @param string $lang lang + * + * @return self + */ + public function setLang($lang) + { + if (is_null($lang)) { + throw new \InvalidArgumentException('non-nullable lang cannot be null'); + } + $allowedValues = $this->getLangAllowableValues(); + if (!in_array($lang, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'lang', must be one of '%s'", + $lang, + implode("', '", $allowedValues) + ) + ); + } + $this->container['lang'] = $lang; + + return $this; + } + /** * Gets type * diff --git a/src/Generated/Model/EmailTemplateCreateRsp.php b/src/Generated/Model/EmailTemplateCreateRsp.php index 205ad35..7b4e698 100644 --- a/src/Generated/Model/EmailTemplateCreateRsp.php +++ b/src/Generated/Model/EmailTemplateCreateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class EmailTemplateCreateRsp implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/EmailTemplateCreateRspAllOfData.php b/src/Generated/Model/EmailTemplateCreateRspAllOfData.php index ae26f7b..6e4084a 100644 --- a/src/Generated/Model/EmailTemplateCreateRspAllOfData.php +++ b/src/Generated/Model/EmailTemplateCreateRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/EmailTemplateDeleteReq.php b/src/Generated/Model/EmailTemplateDeleteReq.php index 87510e7..3c4ee57 100644 --- a/src/Generated/Model/EmailTemplateDeleteReq.php +++ b/src/Generated/Model/EmailTemplateDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class EmailTemplateDeleteReq implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/EmailValidationResult.php b/src/Generated/Model/EmailValidationResult.php index 71a903c..f71fa27 100644 --- a/src/Generated/Model/EmailValidationResult.php +++ b/src/Generated/Model/EmailValidationResult.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class EmailValidationResult implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'is_valid' => false, - 'validation_code' => false, - 'suggestion' => false, - 'email' => false + 'validation_code' => false, + 'suggestion' => false, + 'email' => false ]; /** diff --git a/src/Generated/Model/EmptyReq.php b/src/Generated/Model/EmptyReq.php new file mode 100644 index 0000000..eb063cb --- /dev/null +++ b/src/Generated/Model/EmptyReq.php @@ -0,0 +1,444 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * EmptyReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class EmptyReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'emptyReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo|null + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo|null $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/ErrorRsp.php b/src/Generated/Model/ErrorRsp.php index 88f3848..5d5b5c1 100644 --- a/src/Generated/Model/ErrorRsp.php +++ b/src/Generated/Model/ErrorRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -62,6 +62,7 @@ class ErrorRsp implements ModelInterface, ArrayAccess, \JsonSerializable 'message' => 'string', 'request_data' => '\Corbado\Generated\Model\RequestData', 'runtime' => 'float', + 'data' => 'object', 'error' => '\Corbado\Generated\Model\ErrorRspAllOfError' ]; @@ -77,6 +78,7 @@ class ErrorRsp implements ModelInterface, ArrayAccess, \JsonSerializable 'message' => null, 'request_data' => null, 'runtime' => 'float', + 'data' => null, 'error' => null ]; @@ -87,10 +89,11 @@ class ErrorRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'error' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false, + 'error' => false ]; /** @@ -183,6 +186,7 @@ public function isNullableSetToNull(string $property): bool 'message' => 'message', 'request_data' => 'requestData', 'runtime' => 'runtime', + 'data' => 'data', 'error' => 'error' ]; @@ -196,6 +200,7 @@ public function isNullableSetToNull(string $property): bool 'message' => 'setMessage', 'request_data' => 'setRequestData', 'runtime' => 'setRuntime', + 'data' => 'setData', 'error' => 'setError' ]; @@ -209,6 +214,7 @@ public function isNullableSetToNull(string $property): bool 'message' => 'getMessage', 'request_data' => 'getRequestData', 'runtime' => 'getRuntime', + 'data' => 'getData', 'error' => 'getError' ]; @@ -273,6 +279,7 @@ public function __construct(array $data = null) $this->setIfExists('message', $data ?? [], null); $this->setIfExists('request_data', $data ?? [], null); $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); $this->setIfExists('error', $data ?? [], null); } @@ -457,6 +464,33 @@ public function setRuntime($runtime) return $this; } + /** + * Gets data + * + * @return object|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** * Gets error * diff --git a/src/Generated/Model/ErrorRspAllOfError.php b/src/Generated/Model/ErrorRspAllOfError.php index 82b80dc..57b83f5 100644 --- a/src/Generated/Model/ErrorRspAllOfError.php +++ b/src/Generated/Model/ErrorRspAllOfError.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class ErrorRspAllOfError implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'type' => false, - 'details' => false, - 'validation' => false, - 'links' => false + 'details' => false, + 'validation' => false, + 'links' => false ]; /** diff --git a/src/Generated/Model/ErrorRspAllOfErrorValidation.php b/src/Generated/Model/ErrorRspAllOfErrorValidation.php index 23bb451..1bb8a0d 100644 --- a/src/Generated/Model/ErrorRspAllOfErrorValidation.php +++ b/src/Generated/Model/ErrorRspAllOfErrorValidation.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class ErrorRspAllOfErrorValidation implements ModelInterface, ArrayAccess, \Json */ protected static array $openAPINullables = [ 'field' => false, - 'message' => false + 'message' => false ]; /** diff --git a/src/Generated/Model/ExampleGetRsp.php b/src/Generated/Model/ExampleGetRsp.php index 1436bb8..a80345b 100644 --- a/src/Generated/Model/ExampleGetRsp.php +++ b/src/Generated/Model/ExampleGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class ExampleGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false, - 'extension' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false, + 'extension' => false ]; /** diff --git a/src/Generated/Model/FullUser.php b/src/Generated/Model/FullUser.php index b77db7e..50f84ba 100644 --- a/src/Generated/Model/FullUser.php +++ b/src/Generated/Model/FullUser.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -94,13 +94,13 @@ class FullUser implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'name' => false, - 'full_name' => false, - 'created' => false, - 'updated' => false, - 'status' => false, - 'emails' => false, - 'phone_numbers' => false + 'name' => false, + 'full_name' => false, + 'created' => false, + 'updated' => false, + 'status' => false, + 'emails' => false, + 'phone_numbers' => false ]; /** diff --git a/src/Generated/Model/GenericRsp.php b/src/Generated/Model/GenericRsp.php index 09605a5..3ec4028 100644 --- a/src/Generated/Model/GenericRsp.php +++ b/src/Generated/Model/GenericRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class GenericRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false ]; /** diff --git a/src/Generated/Model/IOSAppConfigDeleteReq.php b/src/Generated/Model/IOSAppConfigDeleteReq.php index 040886b..fb58af2 100644 --- a/src/Generated/Model/IOSAppConfigDeleteReq.php +++ b/src/Generated/Model/IOSAppConfigDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class IOSAppConfigDeleteReq implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/IOSAppConfigItem.php b/src/Generated/Model/IOSAppConfigItem.php index 5c2bb27..1a21c40 100644 --- a/src/Generated/Model/IOSAppConfigItem.php +++ b/src/Generated/Model/IOSAppConfigItem.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class IOSAppConfigItem implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'project_id' => false, - 'app_id_prefix' => false, - 'bundle_id' => false, - 'created' => false, - 'updated' => false + 'project_id' => false, + 'app_id_prefix' => false, + 'bundle_id' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/IOSAppConfigListRsp.php b/src/Generated/Model/IOSAppConfigListRsp.php index aa4e3b0..5eea88d 100644 --- a/src/Generated/Model/IOSAppConfigListRsp.php +++ b/src/Generated/Model/IOSAppConfigListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class IOSAppConfigListRsp implements ModelInterface, ArrayAccess, \JsonSerializa */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'rows' => false, - 'paging' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'rows' => false, + 'paging' => false ]; /** diff --git a/src/Generated/Model/IOSAppConfigSaveReq.php b/src/Generated/Model/IOSAppConfigSaveReq.php index 3057bd2..5df8741 100644 --- a/src/Generated/Model/IOSAppConfigSaveReq.php +++ b/src/Generated/Model/IOSAppConfigSaveReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class IOSAppConfigSaveReq implements ModelInterface, ArrayAccess, \JsonSerializa */ protected static array $openAPINullables = [ 'app_id_prefix' => false, - 'bundle_id' => false, - 'request_id' => false, - 'client_info' => false + 'bundle_id' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/IOSAppConfigSaveRsp.php b/src/Generated/Model/IOSAppConfigSaveRsp.php index 73c9900..2bca41a 100644 --- a/src/Generated/Model/IOSAppConfigSaveRsp.php +++ b/src/Generated/Model/IOSAppConfigSaveRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -97,15 +97,15 @@ class IOSAppConfigSaveRsp implements ModelInterface, ArrayAccess, \JsonSerializa */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'id' => false, - 'project_id' => false, - 'app_id_prefix' => false, - 'bundle_id' => false, - 'created' => false, - 'updated' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'id' => false, + 'project_id' => false, + 'app_id_prefix' => false, + 'bundle_id' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/IOSAppConfigUpdateReq.php b/src/Generated/Model/IOSAppConfigUpdateReq.php index 84609dd..2b6d8de 100644 --- a/src/Generated/Model/IOSAppConfigUpdateReq.php +++ b/src/Generated/Model/IOSAppConfigUpdateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class IOSAppConfigUpdateReq implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'app_id_prefix' => false, - 'bundle_id' => false, - 'request_id' => false, - 'client_info' => false + 'bundle_id' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/IOSAppConfigUpdateRsp.php b/src/Generated/Model/IOSAppConfigUpdateRsp.php index 4116866..768089c 100644 --- a/src/Generated/Model/IOSAppConfigUpdateRsp.php +++ b/src/Generated/Model/IOSAppConfigUpdateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -97,15 +97,15 @@ class IOSAppConfigUpdateRsp implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'id' => false, - 'project_id' => false, - 'app_id_prefix' => false, - 'bundle_id' => false, - 'created' => false, - 'updated' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'id' => false, + 'project_id' => false, + 'app_id_prefix' => false, + 'bundle_id' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/LoginIdentifierType.php b/src/Generated/Model/LoginIdentifierType.php new file mode 100644 index 0000000..0636d0f --- /dev/null +++ b/src/Generated/Model/LoginIdentifierType.php @@ -0,0 +1,67 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; +use \Corbado\Generated\ObjectSerializer; + +/** + * LoginIdentifierType Class Doc Comment + * + * @category Class + * @description Login Identifier type + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class LoginIdentifierType +{ + /** + * Possible values of this enum + */ + public const EMAIL = 'email'; + + public const PHONE_NUMBER = 'phone_number'; + + public const CUSTOM = 'custom'; + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::EMAIL, + self::PHONE_NUMBER, + self::CUSTOM + ]; + } +} + + diff --git a/src/Generated/Model/LongSession.php b/src/Generated/Model/LongSession.php index 02a9f20..a858723 100644 --- a/src/Generated/Model/LongSession.php +++ b/src/Generated/Model/LongSession.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -105,19 +105,19 @@ class LongSession implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'user_id' => false, - 'user_identifier' => false, - 'user_full_name' => false, - 'device_id' => false, - 'browser_name' => false, - 'browser_version' => false, - 'os_name' => false, - 'os_version' => false, - 'expires' => false, - 'last_action' => false, - 'created' => false, - 'updated' => false, - 'status' => false + 'user_id' => false, + 'user_identifier' => false, + 'user_full_name' => false, + 'device_id' => false, + 'browser_name' => false, + 'browser_version' => false, + 'os_name' => false, + 'os_version' => false, + 'expires' => false, + 'last_action' => false, + 'created' => false, + 'updated' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/LongSessionGetRsp.php b/src/Generated/Model/LongSessionGetRsp.php index 58ebfc0..33c5082 100644 --- a/src/Generated/Model/LongSessionGetRsp.php +++ b/src/Generated/Model/LongSessionGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class LongSessionGetRsp implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/LongSessionGetRspAllOfData.php b/src/Generated/Model/LongSessionGetRspAllOfData.php index bd3a1c1..b8e5cd5 100644 --- a/src/Generated/Model/LongSessionGetRspAllOfData.php +++ b/src/Generated/Model/LongSessionGetRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/LongSessionListRsp.php b/src/Generated/Model/LongSessionListRsp.php index 947dcea..07959eb 100644 --- a/src/Generated/Model/LongSessionListRsp.php +++ b/src/Generated/Model/LongSessionListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class LongSessionListRsp implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/LongSessionListRspAllOfData.php b/src/Generated/Model/LongSessionListRspAllOfData.php index 67266be..737b2ec 100644 --- a/src/Generated/Model/LongSessionListRspAllOfData.php +++ b/src/Generated/Model/LongSessionListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class LongSessionListRspAllOfData implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'long_sessions' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/LongSessionRevokeReq.php b/src/Generated/Model/LongSessionRevokeReq.php index 6173ece..9fe5ea1 100644 --- a/src/Generated/Model/LongSessionRevokeReq.php +++ b/src/Generated/Model/LongSessionRevokeReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class LongSessionRevokeReq implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/ModelInterface.php b/src/Generated/Model/ModelInterface.php index 7499a39..3e505a3 100644 --- a/src/Generated/Model/ModelInterface.php +++ b/src/Generated/Model/ModelInterface.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/Paging.php b/src/Generated/Model/Paging.php index 8773020..d5ced2f 100644 --- a/src/Generated/Model/Paging.php +++ b/src/Generated/Model/Paging.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class Paging implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'page' => false, - 'total_pages' => false, - 'total_items' => false + 'total_pages' => false, + 'total_items' => false ]; /** diff --git a/src/Generated/Model/PhoneNumber.php b/src/Generated/Model/PhoneNumber.php index b11525f..f0e2d5f 100644 --- a/src/Generated/Model/PhoneNumber.php +++ b/src/Generated/Model/PhoneNumber.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class PhoneNumber implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'phone_number' => false, - 'created' => false, - 'updated' => false, - 'status' => false + 'phone_number' => false, + 'created' => false, + 'updated' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/PhoneNumberValidationResult.php b/src/Generated/Model/PhoneNumberValidationResult.php index 7c2fe02..715bd45 100644 --- a/src/Generated/Model/PhoneNumberValidationResult.php +++ b/src/Generated/Model/PhoneNumberValidationResult.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class PhoneNumberValidationResult implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'is_valid' => false, - 'validation_code' => false, - 'phone_number' => false + 'validation_code' => false, + 'phone_number' => false ]; /** diff --git a/src/Generated/Model/ProjectConfig.php b/src/Generated/Model/ProjectConfig.php index 033d637..e6b7afa 100644 --- a/src/Generated/Model/ProjectConfig.php +++ b/src/Generated/Model/ProjectConfig.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -60,6 +60,8 @@ class ProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'project_id' => 'string', 'external_name' => 'string', + 'app_type' => '\Corbado\Generated\Model\AppType', + 'product_key' => 'string', 'email_from' => 'string', 'sms_from' => 'string', 'external_application_protocol_version' => 'string', @@ -88,7 +90,10 @@ class ProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable 'has_verified_session' => 'bool', 'has_generated_session' => 'bool', 'has_started_using_passkeys' => 'bool', + 'has_started_using_sessions' => 'bool', 'environment' => 'string', + 'frontend_framework' => 'string', + 'backend_language' => 'string', 'backend_api_url' => 'string', 'frontend_api_url' => 'string', 'application_url' => 'string', @@ -96,13 +101,22 @@ class ProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable 'double_opt_in' => 'bool', 'user_full_name_required' => 'bool', 'webauthn_rpid' => 'string', + 'domain' => 'string', 'web_component_debug' => 'bool', 'smtp_use_custom' => 'bool', 'smtp_host' => 'string', 'smtp_port' => 'int', 'smtp_username' => 'string', + 'smtp_password' => 'string', + 'support_email' => 'string', + 'webhook_actions' => 'string[]', + 'signup_flow' => 'string', + 'signup_flow_options' => 'object', + 'login_flow' => 'string', + 'login_flow_options' => 'object', 'created' => 'string', - 'updated' => 'string' + 'updated' => 'string', + 'status' => 'string' ]; /** @@ -115,6 +129,8 @@ class ProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'project_id' => null, 'external_name' => null, + 'app_type' => null, + 'product_key' => null, 'email_from' => null, 'sms_from' => null, 'external_application_protocol_version' => null, @@ -143,7 +159,10 @@ class ProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable 'has_verified_session' => null, 'has_generated_session' => null, 'has_started_using_passkeys' => null, + 'has_started_using_sessions' => null, 'environment' => null, + 'frontend_framework' => null, + 'backend_language' => null, 'backend_api_url' => null, 'frontend_api_url' => null, 'application_url' => null, @@ -151,13 +170,22 @@ class ProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable 'double_opt_in' => null, 'user_full_name_required' => null, 'webauthn_rpid' => null, + 'domain' => null, 'web_component_debug' => null, 'smtp_use_custom' => null, 'smtp_host' => null, 'smtp_port' => null, 'smtp_username' => null, + 'smtp_password' => null, + 'support_email' => null, + 'webhook_actions' => null, + 'signup_flow' => null, + 'signup_flow_options' => null, + 'login_flow' => null, + 'login_flow_options' => null, 'created' => null, - 'updated' => null + 'updated' => null, + 'status' => null ]; /** @@ -167,50 +195,64 @@ class ProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'project_id' => false, - 'external_name' => false, - 'email_from' => false, - 'sms_from' => false, - 'external_application_protocol_version' => false, - 'webhook_url' => false, - 'webhook_username' => false, - 'webhook_password' => false, - 'webhook_test_invalid_username' => false, - 'webhook_test_valid_username' => false, - 'webhook_test_valid_password' => false, - 'external_application_username' => false, - 'external_application_password' => false, - 'legacy_auth_methods_url' => false, - 'password_verify_url' => false, - 'auth_success_redirect_url' => false, - 'password_reset_url' => false, - 'allow_user_registration' => false, - 'allow_ip_stickiness' => false, - 'passkey_append_interval' => false, - 'cli_secret' => false, - 'fallback_language' => false, - 'auto_detect_language' => false, - 'integration_mode_hosted' => false, - 'integration_mode_api' => false, - 'integration_mode_web_component' => false, - 'has_existing_users' => false, - 'has_verified_session' => false, - 'has_generated_session' => false, - 'has_started_using_passkeys' => false, - 'environment' => false, - 'backend_api_url' => false, - 'frontend_api_url' => false, - 'application_url' => false, - 'use_cli' => false, - 'double_opt_in' => false, - 'user_full_name_required' => false, - 'webauthn_rpid' => false, - 'web_component_debug' => false, - 'smtp_use_custom' => false, - 'smtp_host' => false, - 'smtp_port' => false, - 'smtp_username' => false, - 'created' => false, - 'updated' => false + 'external_name' => false, + 'app_type' => false, + 'product_key' => false, + 'email_from' => false, + 'sms_from' => false, + 'external_application_protocol_version' => false, + 'webhook_url' => false, + 'webhook_username' => false, + 'webhook_password' => false, + 'webhook_test_invalid_username' => false, + 'webhook_test_valid_username' => false, + 'webhook_test_valid_password' => false, + 'external_application_username' => false, + 'external_application_password' => false, + 'legacy_auth_methods_url' => false, + 'password_verify_url' => false, + 'auth_success_redirect_url' => false, + 'password_reset_url' => false, + 'allow_user_registration' => false, + 'allow_ip_stickiness' => false, + 'passkey_append_interval' => false, + 'cli_secret' => false, + 'fallback_language' => false, + 'auto_detect_language' => false, + 'integration_mode_hosted' => false, + 'integration_mode_api' => false, + 'integration_mode_web_component' => false, + 'has_existing_users' => false, + 'has_verified_session' => false, + 'has_generated_session' => false, + 'has_started_using_passkeys' => false, + 'has_started_using_sessions' => false, + 'environment' => false, + 'frontend_framework' => false, + 'backend_language' => false, + 'backend_api_url' => false, + 'frontend_api_url' => false, + 'application_url' => false, + 'use_cli' => false, + 'double_opt_in' => false, + 'user_full_name_required' => false, + 'webauthn_rpid' => false, + 'domain' => false, + 'web_component_debug' => false, + 'smtp_use_custom' => false, + 'smtp_host' => false, + 'smtp_port' => false, + 'smtp_username' => false, + 'smtp_password' => false, + 'support_email' => false, + 'webhook_actions' => false, + 'signup_flow' => false, + 'signup_flow_options' => false, + 'login_flow' => false, + 'login_flow_options' => false, + 'created' => false, + 'updated' => false, + 'status' => false ]; /** @@ -301,6 +343,8 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'project_id' => 'projectID', 'external_name' => 'externalName', + 'app_type' => 'appType', + 'product_key' => 'productKey', 'email_from' => 'emailFrom', 'sms_from' => 'smsFrom', 'external_application_protocol_version' => 'externalApplicationProtocolVersion', @@ -329,7 +373,10 @@ public function isNullableSetToNull(string $property): bool 'has_verified_session' => 'hasVerifiedSession', 'has_generated_session' => 'hasGeneratedSession', 'has_started_using_passkeys' => 'hasStartedUsingPasskeys', + 'has_started_using_sessions' => 'hasStartedUsingSessions', 'environment' => 'environment', + 'frontend_framework' => 'frontendFramework', + 'backend_language' => 'backendLanguage', 'backend_api_url' => 'backendAPIUrl', 'frontend_api_url' => 'frontendAPIUrl', 'application_url' => 'applicationUrl', @@ -337,13 +384,22 @@ public function isNullableSetToNull(string $property): bool 'double_opt_in' => 'doubleOptIn', 'user_full_name_required' => 'userFullNameRequired', 'webauthn_rpid' => 'webauthnRPID', + 'domain' => 'domain', 'web_component_debug' => 'webComponentDebug', 'smtp_use_custom' => 'smtpUseCustom', 'smtp_host' => 'smtpHost', 'smtp_port' => 'smtpPort', 'smtp_username' => 'smtpUsername', + 'smtp_password' => 'smtpPassword', + 'support_email' => 'supportEmail', + 'webhook_actions' => 'webhookActions', + 'signup_flow' => 'signupFlow', + 'signup_flow_options' => 'signupFlowOptions', + 'login_flow' => 'loginFlow', + 'login_flow_options' => 'loginFlowOptions', 'created' => 'created', - 'updated' => 'updated' + 'updated' => 'updated', + 'status' => 'status' ]; /** @@ -354,6 +410,8 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'project_id' => 'setProjectId', 'external_name' => 'setExternalName', + 'app_type' => 'setAppType', + 'product_key' => 'setProductKey', 'email_from' => 'setEmailFrom', 'sms_from' => 'setSmsFrom', 'external_application_protocol_version' => 'setExternalApplicationProtocolVersion', @@ -382,7 +440,10 @@ public function isNullableSetToNull(string $property): bool 'has_verified_session' => 'setHasVerifiedSession', 'has_generated_session' => 'setHasGeneratedSession', 'has_started_using_passkeys' => 'setHasStartedUsingPasskeys', + 'has_started_using_sessions' => 'setHasStartedUsingSessions', 'environment' => 'setEnvironment', + 'frontend_framework' => 'setFrontendFramework', + 'backend_language' => 'setBackendLanguage', 'backend_api_url' => 'setBackendApiUrl', 'frontend_api_url' => 'setFrontendApiUrl', 'application_url' => 'setApplicationUrl', @@ -390,13 +451,22 @@ public function isNullableSetToNull(string $property): bool 'double_opt_in' => 'setDoubleOptIn', 'user_full_name_required' => 'setUserFullNameRequired', 'webauthn_rpid' => 'setWebauthnRpid', + 'domain' => 'setDomain', 'web_component_debug' => 'setWebComponentDebug', 'smtp_use_custom' => 'setSmtpUseCustom', 'smtp_host' => 'setSmtpHost', 'smtp_port' => 'setSmtpPort', 'smtp_username' => 'setSmtpUsername', + 'smtp_password' => 'setSmtpPassword', + 'support_email' => 'setSupportEmail', + 'webhook_actions' => 'setWebhookActions', + 'signup_flow' => 'setSignupFlow', + 'signup_flow_options' => 'setSignupFlowOptions', + 'login_flow' => 'setLoginFlow', + 'login_flow_options' => 'setLoginFlowOptions', 'created' => 'setCreated', - 'updated' => 'setUpdated' + 'updated' => 'setUpdated', + 'status' => 'setStatus' ]; /** @@ -407,6 +477,8 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'project_id' => 'getProjectId', 'external_name' => 'getExternalName', + 'app_type' => 'getAppType', + 'product_key' => 'getProductKey', 'email_from' => 'getEmailFrom', 'sms_from' => 'getSmsFrom', 'external_application_protocol_version' => 'getExternalApplicationProtocolVersion', @@ -435,7 +507,10 @@ public function isNullableSetToNull(string $property): bool 'has_verified_session' => 'getHasVerifiedSession', 'has_generated_session' => 'getHasGeneratedSession', 'has_started_using_passkeys' => 'getHasStartedUsingPasskeys', + 'has_started_using_sessions' => 'getHasStartedUsingSessions', 'environment' => 'getEnvironment', + 'frontend_framework' => 'getFrontendFramework', + 'backend_language' => 'getBackendLanguage', 'backend_api_url' => 'getBackendApiUrl', 'frontend_api_url' => 'getFrontendApiUrl', 'application_url' => 'getApplicationUrl', @@ -443,13 +518,22 @@ public function isNullableSetToNull(string $property): bool 'double_opt_in' => 'getDoubleOptIn', 'user_full_name_required' => 'getUserFullNameRequired', 'webauthn_rpid' => 'getWebauthnRpid', + 'domain' => 'getDomain', 'web_component_debug' => 'getWebComponentDebug', 'smtp_use_custom' => 'getSmtpUseCustom', 'smtp_host' => 'getSmtpHost', 'smtp_port' => 'getSmtpPort', 'smtp_username' => 'getSmtpUsername', + 'smtp_password' => 'getSmtpPassword', + 'support_email' => 'getSupportEmail', + 'webhook_actions' => 'getWebhookActions', + 'signup_flow' => 'getSignupFlow', + 'signup_flow_options' => 'getSignupFlowOptions', + 'login_flow' => 'getLoginFlow', + 'login_flow_options' => 'getLoginFlowOptions', 'created' => 'getCreated', - 'updated' => 'getUpdated' + 'updated' => 'getUpdated', + 'status' => 'getStatus' ]; /** @@ -493,6 +577,7 @@ public function getModelName() return self::$openAPIModelName; } + public const PASSKEY_APPEND_INTERVAL_NOT_SPECIFIED = 'not_specified'; public const PASSKEY_APPEND_INTERVAL__0D = '0d'; public const PASSKEY_APPEND_INTERVAL__1D = '1d'; public const PASSKEY_APPEND_INTERVAL__3D = '3d'; @@ -502,6 +587,19 @@ public function getModelName() public const PASSKEY_APPEND_INTERVAL__3M = '3m'; public const ENVIRONMENT_DEV = 'dev'; public const ENVIRONMENT_PROD = 'prod'; + public const FRONTEND_FRAMEWORK_NOT_SPECIFIED = 'not_specified'; + public const FRONTEND_FRAMEWORK_REACT = 'react'; + public const FRONTEND_FRAMEWORK_VUEJS = 'vuejs'; + public const FRONTEND_FRAMEWORK_VANILLAJS = 'vanillajs'; + public const BACKEND_LANGUAGE_NOT_SPECIFIED = 'not_specified'; + public const BACKEND_LANGUAGE_JAVASCRIPT = 'javascript'; + public const BACKEND_LANGUAGE_PHP = 'php'; + public const BACKEND_LANGUAGE_GO = 'go'; + public const SIGNUP_FLOW_PASSKEY_WITH_EMAIL_OTP_FALLBACK = 'PasskeyWithEmailOTPFallback'; + public const SIGNUP_FLOW_EMAIL_OTP_SIGNUP = 'EmailOTPSignup'; + public const LOGIN_FLOW_PASSKEY_WITH_EMAIL_OTP_FALLBACK = 'PasskeyWithEmailOTPFallback'; + public const STATUS_ACTIVE = 'active'; + public const STATUS_CONFIGURING = 'configuring'; /** * Gets allowable values of the enum @@ -511,6 +609,7 @@ public function getModelName() public function getPasskeyAppendIntervalAllowableValues() { return [ + self::PASSKEY_APPEND_INTERVAL_NOT_SPECIFIED, self::PASSKEY_APPEND_INTERVAL__0D, self::PASSKEY_APPEND_INTERVAL__1D, self::PASSKEY_APPEND_INTERVAL__3D, @@ -534,6 +633,74 @@ public function getEnvironmentAllowableValues() ]; } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFrontendFrameworkAllowableValues() + { + return [ + self::FRONTEND_FRAMEWORK_NOT_SPECIFIED, + self::FRONTEND_FRAMEWORK_REACT, + self::FRONTEND_FRAMEWORK_VUEJS, + self::FRONTEND_FRAMEWORK_VANILLAJS, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBackendLanguageAllowableValues() + { + return [ + self::BACKEND_LANGUAGE_NOT_SPECIFIED, + self::BACKEND_LANGUAGE_JAVASCRIPT, + self::BACKEND_LANGUAGE_PHP, + self::BACKEND_LANGUAGE_GO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSignupFlowAllowableValues() + { + return [ + self::SIGNUP_FLOW_PASSKEY_WITH_EMAIL_OTP_FALLBACK, + self::SIGNUP_FLOW_EMAIL_OTP_SIGNUP, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLoginFlowAllowableValues() + { + return [ + self::LOGIN_FLOW_PASSKEY_WITH_EMAIL_OTP_FALLBACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_ACTIVE, + self::STATUS_CONFIGURING, + ]; + } + /** * Associative array for storing property values * @@ -551,6 +718,8 @@ public function __construct(array $data = null) { $this->setIfExists('project_id', $data ?? [], null); $this->setIfExists('external_name', $data ?? [], null); + $this->setIfExists('app_type', $data ?? [], null); + $this->setIfExists('product_key', $data ?? [], null); $this->setIfExists('email_from', $data ?? [], null); $this->setIfExists('sms_from', $data ?? [], null); $this->setIfExists('external_application_protocol_version', $data ?? [], null); @@ -579,7 +748,10 @@ public function __construct(array $data = null) $this->setIfExists('has_verified_session', $data ?? [], null); $this->setIfExists('has_generated_session', $data ?? [], null); $this->setIfExists('has_started_using_passkeys', $data ?? [], null); + $this->setIfExists('has_started_using_sessions', $data ?? [], null); $this->setIfExists('environment', $data ?? [], null); + $this->setIfExists('frontend_framework', $data ?? [], null); + $this->setIfExists('backend_language', $data ?? [], null); $this->setIfExists('backend_api_url', $data ?? [], null); $this->setIfExists('frontend_api_url', $data ?? [], null); $this->setIfExists('application_url', $data ?? [], null); @@ -587,13 +759,22 @@ public function __construct(array $data = null) $this->setIfExists('double_opt_in', $data ?? [], null); $this->setIfExists('user_full_name_required', $data ?? [], null); $this->setIfExists('webauthn_rpid', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); $this->setIfExists('web_component_debug', $data ?? [], null); $this->setIfExists('smtp_use_custom', $data ?? [], null); $this->setIfExists('smtp_host', $data ?? [], null); $this->setIfExists('smtp_port', $data ?? [], null); $this->setIfExists('smtp_username', $data ?? [], null); + $this->setIfExists('smtp_password', $data ?? [], null); + $this->setIfExists('support_email', $data ?? [], null); + $this->setIfExists('webhook_actions', $data ?? [], null); + $this->setIfExists('signup_flow', $data ?? [], null); + $this->setIfExists('signup_flow_options', $data ?? [], null); + $this->setIfExists('login_flow', $data ?? [], null); + $this->setIfExists('login_flow_options', $data ?? [], null); $this->setIfExists('created', $data ?? [], null); $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); } /** @@ -629,12 +810,66 @@ public function listInvalidProperties() if ($this->container['external_name'] === null) { $invalidProperties[] = "'external_name' can't be null"; } + if ($this->container['app_type'] === null) { + $invalidProperties[] = "'app_type' can't be null"; + } + if ($this->container['product_key'] === null) { + $invalidProperties[] = "'product_key' can't be null"; + } if ($this->container['email_from'] === null) { $invalidProperties[] = "'email_from' can't be null"; } if ($this->container['sms_from'] === null) { $invalidProperties[] = "'sms_from' can't be null"; } + if ($this->container['external_application_protocol_version'] === null) { + $invalidProperties[] = "'external_application_protocol_version' can't be null"; + } + if ($this->container['webhook_url'] === null) { + $invalidProperties[] = "'webhook_url' can't be null"; + } + if ($this->container['webhook_username'] === null) { + $invalidProperties[] = "'webhook_username' can't be null"; + } + if ($this->container['webhook_password'] === null) { + $invalidProperties[] = "'webhook_password' can't be null"; + } + if ($this->container['webhook_test_invalid_username'] === null) { + $invalidProperties[] = "'webhook_test_invalid_username' can't be null"; + } + if ($this->container['webhook_test_valid_username'] === null) { + $invalidProperties[] = "'webhook_test_valid_username' can't be null"; + } + if ($this->container['webhook_test_valid_password'] === null) { + $invalidProperties[] = "'webhook_test_valid_password' can't be null"; + } + if ($this->container['external_application_username'] === null) { + $invalidProperties[] = "'external_application_username' can't be null"; + } + if ($this->container['external_application_password'] === null) { + $invalidProperties[] = "'external_application_password' can't be null"; + } + if ($this->container['legacy_auth_methods_url'] === null) { + $invalidProperties[] = "'legacy_auth_methods_url' can't be null"; + } + if ($this->container['password_verify_url'] === null) { + $invalidProperties[] = "'password_verify_url' can't be null"; + } + if ($this->container['auth_success_redirect_url'] === null) { + $invalidProperties[] = "'auth_success_redirect_url' can't be null"; + } + if ($this->container['password_reset_url'] === null) { + $invalidProperties[] = "'password_reset_url' can't be null"; + } + if ($this->container['allow_user_registration'] === null) { + $invalidProperties[] = "'allow_user_registration' can't be null"; + } + if ($this->container['allow_ip_stickiness'] === null) { + $invalidProperties[] = "'allow_ip_stickiness' can't be null"; + } + if ($this->container['passkey_append_interval'] === null) { + $invalidProperties[] = "'passkey_append_interval' can't be null"; + } $allowedValues = $this->getPasskeyAppendIntervalAllowableValues(); if (!is_null($this->container['passkey_append_interval']) && !in_array($this->container['passkey_append_interval'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -644,6 +879,9 @@ public function listInvalidProperties() ); } + if ($this->container['cli_secret'] === null) { + $invalidProperties[] = "'cli_secret' can't be null"; + } if ($this->container['fallback_language'] === null) { $invalidProperties[] = "'fallback_language' can't be null"; } @@ -671,6 +909,9 @@ public function listInvalidProperties() if ($this->container['has_started_using_passkeys'] === null) { $invalidProperties[] = "'has_started_using_passkeys' can't be null"; } + if ($this->container['has_started_using_sessions'] === null) { + $invalidProperties[] = "'has_started_using_sessions' can't be null"; + } if ($this->container['environment'] === null) { $invalidProperties[] = "'environment' can't be null"; } @@ -683,6 +924,30 @@ public function listInvalidProperties() ); } + if ($this->container['frontend_framework'] === null) { + $invalidProperties[] = "'frontend_framework' can't be null"; + } + $allowedValues = $this->getFrontendFrameworkAllowableValues(); + if (!is_null($this->container['frontend_framework']) && !in_array($this->container['frontend_framework'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'frontend_framework', must be one of '%s'", + $this->container['frontend_framework'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['backend_language'] === null) { + $invalidProperties[] = "'backend_language' can't be null"; + } + $allowedValues = $this->getBackendLanguageAllowableValues(); + if (!is_null($this->container['backend_language']) && !in_array($this->container['backend_language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'backend_language', must be one of '%s'", + $this->container['backend_language'], + implode("', '", $allowedValues) + ); + } + if ($this->container['backend_api_url'] === null) { $invalidProperties[] = "'backend_api_url' can't be null"; } @@ -704,15 +969,81 @@ public function listInvalidProperties() if ($this->container['webauthn_rpid'] === null) { $invalidProperties[] = "'webauthn_rpid' can't be null"; } + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' can't be null"; + } if ($this->container['web_component_debug'] === null) { $invalidProperties[] = "'web_component_debug' can't be null"; } + if ($this->container['smtp_use_custom'] === null) { + $invalidProperties[] = "'smtp_use_custom' can't be null"; + } + if ($this->container['smtp_host'] === null) { + $invalidProperties[] = "'smtp_host' can't be null"; + } + if ($this->container['smtp_port'] === null) { + $invalidProperties[] = "'smtp_port' can't be null"; + } + if ($this->container['smtp_username'] === null) { + $invalidProperties[] = "'smtp_username' can't be null"; + } + if ($this->container['smtp_password'] === null) { + $invalidProperties[] = "'smtp_password' can't be null"; + } + if ($this->container['support_email'] === null) { + $invalidProperties[] = "'support_email' can't be null"; + } + if ($this->container['webhook_actions'] === null) { + $invalidProperties[] = "'webhook_actions' can't be null"; + } + if ($this->container['signup_flow'] === null) { + $invalidProperties[] = "'signup_flow' can't be null"; + } + $allowedValues = $this->getSignupFlowAllowableValues(); + if (!is_null($this->container['signup_flow']) && !in_array($this->container['signup_flow'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'signup_flow', must be one of '%s'", + $this->container['signup_flow'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['signup_flow_options'] === null) { + $invalidProperties[] = "'signup_flow_options' can't be null"; + } + if ($this->container['login_flow'] === null) { + $invalidProperties[] = "'login_flow' can't be null"; + } + $allowedValues = $this->getLoginFlowAllowableValues(); + if (!is_null($this->container['login_flow']) && !in_array($this->container['login_flow'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'login_flow', must be one of '%s'", + $this->container['login_flow'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['login_flow_options'] === null) { + $invalidProperties[] = "'login_flow_options' can't be null"; + } if ($this->container['created'] === null) { $invalidProperties[] = "'created' can't be null"; } if ($this->container['updated'] === null) { $invalidProperties[] = "'updated' can't be null"; } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -782,6 +1113,60 @@ public function setExternalName($external_name) return $this; } + /** + * Gets app_type + * + * @return \Corbado\Generated\Model\AppType + */ + public function getAppType() + { + return $this->container['app_type']; + } + + /** + * Sets app_type + * + * @param \Corbado\Generated\Model\AppType $app_type app_type + * + * @return self + */ + public function setAppType($app_type) + { + if (is_null($app_type)) { + throw new \InvalidArgumentException('non-nullable app_type cannot be null'); + } + $this->container['app_type'] = $app_type; + + return $this; + } + + /** + * Gets product_key + * + * @return string + */ + public function getProductKey() + { + return $this->container['product_key']; + } + + /** + * Sets product_key + * + * @param string $product_key product_key + * + * @return self + */ + public function setProductKey($product_key) + { + if (is_null($product_key)) { + throw new \InvalidArgumentException('non-nullable product_key cannot be null'); + } + $this->container['product_key'] = $product_key; + + return $this; + } + /** * Gets email_from * @@ -839,7 +1224,7 @@ public function setSmsFrom($sms_from) /** * Gets external_application_protocol_version * - * @return string|null + * @return string */ public function getExternalApplicationProtocolVersion() { @@ -849,7 +1234,7 @@ public function getExternalApplicationProtocolVersion() /** * Sets external_application_protocol_version * - * @param string|null $external_application_protocol_version external_application_protocol_version + * @param string $external_application_protocol_version external_application_protocol_version * * @return self */ @@ -866,7 +1251,7 @@ public function setExternalApplicationProtocolVersion($external_application_prot /** * Gets webhook_url * - * @return string|null + * @return string */ public function getWebhookUrl() { @@ -876,7 +1261,7 @@ public function getWebhookUrl() /** * Sets webhook_url * - * @param string|null $webhook_url webhook_url + * @param string $webhook_url webhook_url * * @return self */ @@ -893,7 +1278,7 @@ public function setWebhookUrl($webhook_url) /** * Gets webhook_username * - * @return string|null + * @return string */ public function getWebhookUsername() { @@ -903,7 +1288,7 @@ public function getWebhookUsername() /** * Sets webhook_username * - * @param string|null $webhook_username webhook_username + * @param string $webhook_username webhook_username * * @return self */ @@ -920,7 +1305,7 @@ public function setWebhookUsername($webhook_username) /** * Gets webhook_password * - * @return string|null + * @return string */ public function getWebhookPassword() { @@ -930,7 +1315,7 @@ public function getWebhookPassword() /** * Sets webhook_password * - * @param string|null $webhook_password webhook_password + * @param string $webhook_password webhook_password * * @return self */ @@ -947,7 +1332,7 @@ public function setWebhookPassword($webhook_password) /** * Gets webhook_test_invalid_username * - * @return string|null + * @return string */ public function getWebhookTestInvalidUsername() { @@ -957,7 +1342,7 @@ public function getWebhookTestInvalidUsername() /** * Sets webhook_test_invalid_username * - * @param string|null $webhook_test_invalid_username webhook_test_invalid_username + * @param string $webhook_test_invalid_username webhook_test_invalid_username * * @return self */ @@ -974,7 +1359,7 @@ public function setWebhookTestInvalidUsername($webhook_test_invalid_username) /** * Gets webhook_test_valid_username * - * @return string|null + * @return string */ public function getWebhookTestValidUsername() { @@ -984,7 +1369,7 @@ public function getWebhookTestValidUsername() /** * Sets webhook_test_valid_username * - * @param string|null $webhook_test_valid_username webhook_test_valid_username + * @param string $webhook_test_valid_username webhook_test_valid_username * * @return self */ @@ -1001,7 +1386,7 @@ public function setWebhookTestValidUsername($webhook_test_valid_username) /** * Gets webhook_test_valid_password * - * @return string|null + * @return string */ public function getWebhookTestValidPassword() { @@ -1011,7 +1396,7 @@ public function getWebhookTestValidPassword() /** * Sets webhook_test_valid_password * - * @param string|null $webhook_test_valid_password webhook_test_valid_password + * @param string $webhook_test_valid_password webhook_test_valid_password * * @return self */ @@ -1028,7 +1413,7 @@ public function setWebhookTestValidPassword($webhook_test_valid_password) /** * Gets external_application_username * - * @return string|null + * @return string */ public function getExternalApplicationUsername() { @@ -1038,7 +1423,7 @@ public function getExternalApplicationUsername() /** * Sets external_application_username * - * @param string|null $external_application_username external_application_username + * @param string $external_application_username external_application_username * * @return self */ @@ -1055,7 +1440,7 @@ public function setExternalApplicationUsername($external_application_username) /** * Gets external_application_password * - * @return string|null + * @return string */ public function getExternalApplicationPassword() { @@ -1065,7 +1450,7 @@ public function getExternalApplicationPassword() /** * Sets external_application_password * - * @param string|null $external_application_password external_application_password + * @param string $external_application_password external_application_password * * @return self */ @@ -1082,7 +1467,7 @@ public function setExternalApplicationPassword($external_application_password) /** * Gets legacy_auth_methods_url * - * @return string|null + * @return string */ public function getLegacyAuthMethodsUrl() { @@ -1092,7 +1477,7 @@ public function getLegacyAuthMethodsUrl() /** * Sets legacy_auth_methods_url * - * @param string|null $legacy_auth_methods_url legacy_auth_methods_url + * @param string $legacy_auth_methods_url legacy_auth_methods_url * * @return self */ @@ -1109,7 +1494,7 @@ public function setLegacyAuthMethodsUrl($legacy_auth_methods_url) /** * Gets password_verify_url * - * @return string|null + * @return string */ public function getPasswordVerifyUrl() { @@ -1119,7 +1504,7 @@ public function getPasswordVerifyUrl() /** * Sets password_verify_url * - * @param string|null $password_verify_url password_verify_url + * @param string $password_verify_url password_verify_url * * @return self */ @@ -1136,7 +1521,7 @@ public function setPasswordVerifyUrl($password_verify_url) /** * Gets auth_success_redirect_url * - * @return string|null + * @return string */ public function getAuthSuccessRedirectUrl() { @@ -1146,7 +1531,7 @@ public function getAuthSuccessRedirectUrl() /** * Sets auth_success_redirect_url * - * @param string|null $auth_success_redirect_url auth_success_redirect_url + * @param string $auth_success_redirect_url auth_success_redirect_url * * @return self */ @@ -1163,7 +1548,7 @@ public function setAuthSuccessRedirectUrl($auth_success_redirect_url) /** * Gets password_reset_url * - * @return string|null + * @return string */ public function getPasswordResetUrl() { @@ -1173,7 +1558,7 @@ public function getPasswordResetUrl() /** * Sets password_reset_url * - * @param string|null $password_reset_url password_reset_url + * @param string $password_reset_url password_reset_url * * @return self */ @@ -1190,7 +1575,7 @@ public function setPasswordResetUrl($password_reset_url) /** * Gets allow_user_registration * - * @return bool|null + * @return bool */ public function getAllowUserRegistration() { @@ -1200,7 +1585,7 @@ public function getAllowUserRegistration() /** * Sets allow_user_registration * - * @param bool|null $allow_user_registration allow_user_registration + * @param bool $allow_user_registration allow_user_registration * * @return self */ @@ -1217,7 +1602,7 @@ public function setAllowUserRegistration($allow_user_registration) /** * Gets allow_ip_stickiness * - * @return bool|null + * @return bool */ public function getAllowIpStickiness() { @@ -1227,7 +1612,7 @@ public function getAllowIpStickiness() /** * Sets allow_ip_stickiness * - * @param bool|null $allow_ip_stickiness allow_ip_stickiness + * @param bool $allow_ip_stickiness allow_ip_stickiness * * @return self */ @@ -1244,7 +1629,7 @@ public function setAllowIpStickiness($allow_ip_stickiness) /** * Gets passkey_append_interval * - * @return string|null + * @return string */ public function getPasskeyAppendInterval() { @@ -1254,7 +1639,7 @@ public function getPasskeyAppendInterval() /** * Sets passkey_append_interval * - * @param string|null $passkey_append_interval passkey_append_interval + * @param string $passkey_append_interval passkey_append_interval * * @return self */ @@ -1281,7 +1666,7 @@ public function setPasskeyAppendInterval($passkey_append_interval) /** * Gets cli_secret * - * @return string|null + * @return string */ public function getCliSecret() { @@ -1291,7 +1676,7 @@ public function getCliSecret() /** * Sets cli_secret * - * @param string|null $cli_secret cli_secret + * @param string $cli_secret cli_secret * * @return self */ @@ -1548,6 +1933,33 @@ public function setHasStartedUsingPasskeys($has_started_using_passkeys) return $this; } + /** + * Gets has_started_using_sessions + * + * @return bool + */ + public function getHasStartedUsingSessions() + { + return $this->container['has_started_using_sessions']; + } + + /** + * Sets has_started_using_sessions + * + * @param bool $has_started_using_sessions has_started_using_sessions + * + * @return self + */ + public function setHasStartedUsingSessions($has_started_using_sessions) + { + if (is_null($has_started_using_sessions)) { + throw new \InvalidArgumentException('non-nullable has_started_using_sessions cannot be null'); + } + $this->container['has_started_using_sessions'] = $has_started_using_sessions; + + return $this; + } + /** * Gets environment * @@ -1585,6 +1997,80 @@ public function setEnvironment($environment) return $this; } + /** + * Gets frontend_framework + * + * @return string + */ + public function getFrontendFramework() + { + return $this->container['frontend_framework']; + } + + /** + * Sets frontend_framework + * + * @param string $frontend_framework frontend_framework + * + * @return self + */ + public function setFrontendFramework($frontend_framework) + { + if (is_null($frontend_framework)) { + throw new \InvalidArgumentException('non-nullable frontend_framework cannot be null'); + } + $allowedValues = $this->getFrontendFrameworkAllowableValues(); + if (!in_array($frontend_framework, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'frontend_framework', must be one of '%s'", + $frontend_framework, + implode("', '", $allowedValues) + ) + ); + } + $this->container['frontend_framework'] = $frontend_framework; + + return $this; + } + + /** + * Gets backend_language + * + * @return string + */ + public function getBackendLanguage() + { + return $this->container['backend_language']; + } + + /** + * Sets backend_language + * + * @param string $backend_language backend_language + * + * @return self + */ + public function setBackendLanguage($backend_language) + { + if (is_null($backend_language)) { + throw new \InvalidArgumentException('non-nullable backend_language cannot be null'); + } + $allowedValues = $this->getBackendLanguageAllowableValues(); + if (!in_array($backend_language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'backend_language', must be one of '%s'", + $backend_language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['backend_language'] = $backend_language; + + return $this; + } + /** * Gets backend_api_url * @@ -1774,6 +2260,33 @@ public function setWebauthnRpid($webauthn_rpid) return $this; } + /** + * Gets domain + * + * @return string + */ + public function getDomain() + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain domain + * + * @return self + */ + public function setDomain($domain) + { + if (is_null($domain)) { + throw new \InvalidArgumentException('non-nullable domain cannot be null'); + } + $this->container['domain'] = $domain; + + return $this; + } + /** * Gets web_component_debug * @@ -1804,7 +2317,7 @@ public function setWebComponentDebug($web_component_debug) /** * Gets smtp_use_custom * - * @return bool|null + * @return bool */ public function getSmtpUseCustom() { @@ -1814,7 +2327,7 @@ public function getSmtpUseCustom() /** * Sets smtp_use_custom * - * @param bool|null $smtp_use_custom smtp_use_custom + * @param bool $smtp_use_custom smtp_use_custom * * @return self */ @@ -1831,7 +2344,7 @@ public function setSmtpUseCustom($smtp_use_custom) /** * Gets smtp_host * - * @return string|null + * @return string */ public function getSmtpHost() { @@ -1841,7 +2354,7 @@ public function getSmtpHost() /** * Sets smtp_host * - * @param string|null $smtp_host smtp_host + * @param string $smtp_host smtp_host * * @return self */ @@ -1858,7 +2371,7 @@ public function setSmtpHost($smtp_host) /** * Gets smtp_port * - * @return int|null + * @return int */ public function getSmtpPort() { @@ -1868,7 +2381,7 @@ public function getSmtpPort() /** * Sets smtp_port * - * @param int|null $smtp_port smtp_port + * @param int $smtp_port smtp_port * * @return self */ @@ -1885,7 +2398,7 @@ public function setSmtpPort($smtp_port) /** * Gets smtp_username * - * @return string|null + * @return string */ public function getSmtpUsername() { @@ -1895,7 +2408,7 @@ public function getSmtpUsername() /** * Sets smtp_username * - * @param string|null $smtp_username smtp_username + * @param string $smtp_username smtp_username * * @return self */ @@ -1909,6 +2422,215 @@ public function setSmtpUsername($smtp_username) return $this; } + /** + * Gets smtp_password + * + * @return string + */ + public function getSmtpPassword() + { + return $this->container['smtp_password']; + } + + /** + * Sets smtp_password + * + * @param string $smtp_password smtp_password + * + * @return self + */ + public function setSmtpPassword($smtp_password) + { + if (is_null($smtp_password)) { + throw new \InvalidArgumentException('non-nullable smtp_password cannot be null'); + } + $this->container['smtp_password'] = $smtp_password; + + return $this; + } + + /** + * Gets support_email + * + * @return string + */ + public function getSupportEmail() + { + return $this->container['support_email']; + } + + /** + * Sets support_email + * + * @param string $support_email support_email + * + * @return self + */ + public function setSupportEmail($support_email) + { + if (is_null($support_email)) { + throw new \InvalidArgumentException('non-nullable support_email cannot be null'); + } + $this->container['support_email'] = $support_email; + + return $this; + } + + /** + * Gets webhook_actions + * + * @return string[] + */ + public function getWebhookActions() + { + return $this->container['webhook_actions']; + } + + /** + * Sets webhook_actions + * + * @param string[] $webhook_actions webhook_actions + * + * @return self + */ + public function setWebhookActions($webhook_actions) + { + if (is_null($webhook_actions)) { + throw new \InvalidArgumentException('non-nullable webhook_actions cannot be null'); + } + $this->container['webhook_actions'] = $webhook_actions; + + return $this; + } + + /** + * Gets signup_flow + * + * @return string + */ + public function getSignupFlow() + { + return $this->container['signup_flow']; + } + + /** + * Sets signup_flow + * + * @param string $signup_flow signup_flow + * + * @return self + */ + public function setSignupFlow($signup_flow) + { + if (is_null($signup_flow)) { + throw new \InvalidArgumentException('non-nullable signup_flow cannot be null'); + } + $allowedValues = $this->getSignupFlowAllowableValues(); + if (!in_array($signup_flow, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'signup_flow', must be one of '%s'", + $signup_flow, + implode("', '", $allowedValues) + ) + ); + } + $this->container['signup_flow'] = $signup_flow; + + return $this; + } + + /** + * Gets signup_flow_options + * + * @return object + */ + public function getSignupFlowOptions() + { + return $this->container['signup_flow_options']; + } + + /** + * Sets signup_flow_options + * + * @param object $signup_flow_options signup_flow_options + * + * @return self + */ + public function setSignupFlowOptions($signup_flow_options) + { + if (is_null($signup_flow_options)) { + throw new \InvalidArgumentException('non-nullable signup_flow_options cannot be null'); + } + $this->container['signup_flow_options'] = $signup_flow_options; + + return $this; + } + + /** + * Gets login_flow + * + * @return string + */ + public function getLoginFlow() + { + return $this->container['login_flow']; + } + + /** + * Sets login_flow + * + * @param string $login_flow login_flow + * + * @return self + */ + public function setLoginFlow($login_flow) + { + if (is_null($login_flow)) { + throw new \InvalidArgumentException('non-nullable login_flow cannot be null'); + } + $allowedValues = $this->getLoginFlowAllowableValues(); + if (!in_array($login_flow, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'login_flow', must be one of '%s'", + $login_flow, + implode("', '", $allowedValues) + ) + ); + } + $this->container['login_flow'] = $login_flow; + + return $this; + } + + /** + * Gets login_flow_options + * + * @return object + */ + public function getLoginFlowOptions() + { + return $this->container['login_flow_options']; + } + + /** + * Sets login_flow_options + * + * @param object $login_flow_options login_flow_options + * + * @return self + */ + public function setLoginFlowOptions($login_flow_options) + { + if (is_null($login_flow_options)) { + throw new \InvalidArgumentException('non-nullable login_flow_options cannot be null'); + } + $this->container['login_flow_options'] = $login_flow_options; + + return $this; + } + /** * Gets created * @@ -1962,6 +2684,43 @@ public function setUpdated($updated) return $this; } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Generated/Model/ProjectConfigGetRsp.php b/src/Generated/Model/ProjectConfigGetRsp.php index 6685fda..3e18548 100644 --- a/src/Generated/Model/ProjectConfigGetRsp.php +++ b/src/Generated/Model/ProjectConfigGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class ProjectConfigGetRsp implements ModelInterface, ArrayAccess, \JsonSerializa */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/ProjectConfigSaveReq.php b/src/Generated/Model/ProjectConfigSaveReq.php index 32794d0..57f275e 100644 --- a/src/Generated/Model/ProjectConfigSaveReq.php +++ b/src/Generated/Model/ProjectConfigSaveReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -59,10 +59,13 @@ class ProjectConfigSaveReq implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static $openAPITypes = [ 'external_name' => 'string', + 'app_type' => '\Corbado\Generated\Model\AppType', + 'product_key' => 'string', 'email_from' => 'string', 'sms_from' => 'string', 'external_application_protocol_version' => 'string', 'webhook_url' => 'string', + 'webhook_actions' => 'string[]', 'webhook_username' => 'string', 'webhook_password' => 'string', 'webhook_test_invalid_username' => 'string', @@ -86,18 +89,27 @@ class ProjectConfigSaveReq implements ModelInterface, ArrayAccess, \JsonSerializ 'has_verified_session' => 'bool', 'has_generated_session' => 'bool', 'has_started_using_passkeys' => 'bool', + 'has_started_using_sessions' => 'bool', 'application_url' => 'string', 'use_cli' => 'bool', 'double_opt_in' => 'bool', 'user_full_name_required' => 'bool', 'webauthn_rpid' => 'string', + 'domain' => 'string', 'environment' => 'string', + 'frontend_framework' => 'string', + 'backend_language' => 'string', 'web_component_debug' => 'bool', 'smtp_use_custom' => 'bool', 'smtp_host' => 'string', 'smtp_port' => 'int', 'smtp_username' => 'string', 'smtp_password' => 'string', + 'support_email' => 'string', + 'signup_flow' => 'string', + 'signup_flow_options' => 'object', + 'login_flow' => 'string', + 'login_flow_options' => 'object', 'request_id' => 'string', 'client_info' => '\Corbado\Generated\Model\ClientInfo' ]; @@ -111,10 +123,13 @@ class ProjectConfigSaveReq implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static $openAPIFormats = [ 'external_name' => null, + 'app_type' => null, + 'product_key' => null, 'email_from' => null, 'sms_from' => null, 'external_application_protocol_version' => null, 'webhook_url' => null, + 'webhook_actions' => null, 'webhook_username' => null, 'webhook_password' => null, 'webhook_test_invalid_username' => null, @@ -138,18 +153,27 @@ class ProjectConfigSaveReq implements ModelInterface, ArrayAccess, \JsonSerializ 'has_verified_session' => null, 'has_generated_session' => null, 'has_started_using_passkeys' => null, + 'has_started_using_sessions' => null, 'application_url' => null, 'use_cli' => null, 'double_opt_in' => null, 'user_full_name_required' => null, 'webauthn_rpid' => null, + 'domain' => null, 'environment' => null, + 'frontend_framework' => null, + 'backend_language' => null, 'web_component_debug' => null, 'smtp_use_custom' => null, 'smtp_host' => null, 'smtp_port' => null, 'smtp_username' => null, 'smtp_password' => null, + 'support_email' => null, + 'signup_flow' => null, + 'signup_flow_options' => null, + 'login_flow' => null, + 'login_flow_options' => null, 'request_id' => null, 'client_info' => null ]; @@ -161,47 +185,59 @@ class ProjectConfigSaveReq implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'external_name' => false, - 'email_from' => false, - 'sms_from' => false, - 'external_application_protocol_version' => false, - 'webhook_url' => false, - 'webhook_username' => false, - 'webhook_password' => false, - 'webhook_test_invalid_username' => false, - 'webhook_test_valid_username' => false, - 'webhook_test_valid_password' => false, - 'external_application_username' => false, - 'external_application_password' => false, - 'legacy_auth_methods_url' => false, - 'password_verify_url' => false, - 'auth_success_redirect_url' => false, - 'password_reset_url' => false, - 'allow_user_registration' => false, - 'allow_ip_stickiness' => false, - 'passkey_append_interval' => false, - 'fallback_language' => false, - 'auto_detect_language' => false, - 'integration_mode_hosted' => false, - 'integration_mode_api' => false, - 'integration_mode_web_component' => false, - 'has_existing_users' => false, - 'has_verified_session' => false, - 'has_generated_session' => false, - 'has_started_using_passkeys' => false, - 'application_url' => false, - 'use_cli' => false, - 'double_opt_in' => false, - 'user_full_name_required' => false, - 'webauthn_rpid' => false, - 'environment' => false, - 'web_component_debug' => false, - 'smtp_use_custom' => false, - 'smtp_host' => false, - 'smtp_port' => false, - 'smtp_username' => false, - 'smtp_password' => false, - 'request_id' => false, - 'client_info' => false + 'app_type' => false, + 'product_key' => false, + 'email_from' => false, + 'sms_from' => false, + 'external_application_protocol_version' => false, + 'webhook_url' => false, + 'webhook_actions' => false, + 'webhook_username' => false, + 'webhook_password' => false, + 'webhook_test_invalid_username' => false, + 'webhook_test_valid_username' => false, + 'webhook_test_valid_password' => false, + 'external_application_username' => false, + 'external_application_password' => false, + 'legacy_auth_methods_url' => false, + 'password_verify_url' => false, + 'auth_success_redirect_url' => false, + 'password_reset_url' => false, + 'allow_user_registration' => false, + 'allow_ip_stickiness' => false, + 'passkey_append_interval' => false, + 'fallback_language' => false, + 'auto_detect_language' => false, + 'integration_mode_hosted' => false, + 'integration_mode_api' => false, + 'integration_mode_web_component' => false, + 'has_existing_users' => false, + 'has_verified_session' => false, + 'has_generated_session' => false, + 'has_started_using_passkeys' => false, + 'has_started_using_sessions' => false, + 'application_url' => false, + 'use_cli' => false, + 'double_opt_in' => false, + 'user_full_name_required' => false, + 'webauthn_rpid' => false, + 'domain' => false, + 'environment' => false, + 'frontend_framework' => false, + 'backend_language' => false, + 'web_component_debug' => false, + 'smtp_use_custom' => false, + 'smtp_host' => false, + 'smtp_port' => false, + 'smtp_username' => false, + 'smtp_password' => false, + 'support_email' => false, + 'signup_flow' => false, + 'signup_flow_options' => false, + 'login_flow' => false, + 'login_flow_options' => false, + 'request_id' => false, + 'client_info' => false ]; /** @@ -291,10 +327,13 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'external_name' => 'externalName', + 'app_type' => 'appType', + 'product_key' => 'productKey', 'email_from' => 'emailFrom', 'sms_from' => 'smsFrom', 'external_application_protocol_version' => 'externalApplicationProtocolVersion', 'webhook_url' => 'webhookURL', + 'webhook_actions' => 'webhookActions', 'webhook_username' => 'webhookUsername', 'webhook_password' => 'webhookPassword', 'webhook_test_invalid_username' => 'webhookTestInvalidUsername', @@ -318,18 +357,27 @@ public function isNullableSetToNull(string $property): bool 'has_verified_session' => 'hasVerifiedSession', 'has_generated_session' => 'hasGeneratedSession', 'has_started_using_passkeys' => 'hasStartedUsingPasskeys', + 'has_started_using_sessions' => 'hasStartedUsingSessions', 'application_url' => 'applicationUrl', 'use_cli' => 'useCli', 'double_opt_in' => 'doubleOptIn', 'user_full_name_required' => 'userFullNameRequired', 'webauthn_rpid' => 'webauthnRPID', + 'domain' => 'domain', 'environment' => 'environment', + 'frontend_framework' => 'frontendFramework', + 'backend_language' => 'backendLanguage', 'web_component_debug' => 'webComponentDebug', 'smtp_use_custom' => 'smtpUseCustom', 'smtp_host' => 'smtpHost', 'smtp_port' => 'smtpPort', 'smtp_username' => 'smtpUsername', 'smtp_password' => 'smtpPassword', + 'support_email' => 'supportEmail', + 'signup_flow' => 'signupFlow', + 'signup_flow_options' => 'signupFlowOptions', + 'login_flow' => 'loginFlow', + 'login_flow_options' => 'loginFlowOptions', 'request_id' => 'requestID', 'client_info' => 'clientInfo' ]; @@ -341,10 +389,13 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'external_name' => 'setExternalName', + 'app_type' => 'setAppType', + 'product_key' => 'setProductKey', 'email_from' => 'setEmailFrom', 'sms_from' => 'setSmsFrom', 'external_application_protocol_version' => 'setExternalApplicationProtocolVersion', 'webhook_url' => 'setWebhookUrl', + 'webhook_actions' => 'setWebhookActions', 'webhook_username' => 'setWebhookUsername', 'webhook_password' => 'setWebhookPassword', 'webhook_test_invalid_username' => 'setWebhookTestInvalidUsername', @@ -368,18 +419,27 @@ public function isNullableSetToNull(string $property): bool 'has_verified_session' => 'setHasVerifiedSession', 'has_generated_session' => 'setHasGeneratedSession', 'has_started_using_passkeys' => 'setHasStartedUsingPasskeys', + 'has_started_using_sessions' => 'setHasStartedUsingSessions', 'application_url' => 'setApplicationUrl', 'use_cli' => 'setUseCli', 'double_opt_in' => 'setDoubleOptIn', 'user_full_name_required' => 'setUserFullNameRequired', 'webauthn_rpid' => 'setWebauthnRpid', + 'domain' => 'setDomain', 'environment' => 'setEnvironment', + 'frontend_framework' => 'setFrontendFramework', + 'backend_language' => 'setBackendLanguage', 'web_component_debug' => 'setWebComponentDebug', 'smtp_use_custom' => 'setSmtpUseCustom', 'smtp_host' => 'setSmtpHost', 'smtp_port' => 'setSmtpPort', 'smtp_username' => 'setSmtpUsername', 'smtp_password' => 'setSmtpPassword', + 'support_email' => 'setSupportEmail', + 'signup_flow' => 'setSignupFlow', + 'signup_flow_options' => 'setSignupFlowOptions', + 'login_flow' => 'setLoginFlow', + 'login_flow_options' => 'setLoginFlowOptions', 'request_id' => 'setRequestId', 'client_info' => 'setClientInfo' ]; @@ -391,10 +451,13 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'external_name' => 'getExternalName', + 'app_type' => 'getAppType', + 'product_key' => 'getProductKey', 'email_from' => 'getEmailFrom', 'sms_from' => 'getSmsFrom', 'external_application_protocol_version' => 'getExternalApplicationProtocolVersion', 'webhook_url' => 'getWebhookUrl', + 'webhook_actions' => 'getWebhookActions', 'webhook_username' => 'getWebhookUsername', 'webhook_password' => 'getWebhookPassword', 'webhook_test_invalid_username' => 'getWebhookTestInvalidUsername', @@ -418,18 +481,27 @@ public function isNullableSetToNull(string $property): bool 'has_verified_session' => 'getHasVerifiedSession', 'has_generated_session' => 'getHasGeneratedSession', 'has_started_using_passkeys' => 'getHasStartedUsingPasskeys', + 'has_started_using_sessions' => 'getHasStartedUsingSessions', 'application_url' => 'getApplicationUrl', 'use_cli' => 'getUseCli', 'double_opt_in' => 'getDoubleOptIn', 'user_full_name_required' => 'getUserFullNameRequired', 'webauthn_rpid' => 'getWebauthnRpid', + 'domain' => 'getDomain', 'environment' => 'getEnvironment', + 'frontend_framework' => 'getFrontendFramework', + 'backend_language' => 'getBackendLanguage', 'web_component_debug' => 'getWebComponentDebug', 'smtp_use_custom' => 'getSmtpUseCustom', 'smtp_host' => 'getSmtpHost', 'smtp_port' => 'getSmtpPort', 'smtp_username' => 'getSmtpUsername', 'smtp_password' => 'getSmtpPassword', + 'support_email' => 'getSupportEmail', + 'signup_flow' => 'getSignupFlow', + 'signup_flow_options' => 'getSignupFlowOptions', + 'login_flow' => 'getLoginFlow', + 'login_flow_options' => 'getLoginFlowOptions', 'request_id' => 'getRequestId', 'client_info' => 'getClientInfo' ]; @@ -486,6 +558,15 @@ public function getModelName() public const PASSKEY_APPEND_INTERVAL__3M = '3m'; public const ENVIRONMENT_DEV = 'dev'; public const ENVIRONMENT_PROD = 'prod'; + public const FRONTEND_FRAMEWORK_REACT = 'react'; + public const FRONTEND_FRAMEWORK_VUEJS = 'vuejs'; + public const FRONTEND_FRAMEWORK_VANILLAJS = 'vanillajs'; + public const BACKEND_LANGUAGE_JAVASCRIPT = 'javascript'; + public const BACKEND_LANGUAGE_PHP = 'php'; + public const BACKEND_LANGUAGE_GO = 'go'; + public const SIGNUP_FLOW_PASSKEY_WITH_EMAIL_OTP_FALLBACK = 'PasskeyWithEmailOTPFallback'; + public const SIGNUP_FLOW_EMAIL_OTP_SIGNUP = 'EmailOTPSignup'; + public const LOGIN_FLOW_PASSKEY_WITH_EMAIL_OTP_FALLBACK = 'PasskeyWithEmailOTPFallback'; /** * Gets allowable values of the enum @@ -531,6 +612,59 @@ public function getEnvironmentAllowableValues() ]; } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFrontendFrameworkAllowableValues() + { + return [ + self::FRONTEND_FRAMEWORK_REACT, + self::FRONTEND_FRAMEWORK_VUEJS, + self::FRONTEND_FRAMEWORK_VANILLAJS, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBackendLanguageAllowableValues() + { + return [ + self::BACKEND_LANGUAGE_JAVASCRIPT, + self::BACKEND_LANGUAGE_PHP, + self::BACKEND_LANGUAGE_GO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSignupFlowAllowableValues() + { + return [ + self::SIGNUP_FLOW_PASSKEY_WITH_EMAIL_OTP_FALLBACK, + self::SIGNUP_FLOW_EMAIL_OTP_SIGNUP, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLoginFlowAllowableValues() + { + return [ + self::LOGIN_FLOW_PASSKEY_WITH_EMAIL_OTP_FALLBACK, + ]; + } + /** * Associative array for storing property values * @@ -547,10 +681,13 @@ public function getEnvironmentAllowableValues() public function __construct(array $data = null) { $this->setIfExists('external_name', $data ?? [], null); + $this->setIfExists('app_type', $data ?? [], null); + $this->setIfExists('product_key', $data ?? [], null); $this->setIfExists('email_from', $data ?? [], null); $this->setIfExists('sms_from', $data ?? [], null); $this->setIfExists('external_application_protocol_version', $data ?? [], null); $this->setIfExists('webhook_url', $data ?? [], null); + $this->setIfExists('webhook_actions', $data ?? [], null); $this->setIfExists('webhook_username', $data ?? [], null); $this->setIfExists('webhook_password', $data ?? [], null); $this->setIfExists('webhook_test_invalid_username', $data ?? [], null); @@ -574,18 +711,27 @@ public function __construct(array $data = null) $this->setIfExists('has_verified_session', $data ?? [], null); $this->setIfExists('has_generated_session', $data ?? [], null); $this->setIfExists('has_started_using_passkeys', $data ?? [], null); + $this->setIfExists('has_started_using_sessions', $data ?? [], null); $this->setIfExists('application_url', $data ?? [], null); $this->setIfExists('use_cli', $data ?? [], null); $this->setIfExists('double_opt_in', $data ?? [], null); $this->setIfExists('user_full_name_required', $data ?? [], null); $this->setIfExists('webauthn_rpid', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); $this->setIfExists('environment', $data ?? [], null); + $this->setIfExists('frontend_framework', $data ?? [], null); + $this->setIfExists('backend_language', $data ?? [], null); $this->setIfExists('web_component_debug', $data ?? [], null); $this->setIfExists('smtp_use_custom', $data ?? [], null); $this->setIfExists('smtp_host', $data ?? [], null); $this->setIfExists('smtp_port', $data ?? [], null); $this->setIfExists('smtp_username', $data ?? [], null); $this->setIfExists('smtp_password', $data ?? [], null); + $this->setIfExists('support_email', $data ?? [], null); + $this->setIfExists('signup_flow', $data ?? [], null); + $this->setIfExists('signup_flow_options', $data ?? [], null); + $this->setIfExists('login_flow', $data ?? [], null); + $this->setIfExists('login_flow_options', $data ?? [], null); $this->setIfExists('request_id', $data ?? [], null); $this->setIfExists('client_info', $data ?? [], null); } @@ -617,15 +763,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['external_name'] === null) { - $invalidProperties[] = "'external_name' can't be null"; - } - if ($this->container['email_from'] === null) { - $invalidProperties[] = "'email_from' can't be null"; - } - if ($this->container['sms_from'] === null) { - $invalidProperties[] = "'sms_from' can't be null"; - } $allowedValues = $this->getExternalApplicationProtocolVersionAllowableValues(); if (!is_null($this->container['external_application_protocol_version']) && !in_array($this->container['external_application_protocol_version'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -653,6 +790,42 @@ public function listInvalidProperties() ); } + $allowedValues = $this->getFrontendFrameworkAllowableValues(); + if (!is_null($this->container['frontend_framework']) && !in_array($this->container['frontend_framework'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'frontend_framework', must be one of '%s'", + $this->container['frontend_framework'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBackendLanguageAllowableValues(); + if (!is_null($this->container['backend_language']) && !in_array($this->container['backend_language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'backend_language', must be one of '%s'", + $this->container['backend_language'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getSignupFlowAllowableValues(); + if (!is_null($this->container['signup_flow']) && !in_array($this->container['signup_flow'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'signup_flow', must be one of '%s'", + $this->container['signup_flow'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getLoginFlowAllowableValues(); + if (!is_null($this->container['login_flow']) && !in_array($this->container['login_flow'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'login_flow', must be one of '%s'", + $this->container['login_flow'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -671,7 +844,7 @@ public function valid() /** * Gets external_name * - * @return string + * @return string|null */ public function getExternalName() { @@ -681,7 +854,7 @@ public function getExternalName() /** * Sets external_name * - * @param string $external_name external_name + * @param string|null $external_name external_name * * @return self */ @@ -695,10 +868,64 @@ public function setExternalName($external_name) return $this; } + /** + * Gets app_type + * + * @return \Corbado\Generated\Model\AppType|null + */ + public function getAppType() + { + return $this->container['app_type']; + } + + /** + * Sets app_type + * + * @param \Corbado\Generated\Model\AppType|null $app_type app_type + * + * @return self + */ + public function setAppType($app_type) + { + if (is_null($app_type)) { + throw new \InvalidArgumentException('non-nullable app_type cannot be null'); + } + $this->container['app_type'] = $app_type; + + return $this; + } + + /** + * Gets product_key + * + * @return string|null + */ + public function getProductKey() + { + return $this->container['product_key']; + } + + /** + * Sets product_key + * + * @param string|null $product_key product_key + * + * @return self + */ + public function setProductKey($product_key) + { + if (is_null($product_key)) { + throw new \InvalidArgumentException('non-nullable product_key cannot be null'); + } + $this->container['product_key'] = $product_key; + + return $this; + } + /** * Gets email_from * - * @return string + * @return string|null */ public function getEmailFrom() { @@ -708,7 +935,7 @@ public function getEmailFrom() /** * Sets email_from * - * @param string $email_from email_from + * @param string|null $email_from email_from * * @return self */ @@ -725,7 +952,7 @@ public function setEmailFrom($email_from) /** * Gets sms_from * - * @return string + * @return string|null */ public function getSmsFrom() { @@ -735,7 +962,7 @@ public function getSmsFrom() /** * Sets sms_from * - * @param string $sms_from sms_from + * @param string|null $sms_from sms_from * * @return self */ @@ -813,6 +1040,33 @@ public function setWebhookUrl($webhook_url) return $this; } + /** + * Gets webhook_actions + * + * @return string[]|null + */ + public function getWebhookActions() + { + return $this->container['webhook_actions']; + } + + /** + * Sets webhook_actions + * + * @param string[]|null $webhook_actions webhook_actions + * + * @return self + */ + public function setWebhookActions($webhook_actions) + { + if (is_null($webhook_actions)) { + throw new \InvalidArgumentException('non-nullable webhook_actions cannot be null'); + } + $this->container['webhook_actions'] = $webhook_actions; + + return $this; + } + /** * Gets webhook_username * @@ -1444,6 +1698,33 @@ public function setHasStartedUsingPasskeys($has_started_using_passkeys) return $this; } + /** + * Gets has_started_using_sessions + * + * @return bool|null + */ + public function getHasStartedUsingSessions() + { + return $this->container['has_started_using_sessions']; + } + + /** + * Sets has_started_using_sessions + * + * @param bool|null $has_started_using_sessions has_started_using_sessions + * + * @return self + */ + public function setHasStartedUsingSessions($has_started_using_sessions) + { + if (is_null($has_started_using_sessions)) { + throw new \InvalidArgumentException('non-nullable has_started_using_sessions cannot be null'); + } + $this->container['has_started_using_sessions'] = $has_started_using_sessions; + + return $this; + } + /** * Gets application_url * @@ -1579,6 +1860,33 @@ public function setWebauthnRpid($webauthn_rpid) return $this; } + /** + * Gets domain + * + * @return string|null + */ + public function getDomain() + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string|null $domain domain + * + * @return self + */ + public function setDomain($domain) + { + if (is_null($domain)) { + throw new \InvalidArgumentException('non-nullable domain cannot be null'); + } + $this->container['domain'] = $domain; + + return $this; + } + /** * Gets environment * @@ -1616,6 +1924,80 @@ public function setEnvironment($environment) return $this; } + /** + * Gets frontend_framework + * + * @return string|null + */ + public function getFrontendFramework() + { + return $this->container['frontend_framework']; + } + + /** + * Sets frontend_framework + * + * @param string|null $frontend_framework frontend_framework + * + * @return self + */ + public function setFrontendFramework($frontend_framework) + { + if (is_null($frontend_framework)) { + throw new \InvalidArgumentException('non-nullable frontend_framework cannot be null'); + } + $allowedValues = $this->getFrontendFrameworkAllowableValues(); + if (!in_array($frontend_framework, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'frontend_framework', must be one of '%s'", + $frontend_framework, + implode("', '", $allowedValues) + ) + ); + } + $this->container['frontend_framework'] = $frontend_framework; + + return $this; + } + + /** + * Gets backend_language + * + * @return string|null + */ + public function getBackendLanguage() + { + return $this->container['backend_language']; + } + + /** + * Sets backend_language + * + * @param string|null $backend_language backend_language + * + * @return self + */ + public function setBackendLanguage($backend_language) + { + if (is_null($backend_language)) { + throw new \InvalidArgumentException('non-nullable backend_language cannot be null'); + } + $allowedValues = $this->getBackendLanguageAllowableValues(); + if (!in_array($backend_language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'backend_language', must be one of '%s'", + $backend_language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['backend_language'] = $backend_language; + + return $this; + } + /** * Gets web_component_debug * @@ -1778,6 +2160,161 @@ public function setSmtpPassword($smtp_password) return $this; } + /** + * Gets support_email + * + * @return string|null + */ + public function getSupportEmail() + { + return $this->container['support_email']; + } + + /** + * Sets support_email + * + * @param string|null $support_email support_email + * + * @return self + */ + public function setSupportEmail($support_email) + { + if (is_null($support_email)) { + throw new \InvalidArgumentException('non-nullable support_email cannot be null'); + } + $this->container['support_email'] = $support_email; + + return $this; + } + + /** + * Gets signup_flow + * + * @return string|null + */ + public function getSignupFlow() + { + return $this->container['signup_flow']; + } + + /** + * Sets signup_flow + * + * @param string|null $signup_flow signup_flow + * + * @return self + */ + public function setSignupFlow($signup_flow) + { + if (is_null($signup_flow)) { + throw new \InvalidArgumentException('non-nullable signup_flow cannot be null'); + } + $allowedValues = $this->getSignupFlowAllowableValues(); + if (!in_array($signup_flow, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'signup_flow', must be one of '%s'", + $signup_flow, + implode("', '", $allowedValues) + ) + ); + } + $this->container['signup_flow'] = $signup_flow; + + return $this; + } + + /** + * Gets signup_flow_options + * + * @return object|null + */ + public function getSignupFlowOptions() + { + return $this->container['signup_flow_options']; + } + + /** + * Sets signup_flow_options + * + * @param object|null $signup_flow_options signup_flow_options + * + * @return self + */ + public function setSignupFlowOptions($signup_flow_options) + { + if (is_null($signup_flow_options)) { + throw new \InvalidArgumentException('non-nullable signup_flow_options cannot be null'); + } + $this->container['signup_flow_options'] = $signup_flow_options; + + return $this; + } + + /** + * Gets login_flow + * + * @return string|null + */ + public function getLoginFlow() + { + return $this->container['login_flow']; + } + + /** + * Sets login_flow + * + * @param string|null $login_flow login_flow + * + * @return self + */ + public function setLoginFlow($login_flow) + { + if (is_null($login_flow)) { + throw new \InvalidArgumentException('non-nullable login_flow cannot be null'); + } + $allowedValues = $this->getLoginFlowAllowableValues(); + if (!in_array($login_flow, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'login_flow', must be one of '%s'", + $login_flow, + implode("', '", $allowedValues) + ) + ); + } + $this->container['login_flow'] = $login_flow; + + return $this; + } + + /** + * Gets login_flow_options + * + * @return object|null + */ + public function getLoginFlowOptions() + { + return $this->container['login_flow_options']; + } + + /** + * Sets login_flow_options + * + * @param object|null $login_flow_options login_flow_options + * + * @return self + */ + public function setLoginFlowOptions($login_flow_options) + { + if (is_null($login_flow_options)) { + throw new \InvalidArgumentException('non-nullable login_flow_options cannot be null'); + } + $this->container['login_flow_options'] = $login_flow_options; + + return $this; + } + /** * Gets request_id * diff --git a/src/Generated/Model/ProjectConfigWebhookTestReq.php b/src/Generated/Model/ProjectConfigWebhookTestReq.php index 6cbf5c9..755d03f 100644 --- a/src/Generated/Model/ProjectConfigWebhookTestReq.php +++ b/src/Generated/Model/ProjectConfigWebhookTestReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class ProjectConfigWebhookTestReq implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'action' => false, - 'request_id' => false, - 'client_info' => false + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/ProjectConfigWebhookTestRsp.php b/src/Generated/Model/ProjectConfigWebhookTestRsp.php index 4e8b276..6d48ca7 100644 --- a/src/Generated/Model/ProjectConfigWebhookTestRsp.php +++ b/src/Generated/Model/ProjectConfigWebhookTestRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class ProjectConfigWebhookTestRsp implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/ProjectConfigWebhookTestRspAllOfData.php b/src/Generated/Model/ProjectConfigWebhookTestRspAllOfData.php index 0c61f87..27c442a 100644 --- a/src/Generated/Model/ProjectConfigWebhookTestRspAllOfData.php +++ b/src/Generated/Model/ProjectConfigWebhookTestRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class ProjectConfigWebhookTestRspAllOfData implements ModelInterface, ArrayAcces */ protected static array $openAPINullables = [ 'code' => false, - 'details' => false, - 'runtime' => false + 'details' => false, + 'runtime' => false ]; /** diff --git a/src/Generated/Model/ProjectSecretCreateReq.php b/src/Generated/Model/ProjectSecretCreateReq.php index 1fe772a..5e20996 100644 --- a/src/Generated/Model/ProjectSecretCreateReq.php +++ b/src/Generated/Model/ProjectSecretCreateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class ProjectSecretCreateReq implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/ProjectSecretCreateRsp.php b/src/Generated/Model/ProjectSecretCreateRsp.php index e6bfba1..72d1654 100644 --- a/src/Generated/Model/ProjectSecretCreateRsp.php +++ b/src/Generated/Model/ProjectSecretCreateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -93,13 +93,13 @@ class ProjectSecretCreateRsp implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'id' => false, - 'secret' => false, - 'hint' => false, - 'created' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'id' => false, + 'secret' => false, + 'hint' => false, + 'created' => false ]; /** diff --git a/src/Generated/Model/ProjectSecretDeleteReq.php b/src/Generated/Model/ProjectSecretDeleteReq.php index b3bbced..0e86b21 100644 --- a/src/Generated/Model/ProjectSecretDeleteReq.php +++ b/src/Generated/Model/ProjectSecretDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class ProjectSecretDeleteReq implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/ProjectSecretItem.php b/src/Generated/Model/ProjectSecretItem.php index 7417571..51afe3b 100644 --- a/src/Generated/Model/ProjectSecretItem.php +++ b/src/Generated/Model/ProjectSecretItem.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class ProjectSecretItem implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static array $openAPINullables = [ 'id' => false, - 'secret' => false, - 'hint' => false, - 'created' => false + 'secret' => false, + 'hint' => false, + 'created' => false ]; /** diff --git a/src/Generated/Model/ProjectSecretListRsp.php b/src/Generated/Model/ProjectSecretListRsp.php index 7ab31d7..562199c 100644 --- a/src/Generated/Model/ProjectSecretListRsp.php +++ b/src/Generated/Model/ProjectSecretListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class ProjectSecretListRsp implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'rows' => false, - 'paging' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'rows' => false, + 'paging' => false ]; /** diff --git a/src/Generated/Model/RequestData.php b/src/Generated/Model/RequestData.php index 85dba8c..6cbe15a 100644 --- a/src/Generated/Model/RequestData.php +++ b/src/Generated/Model/RequestData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -82,7 +82,7 @@ class RequestData implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'request_id' => false, - 'link' => false + 'link' => false ]; /** diff --git a/src/Generated/Model/RequestLog.php b/src/Generated/Model/RequestLog.php index 053ca37..7b04a86 100644 --- a/src/Generated/Model/RequestLog.php +++ b/src/Generated/Model/RequestLog.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -62,10 +62,12 @@ class RequestLog implements ModelInterface, ArrayAccess, \JsonSerializable 'request_id' => 'string', 'project_id' => 'string', 'user_id' => 'string', + 'application' => 'string', 'method' => 'string', 'endpoint' => 'string', 'source' => 'string', 'request' => 'string', + 'request_headers' => 'array', 'query_params' => 'string', 'response_status' => 'float', 'response' => 'string', @@ -87,10 +89,12 @@ class RequestLog implements ModelInterface, ArrayAccess, \JsonSerializable 'request_id' => null, 'project_id' => null, 'user_id' => null, + 'application' => null, 'method' => null, 'endpoint' => null, 'source' => null, 'request' => null, + 'request_headers' => null, 'query_params' => null, 'response_status' => null, 'response' => null, @@ -108,20 +112,22 @@ class RequestLog implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'request_id' => false, - 'project_id' => false, - 'user_id' => false, - 'method' => false, - 'endpoint' => false, - 'source' => false, - 'request' => false, - 'query_params' => false, - 'response_status' => false, - 'response' => false, - 'runtime' => false, - 'remote_address' => false, - 'created' => false, - 'tags' => false, - 'details' => false + 'project_id' => false, + 'user_id' => false, + 'application' => false, + 'method' => false, + 'endpoint' => false, + 'source' => false, + 'request' => false, + 'request_headers' => false, + 'query_params' => false, + 'response_status' => false, + 'response' => false, + 'runtime' => false, + 'remote_address' => false, + 'created' => false, + 'tags' => false, + 'details' => false ]; /** @@ -213,10 +219,12 @@ public function isNullableSetToNull(string $property): bool 'request_id' => 'requestID', 'project_id' => 'projectID', 'user_id' => 'userID', + 'application' => 'application', 'method' => 'method', 'endpoint' => 'endpoint', 'source' => 'source', 'request' => 'request', + 'request_headers' => 'requestHeaders', 'query_params' => 'queryParams', 'response_status' => 'responseStatus', 'response' => 'response', @@ -236,10 +244,12 @@ public function isNullableSetToNull(string $property): bool 'request_id' => 'setRequestId', 'project_id' => 'setProjectId', 'user_id' => 'setUserId', + 'application' => 'setApplication', 'method' => 'setMethod', 'endpoint' => 'setEndpoint', 'source' => 'setSource', 'request' => 'setRequest', + 'request_headers' => 'setRequestHeaders', 'query_params' => 'setQueryParams', 'response_status' => 'setResponseStatus', 'response' => 'setResponse', @@ -259,10 +269,12 @@ public function isNullableSetToNull(string $property): bool 'request_id' => 'getRequestId', 'project_id' => 'getProjectId', 'user_id' => 'getUserId', + 'application' => 'getApplication', 'method' => 'getMethod', 'endpoint' => 'getEndpoint', 'source' => 'getSource', 'request' => 'getRequest', + 'request_headers' => 'getRequestHeaders', 'query_params' => 'getQueryParams', 'response_status' => 'getResponseStatus', 'response' => 'getResponse', @@ -333,10 +345,12 @@ public function __construct(array $data = null) $this->setIfExists('request_id', $data ?? [], null); $this->setIfExists('project_id', $data ?? [], null); $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('application', $data ?? [], null); $this->setIfExists('method', $data ?? [], null); $this->setIfExists('endpoint', $data ?? [], null); $this->setIfExists('source', $data ?? [], null); $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('request_headers', $data ?? [], null); $this->setIfExists('query_params', $data ?? [], null); $this->setIfExists('response_status', $data ?? [], null); $this->setIfExists('response', $data ?? [], null); @@ -383,6 +397,9 @@ public function listInvalidProperties() if ($this->container['user_id'] === null) { $invalidProperties[] = "'user_id' can't be null"; } + if ($this->container['application'] === null) { + $invalidProperties[] = "'application' can't be null"; + } if ($this->container['method'] === null) { $invalidProperties[] = "'method' can't be null"; } @@ -395,6 +412,9 @@ public function listInvalidProperties() if ($this->container['request'] === null) { $invalidProperties[] = "'request' can't be null"; } + if ($this->container['request_headers'] === null) { + $invalidProperties[] = "'request_headers' can't be null"; + } if ($this->container['query_params'] === null) { $invalidProperties[] = "'query_params' can't be null"; } @@ -515,6 +535,33 @@ public function setUserId($user_id) return $this; } + /** + * Gets application + * + * @return string + */ + public function getApplication() + { + return $this->container['application']; + } + + /** + * Sets application + * + * @param string $application Application this request was processed with + * + * @return self + */ + public function setApplication($application) + { + if (is_null($application)) { + throw new \InvalidArgumentException('non-nullable application cannot be null'); + } + $this->container['application'] = $application; + + return $this; + } + /** * Gets method * @@ -623,6 +670,33 @@ public function setRequest($request) return $this; } + /** + * Gets request_headers + * + * @return array + */ + public function getRequestHeaders() + { + return $this->container['request_headers']; + } + + /** + * Sets request_headers + * + * @param array $request_headers Request headers + * + * @return self + */ + public function setRequestHeaders($request_headers) + { + if (is_null($request_headers)) { + throw new \InvalidArgumentException('non-nullable request_headers cannot be null'); + } + $this->container['request_headers'] = $request_headers; + + return $this; + } + /** * Gets query_params * diff --git a/src/Generated/Model/RequestLogGetRsp.php b/src/Generated/Model/RequestLogGetRsp.php index 79a89c9..18a5b4f 100644 --- a/src/Generated/Model/RequestLogGetRsp.php +++ b/src/Generated/Model/RequestLogGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class RequestLogGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/RequestLogsListRsp.php b/src/Generated/Model/RequestLogsListRsp.php index 6249d28..ca7cf3f 100644 --- a/src/Generated/Model/RequestLogsListRsp.php +++ b/src/Generated/Model/RequestLogsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class RequestLogsListRsp implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/RequestLogsListRspAllOfData.php b/src/Generated/Model/RequestLogsListRspAllOfData.php index 75885e5..b828509 100644 --- a/src/Generated/Model/RequestLogsListRspAllOfData.php +++ b/src/Generated/Model/RequestLogsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class RequestLogsListRspAllOfData implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'logs' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/SessionConfig.php b/src/Generated/Model/SessionConfig.php index c760751..ff835aa 100644 --- a/src/Generated/Model/SessionConfig.php +++ b/src/Generated/Model/SessionConfig.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -59,7 +59,8 @@ class SessionConfig implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'project_id' => 'string', - 'version' => 'string', + 'app_type' => '\Corbado\Generated\Model\AppType', + 'active' => 'bool', 'short_lifetime_minutes' => 'int', 'short_cookie_domain' => 'string', 'short_cookie_secure' => 'bool', @@ -68,6 +69,7 @@ class SessionConfig implements ModelInterface, ArrayAccess, \JsonSerializable 'long_lifetime_unit' => 'string', 'long_inactivity_value' => 'int', 'long_inactivity_unit' => 'string', + 'jwt_audience' => 'string', 'created' => 'string', 'updated' => 'string' ]; @@ -81,7 +83,8 @@ class SessionConfig implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'project_id' => null, - 'version' => null, + 'app_type' => null, + 'active' => null, 'short_lifetime_minutes' => null, 'short_cookie_domain' => null, 'short_cookie_secure' => null, @@ -90,6 +93,7 @@ class SessionConfig implements ModelInterface, ArrayAccess, \JsonSerializable 'long_lifetime_unit' => null, 'long_inactivity_value' => null, 'long_inactivity_unit' => null, + 'jwt_audience' => null, 'created' => null, 'updated' => null ]; @@ -101,17 +105,19 @@ class SessionConfig implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'project_id' => false, - 'version' => false, - 'short_lifetime_minutes' => false, - 'short_cookie_domain' => false, - 'short_cookie_secure' => false, - 'short_cookie_same_site' => false, - 'long_lifetime_value' => false, - 'long_lifetime_unit' => false, - 'long_inactivity_value' => false, - 'long_inactivity_unit' => false, - 'created' => false, - 'updated' => false + 'app_type' => false, + 'active' => false, + 'short_lifetime_minutes' => false, + 'short_cookie_domain' => false, + 'short_cookie_secure' => false, + 'short_cookie_same_site' => false, + 'long_lifetime_value' => false, + 'long_lifetime_unit' => false, + 'long_inactivity_value' => false, + 'long_inactivity_unit' => false, + 'jwt_audience' => false, + 'created' => false, + 'updated' => false ]; /** @@ -201,7 +207,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'project_id' => 'projectID', - 'version' => 'version', + 'app_type' => 'appType', + 'active' => 'active', 'short_lifetime_minutes' => 'shortLifetimeMinutes', 'short_cookie_domain' => 'shortCookieDomain', 'short_cookie_secure' => 'shortCookieSecure', @@ -210,6 +217,7 @@ public function isNullableSetToNull(string $property): bool 'long_lifetime_unit' => 'longLifetimeUnit', 'long_inactivity_value' => 'longInactivityValue', 'long_inactivity_unit' => 'longInactivityUnit', + 'jwt_audience' => 'jwtAudience', 'created' => 'created', 'updated' => 'updated' ]; @@ -221,7 +229,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'project_id' => 'setProjectId', - 'version' => 'setVersion', + 'app_type' => 'setAppType', + 'active' => 'setActive', 'short_lifetime_minutes' => 'setShortLifetimeMinutes', 'short_cookie_domain' => 'setShortCookieDomain', 'short_cookie_secure' => 'setShortCookieSecure', @@ -230,6 +239,7 @@ public function isNullableSetToNull(string $property): bool 'long_lifetime_unit' => 'setLongLifetimeUnit', 'long_inactivity_value' => 'setLongInactivityValue', 'long_inactivity_unit' => 'setLongInactivityUnit', + 'jwt_audience' => 'setJwtAudience', 'created' => 'setCreated', 'updated' => 'setUpdated' ]; @@ -241,7 +251,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'project_id' => 'getProjectId', - 'version' => 'getVersion', + 'app_type' => 'getAppType', + 'active' => 'getActive', 'short_lifetime_minutes' => 'getShortLifetimeMinutes', 'short_cookie_domain' => 'getShortCookieDomain', 'short_cookie_secure' => 'getShortCookieSecure', @@ -250,6 +261,7 @@ public function isNullableSetToNull(string $property): bool 'long_lifetime_unit' => 'getLongLifetimeUnit', 'long_inactivity_value' => 'getLongInactivityValue', 'long_inactivity_unit' => 'getLongInactivityUnit', + 'jwt_audience' => 'getJwtAudience', 'created' => 'getCreated', 'updated' => 'getUpdated' ]; @@ -363,7 +375,8 @@ public function getLongInactivityUnitAllowableValues() public function __construct(array $data = null) { $this->setIfExists('project_id', $data ?? [], null); - $this->setIfExists('version', $data ?? [], null); + $this->setIfExists('app_type', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); $this->setIfExists('short_lifetime_minutes', $data ?? [], null); $this->setIfExists('short_cookie_domain', $data ?? [], null); $this->setIfExists('short_cookie_secure', $data ?? [], null); @@ -372,6 +385,7 @@ public function __construct(array $data = null) $this->setIfExists('long_lifetime_unit', $data ?? [], null); $this->setIfExists('long_inactivity_value', $data ?? [], null); $this->setIfExists('long_inactivity_unit', $data ?? [], null); + $this->setIfExists('jwt_audience', $data ?? [], null); $this->setIfExists('created', $data ?? [], null); $this->setIfExists('updated', $data ?? [], null); } @@ -406,8 +420,8 @@ public function listInvalidProperties() if ($this->container['project_id'] === null) { $invalidProperties[] = "'project_id' can't be null"; } - if ($this->container['version'] === null) { - $invalidProperties[] = "'version' can't be null"; + if ($this->container['app_type'] === null) { + $invalidProperties[] = "'app_type' can't be null"; } if ($this->container['short_lifetime_minutes'] === null) { $invalidProperties[] = "'short_lifetime_minutes' can't be null"; @@ -460,6 +474,9 @@ public function listInvalidProperties() ); } + if ($this->container['jwt_audience'] === null) { + $invalidProperties[] = "'jwt_audience' can't be null"; + } if ($this->container['created'] === null) { $invalidProperties[] = "'created' can't be null"; } @@ -509,28 +526,55 @@ public function setProjectId($project_id) } /** - * Gets version + * Gets app_type * - * @return string + * @return \Corbado\Generated\Model\AppType + */ + public function getAppType() + { + return $this->container['app_type']; + } + + /** + * Sets app_type + * + * @param \Corbado\Generated\Model\AppType $app_type app_type + * + * @return self + */ + public function setAppType($app_type) + { + if (is_null($app_type)) { + throw new \InvalidArgumentException('non-nullable app_type cannot be null'); + } + $this->container['app_type'] = $app_type; + + return $this; + } + + /** + * Gets active + * + * @return bool|null */ - public function getVersion() + public function getActive() { - return $this->container['version']; + return $this->container['active']; } /** - * Sets version + * Sets active * - * @param string $version version + * @param bool|null $active active * * @return self */ - public function setVersion($version) + public function setActive($active) { - if (is_null($version)) { - throw new \InvalidArgumentException('non-nullable version cannot be null'); + if (is_null($active)) { + throw new \InvalidArgumentException('non-nullable active cannot be null'); } - $this->container['version'] = $version; + $this->container['active'] = $active; return $this; } @@ -781,6 +825,33 @@ public function setLongInactivityUnit($long_inactivity_unit) return $this; } + /** + * Gets jwt_audience + * + * @return string + */ + public function getJwtAudience() + { + return $this->container['jwt_audience']; + } + + /** + * Sets jwt_audience + * + * @param string $jwt_audience jwt_audience + * + * @return self + */ + public function setJwtAudience($jwt_audience) + { + if (is_null($jwt_audience)) { + throw new \InvalidArgumentException('non-nullable jwt_audience cannot be null'); + } + $this->container['jwt_audience'] = $jwt_audience; + + return $this; + } + /** * Gets created * diff --git a/src/Generated/Model/SessionConfigGetRsp.php b/src/Generated/Model/SessionConfigGetRsp.php index cfdad2f..1c0293d 100644 --- a/src/Generated/Model/SessionConfigGetRsp.php +++ b/src/Generated/Model/SessionConfigGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class SessionConfigGetRsp implements ModelInterface, ArrayAccess, \JsonSerializa */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/SessionConfigUpdateReq.php b/src/Generated/Model/SessionConfigUpdateReq.php index 1512395..3c93691 100644 --- a/src/Generated/Model/SessionConfigUpdateReq.php +++ b/src/Generated/Model/SessionConfigUpdateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -58,7 +58,8 @@ class SessionConfigUpdateReq implements ModelInterface, ArrayAccess, \JsonSerial * @var string[] */ protected static $openAPITypes = [ - 'version' => 'string', + 'app_type' => '\Corbado\Generated\Model\AppType', + 'active' => 'bool', 'short_lifetime_minutes' => 'int', 'short_cookie_domain' => 'string', 'short_cookie_secure' => 'bool', @@ -79,7 +80,8 @@ class SessionConfigUpdateReq implements ModelInterface, ArrayAccess, \JsonSerial * @psalm-var array */ protected static $openAPIFormats = [ - 'version' => null, + 'app_type' => null, + 'active' => null, 'short_lifetime_minutes' => null, 'short_cookie_domain' => null, 'short_cookie_secure' => null, @@ -98,17 +100,18 @@ class SessionConfigUpdateReq implements ModelInterface, ArrayAccess, \JsonSerial * @var boolean[] */ protected static array $openAPINullables = [ - 'version' => false, - 'short_lifetime_minutes' => false, - 'short_cookie_domain' => false, - 'short_cookie_secure' => false, - 'short_cookie_same_site' => false, - 'long_lifetime_value' => false, - 'long_lifetime_unit' => false, - 'long_inactivity_value' => false, - 'long_inactivity_unit' => false, - 'request_id' => false, - 'client_info' => false + 'app_type' => false, + 'active' => false, + 'short_lifetime_minutes' => false, + 'short_cookie_domain' => false, + 'short_cookie_secure' => false, + 'short_cookie_same_site' => false, + 'long_lifetime_value' => false, + 'long_lifetime_unit' => false, + 'long_inactivity_value' => false, + 'long_inactivity_unit' => false, + 'request_id' => false, + 'client_info' => false ]; /** @@ -197,7 +200,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'version' => 'version', + 'app_type' => 'appType', + 'active' => 'active', 'short_lifetime_minutes' => 'shortLifetimeMinutes', 'short_cookie_domain' => 'shortCookieDomain', 'short_cookie_secure' => 'shortCookieSecure', @@ -216,7 +220,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'version' => 'setVersion', + 'app_type' => 'setAppType', + 'active' => 'setActive', 'short_lifetime_minutes' => 'setShortLifetimeMinutes', 'short_cookie_domain' => 'setShortCookieDomain', 'short_cookie_secure' => 'setShortCookieSecure', @@ -235,7 +240,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'version' => 'getVersion', + 'app_type' => 'getAppType', + 'active' => 'getActive', 'short_lifetime_minutes' => 'getShortLifetimeMinutes', 'short_cookie_domain' => 'getShortCookieDomain', 'short_cookie_secure' => 'getShortCookieSecure', @@ -352,7 +358,8 @@ public function getLongInactivityUnitAllowableValues() */ public function __construct(array $data = null) { - $this->setIfExists('version', $data ?? [], null); + $this->setIfExists('app_type', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); $this->setIfExists('short_lifetime_minutes', $data ?? [], null); $this->setIfExists('short_cookie_domain', $data ?? [], null); $this->setIfExists('short_cookie_secure', $data ?? [], null); @@ -392,6 +399,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['app_type'] === null) { + $invalidProperties[] = "'app_type' can't be null"; + } $allowedValues = $this->getShortCookieSameSiteAllowableValues(); if (!is_null($this->container['short_cookie_same_site']) && !in_array($this->container['short_cookie_same_site'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -435,28 +445,55 @@ public function valid() /** - * Gets version + * Gets app_type * - * @return string|null + * @return \Corbado\Generated\Model\AppType + */ + public function getAppType() + { + return $this->container['app_type']; + } + + /** + * Sets app_type + * + * @param \Corbado\Generated\Model\AppType $app_type app_type + * + * @return self + */ + public function setAppType($app_type) + { + if (is_null($app_type)) { + throw new \InvalidArgumentException('non-nullable app_type cannot be null'); + } + $this->container['app_type'] = $app_type; + + return $this; + } + + /** + * Gets active + * + * @return bool|null */ - public function getVersion() + public function getActive() { - return $this->container['version']; + return $this->container['active']; } /** - * Sets version + * Sets active * - * @param string|null $version version + * @param bool|null $active active * * @return self */ - public function setVersion($version) + public function setActive($active) { - if (is_null($version)) { - throw new \InvalidArgumentException('non-nullable version cannot be null'); + if (is_null($active)) { + throw new \InvalidArgumentException('non-nullable active cannot be null'); } - $this->container['version'] = $version; + $this->container['active'] = $active; return $this; } diff --git a/src/Generated/Model/SessionTokenCreateReq.php b/src/Generated/Model/SessionTokenCreateReq.php index 877dc4f..d645452 100644 --- a/src/Generated/Model/SessionTokenCreateReq.php +++ b/src/Generated/Model/SessionTokenCreateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class SessionTokenCreateReq implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'user_id' => false, - 'user_data' => false, - 'request_id' => false, - 'client_info' => false + 'user_data' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/SessionTokenCreateRsp.php b/src/Generated/Model/SessionTokenCreateRsp.php index 9db568a..b4e192d 100644 --- a/src/Generated/Model/SessionTokenCreateRsp.php +++ b/src/Generated/Model/SessionTokenCreateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class SessionTokenCreateRsp implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/SessionTokenCreateRspAllOfData.php b/src/Generated/Model/SessionTokenCreateRspAllOfData.php index da6127a..d44144b 100644 --- a/src/Generated/Model/SessionTokenCreateRspAllOfData.php +++ b/src/Generated/Model/SessionTokenCreateRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/SessionTokenVerifyReq.php b/src/Generated/Model/SessionTokenVerifyReq.php index fcba402..e34a068 100644 --- a/src/Generated/Model/SessionTokenVerifyReq.php +++ b/src/Generated/Model/SessionTokenVerifyReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class SessionTokenVerifyReq implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'token' => false, - 'request_id' => false, - 'client_info' => false + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/SessionTokenVerifyRsp.php b/src/Generated/Model/SessionTokenVerifyRsp.php index 0f5cf74..0d6319b 100644 --- a/src/Generated/Model/SessionTokenVerifyRsp.php +++ b/src/Generated/Model/SessionTokenVerifyRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class SessionTokenVerifyRsp implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/SessionTokenVerifyRspAllOfData.php b/src/Generated/Model/SessionTokenVerifyRspAllOfData.php index 254a479..043c334 100644 --- a/src/Generated/Model/SessionTokenVerifyRspAllOfData.php +++ b/src/Generated/Model/SessionTokenVerifyRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class SessionTokenVerifyRspAllOfData implements ModelInterface, ArrayAccess, \Js */ protected static array $openAPINullables = [ 'user_id' => false, - 'user' => false, - 'user_data' => false + 'user' => false, + 'user_data' => false ]; /** diff --git a/src/Generated/Model/SmsCodeSendReq.php b/src/Generated/Model/SmsCodeSendReq.php index 7055e53..a37b8f5 100644 --- a/src/Generated/Model/SmsCodeSendReq.php +++ b/src/Generated/Model/SmsCodeSendReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class SmsCodeSendReq implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'phone_number' => false, - 'create' => false, - 'user_full_name' => false, - 'template_name' => false, - 'request_id' => false, - 'client_info' => false + 'create' => false, + 'user_full_name' => false, + 'template_name' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/SmsCodeSendRsp.php b/src/Generated/Model/SmsCodeSendRsp.php index e048ff3..8d1b25f 100644 --- a/src/Generated/Model/SmsCodeSendRsp.php +++ b/src/Generated/Model/SmsCodeSendRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class SmsCodeSendRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/SmsCodeSendRspAllOfData.php b/src/Generated/Model/SmsCodeSendRspAllOfData.php index 9c4b573..a85cd70 100644 --- a/src/Generated/Model/SmsCodeSendRspAllOfData.php +++ b/src/Generated/Model/SmsCodeSendRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/SmsCodeValidateReq.php b/src/Generated/Model/SmsCodeValidateReq.php index be43841..d1eac67 100644 --- a/src/Generated/Model/SmsCodeValidateReq.php +++ b/src/Generated/Model/SmsCodeValidateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class SmsCodeValidateReq implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'sms_code' => false, - 'create_login_token' => false, - 'request_id' => false, - 'client_info' => false + 'create_login_token' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/SmsCodeValidateRsp.php b/src/Generated/Model/SmsCodeValidateRsp.php index efd097e..3453762 100644 --- a/src/Generated/Model/SmsCodeValidateRsp.php +++ b/src/Generated/Model/SmsCodeValidateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class SmsCodeValidateRsp implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'login_token' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'login_token' => false ]; /** diff --git a/src/Generated/Model/SmsTemplateCreateReq.php b/src/Generated/Model/SmsTemplateCreateReq.php index 6a87842..a0ce1f4 100644 --- a/src/Generated/Model/SmsTemplateCreateReq.php +++ b/src/Generated/Model/SmsTemplateCreateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class SmsTemplateCreateReq implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'type' => false, - 'name' => false, - 'text_plain' => false, - 'is_default' => false, - 'request_id' => false, - 'client_info' => false + 'name' => false, + 'text_plain' => false, + 'is_default' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/SmsTemplateCreateRsp.php b/src/Generated/Model/SmsTemplateCreateRsp.php index e10821e..53315f3 100644 --- a/src/Generated/Model/SmsTemplateCreateRsp.php +++ b/src/Generated/Model/SmsTemplateCreateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class SmsTemplateCreateRsp implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/SmsTemplateCreateRspAllOfData.php b/src/Generated/Model/SmsTemplateCreateRspAllOfData.php index 3d4f08a..bbec1f1 100644 --- a/src/Generated/Model/SmsTemplateCreateRspAllOfData.php +++ b/src/Generated/Model/SmsTemplateCreateRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/SmsTemplateDeleteReq.php b/src/Generated/Model/SmsTemplateDeleteReq.php index 8958f4c..804bacf 100644 --- a/src/Generated/Model/SmsTemplateDeleteReq.php +++ b/src/Generated/Model/SmsTemplateDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class SmsTemplateDeleteReq implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/Status.php b/src/Generated/Model/Status.php index 6bb67ac..b5887ae 100644 --- a/src/Generated/Model/Status.php +++ b/src/Generated/Model/Status.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/TrackingBackupState.php b/src/Generated/Model/TrackingBackupState.php new file mode 100644 index 0000000..8863092 --- /dev/null +++ b/src/Generated/Model/TrackingBackupState.php @@ -0,0 +1,450 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * TrackingBackupState Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class TrackingBackupState implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'trackingBackupState'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'backed_up' => 'int', + 'not_backed_up' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'backed_up' => null, + 'not_backed_up' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'backed_up' => false, + 'not_backed_up' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'backed_up' => 'backedUp', + 'not_backed_up' => 'notBackedUp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'backed_up' => 'setBackedUp', + 'not_backed_up' => 'setNotBackedUp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'backed_up' => 'getBackedUp', + 'not_backed_up' => 'getNotBackedUp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('backed_up', $data ?? [], null); + $this->setIfExists('not_backed_up', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['backed_up'] === null) { + $invalidProperties[] = "'backed_up' can't be null"; + } + if ($this->container['not_backed_up'] === null) { + $invalidProperties[] = "'not_backed_up' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets backed_up + * + * @return int + */ + public function getBackedUp() + { + return $this->container['backed_up']; + } + + /** + * Sets backed_up + * + * @param int $backed_up backed_up + * + * @return self + */ + public function setBackedUp($backed_up) + { + if (is_null($backed_up)) { + throw new \InvalidArgumentException('non-nullable backed_up cannot be null'); + } + $this->container['backed_up'] = $backed_up; + + return $this; + } + + /** + * Gets not_backed_up + * + * @return int + */ + public function getNotBackedUp() + { + return $this->container['not_backed_up']; + } + + /** + * Sets not_backed_up + * + * @param int $not_backed_up not_backed_up + * + * @return self + */ + public function setNotBackedUp($not_backed_up) + { + if (is_null($not_backed_up)) { + throw new \InvalidArgumentException('non-nullable not_backed_up cannot be null'); + } + $this->container['not_backed_up'] = $not_backed_up; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/TrackingBackupStateGetRsp.php b/src/Generated/Model/TrackingBackupStateGetRsp.php new file mode 100644 index 0000000..efe493f --- /dev/null +++ b/src/Generated/Model/TrackingBackupStateGetRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * TrackingBackupStateGetRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class TrackingBackupStateGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'trackingBackupStateGetRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'data' => '\Corbado\Generated\Model\TrackingBackupState' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling TrackingBackupStateGetRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling TrackingBackupStateGetRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets data + * + * @return \Corbado\Generated\Model\TrackingBackupState + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Corbado\Generated\Model\TrackingBackupState $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/TrackingBrowserDetailedStats.php b/src/Generated/Model/TrackingBrowserDetailedStats.php index 5e72ced..1f6d12f 100644 --- a/src/Generated/Model/TrackingBrowserDetailedStats.php +++ b/src/Generated/Model/TrackingBrowserDetailedStats.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -61,7 +61,10 @@ class TrackingBrowserDetailedStats implements ModelInterface, ArrayAccess, \Json 'time_point' => 'string', 'browser_name' => 'string', 'browser_version' => 'string', - 'cnt' => 'int' + 'cnt' => 'int', + 'webauthn' => 'int', + 'platform' => 'int', + 'conditional_ui' => 'int' ]; /** @@ -75,7 +78,10 @@ class TrackingBrowserDetailedStats implements ModelInterface, ArrayAccess, \Json 'time_point' => 'yyyy-MM-dd', 'browser_name' => null, 'browser_version' => null, - 'cnt' => null + 'cnt' => null, + 'webauthn' => null, + 'platform' => null, + 'conditional_ui' => null ]; /** @@ -85,9 +91,12 @@ class TrackingBrowserDetailedStats implements ModelInterface, ArrayAccess, \Json */ protected static array $openAPINullables = [ 'time_point' => false, - 'browser_name' => false, - 'browser_version' => false, - 'cnt' => false + 'browser_name' => false, + 'browser_version' => false, + 'cnt' => false, + 'webauthn' => false, + 'platform' => false, + 'conditional_ui' => false ]; /** @@ -179,7 +188,10 @@ public function isNullableSetToNull(string $property): bool 'time_point' => 'timePoint', 'browser_name' => 'browserName', 'browser_version' => 'browserVersion', - 'cnt' => 'cnt' + 'cnt' => 'cnt', + 'webauthn' => 'webauthn', + 'platform' => 'platform', + 'conditional_ui' => 'conditional_ui' ]; /** @@ -191,7 +203,10 @@ public function isNullableSetToNull(string $property): bool 'time_point' => 'setTimePoint', 'browser_name' => 'setBrowserName', 'browser_version' => 'setBrowserVersion', - 'cnt' => 'setCnt' + 'cnt' => 'setCnt', + 'webauthn' => 'setWebauthn', + 'platform' => 'setPlatform', + 'conditional_ui' => 'setConditionalUi' ]; /** @@ -203,7 +218,10 @@ public function isNullableSetToNull(string $property): bool 'time_point' => 'getTimePoint', 'browser_name' => 'getBrowserName', 'browser_version' => 'getBrowserVersion', - 'cnt' => 'getCnt' + 'cnt' => 'getCnt', + 'webauthn' => 'getWebauthn', + 'platform' => 'getPlatform', + 'conditional_ui' => 'getConditionalUi' ]; /** @@ -267,6 +285,9 @@ public function __construct(array $data = null) $this->setIfExists('browser_name', $data ?? [], null); $this->setIfExists('browser_version', $data ?? [], null); $this->setIfExists('cnt', $data ?? [], null); + $this->setIfExists('webauthn', $data ?? [], null); + $this->setIfExists('platform', $data ?? [], null); + $this->setIfExists('conditional_ui', $data ?? [], null); } /** @@ -308,6 +329,15 @@ public function listInvalidProperties() if ($this->container['cnt'] === null) { $invalidProperties[] = "'cnt' can't be null"; } + if ($this->container['webauthn'] === null) { + $invalidProperties[] = "'webauthn' can't be null"; + } + if ($this->container['platform'] === null) { + $invalidProperties[] = "'platform' can't be null"; + } + if ($this->container['conditional_ui'] === null) { + $invalidProperties[] = "'conditional_ui' can't be null"; + } return $invalidProperties; } @@ -430,6 +460,87 @@ public function setCnt($cnt) return $this; } + + /** + * Gets webauthn + * + * @return int + */ + public function getWebauthn() + { + return $this->container['webauthn']; + } + + /** + * Sets webauthn + * + * @param int $webauthn webauthn + * + * @return self + */ + public function setWebauthn($webauthn) + { + if (is_null($webauthn)) { + throw new \InvalidArgumentException('non-nullable webauthn cannot be null'); + } + $this->container['webauthn'] = $webauthn; + + return $this; + } + + /** + * Gets platform + * + * @return int + */ + public function getPlatform() + { + return $this->container['platform']; + } + + /** + * Sets platform + * + * @param int $platform platform + * + * @return self + */ + public function setPlatform($platform) + { + if (is_null($platform)) { + throw new \InvalidArgumentException('non-nullable platform cannot be null'); + } + $this->container['platform'] = $platform; + + return $this; + } + + /** + * Gets conditional_ui + * + * @return int + */ + public function getConditionalUi() + { + return $this->container['conditional_ui']; + } + + /** + * Sets conditional_ui + * + * @param int $conditional_ui conditional_ui + * + * @return self + */ + public function setConditionalUi($conditional_ui) + { + if (is_null($conditional_ui)) { + throw new \InvalidArgumentException('non-nullable conditional_ui cannot be null'); + } + $this->container['conditional_ui'] = $conditional_ui; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Generated/Model/TrackingBrowserDetailedStatsListRsp.php b/src/Generated/Model/TrackingBrowserDetailedStatsListRsp.php index 83e8b9d..d1ddbc8 100644 --- a/src/Generated/Model/TrackingBrowserDetailedStatsListRsp.php +++ b/src/Generated/Model/TrackingBrowserDetailedStatsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class TrackingBrowserDetailedStatsListRsp implements ModelInterface, ArrayAccess */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/TrackingBrowserDetailedStatsListRspAllOfData.php b/src/Generated/Model/TrackingBrowserDetailedStatsListRspAllOfData.php index 4624f5a..13dd997 100644 --- a/src/Generated/Model/TrackingBrowserDetailedStatsListRspAllOfData.php +++ b/src/Generated/Model/TrackingBrowserDetailedStatsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class TrackingBrowserDetailedStatsListRspAllOfData implements ModelInterface, Ar */ protected static array $openAPINullables = [ 'stats' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/TrackingBrowserStats.php b/src/Generated/Model/TrackingBrowserStats.php index e8eaab0..5537a82 100644 --- a/src/Generated/Model/TrackingBrowserStats.php +++ b/src/Generated/Model/TrackingBrowserStats.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class TrackingBrowserStats implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'time_point' => false, - 'chrome' => false, - 'safari' => false, - 'edge' => false, - 'firefox' => false, - 'other' => false + 'chrome' => false, + 'safari' => false, + 'edge' => false, + 'firefox' => false, + 'other' => false ]; /** diff --git a/src/Generated/Model/TrackingBrowserStatsListRsp.php b/src/Generated/Model/TrackingBrowserStatsListRsp.php index aed21de..0d6dfeb 100644 --- a/src/Generated/Model/TrackingBrowserStatsListRsp.php +++ b/src/Generated/Model/TrackingBrowserStatsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class TrackingBrowserStatsListRsp implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/TrackingBrowserStatsListRspAllOfData.php b/src/Generated/Model/TrackingBrowserStatsListRspAllOfData.php index 2ab2014..646b67c 100644 --- a/src/Generated/Model/TrackingBrowserStatsListRspAllOfData.php +++ b/src/Generated/Model/TrackingBrowserStatsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class TrackingBrowserStatsListRspAllOfData implements ModelInterface, ArrayAcces */ protected static array $openAPINullables = [ 'stats' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/TrackingDetailedStats.php b/src/Generated/Model/TrackingDetailedStats.php new file mode 100644 index 0000000..123a7ca --- /dev/null +++ b/src/Generated/Model/TrackingDetailedStats.php @@ -0,0 +1,561 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * TrackingDetailedStats Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class TrackingDetailedStats implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'trackingDetailedStats'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_point' => 'string', + 'visits' => 'int', + 'webauthn' => 'int', + 'platform' => 'int', + 'conditional_ui' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_point' => 'yyyy-MM-dd', + 'visits' => null, + 'webauthn' => null, + 'platform' => null, + 'conditional_ui' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_point' => false, + 'visits' => false, + 'webauthn' => false, + 'platform' => false, + 'conditional_ui' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_point' => 'timePoint', + 'visits' => 'visits', + 'webauthn' => 'webauthn', + 'platform' => 'platform', + 'conditional_ui' => 'conditionalUi' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_point' => 'setTimePoint', + 'visits' => 'setVisits', + 'webauthn' => 'setWebauthn', + 'platform' => 'setPlatform', + 'conditional_ui' => 'setConditionalUi' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_point' => 'getTimePoint', + 'visits' => 'getVisits', + 'webauthn' => 'getWebauthn', + 'platform' => 'getPlatform', + 'conditional_ui' => 'getConditionalUi' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('time_point', $data ?? [], null); + $this->setIfExists('visits', $data ?? [], null); + $this->setIfExists('webauthn', $data ?? [], null); + $this->setIfExists('platform', $data ?? [], null); + $this->setIfExists('conditional_ui', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['time_point'] === null) { + $invalidProperties[] = "'time_point' can't be null"; + } + if ($this->container['visits'] === null) { + $invalidProperties[] = "'visits' can't be null"; + } + if ($this->container['webauthn'] === null) { + $invalidProperties[] = "'webauthn' can't be null"; + } + if ($this->container['platform'] === null) { + $invalidProperties[] = "'platform' can't be null"; + } + if ($this->container['conditional_ui'] === null) { + $invalidProperties[] = "'conditional_ui' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_point + * + * @return string + */ + public function getTimePoint() + { + return $this->container['time_point']; + } + + /** + * Sets time_point + * + * @param string $time_point time_point + * + * @return self + */ + public function setTimePoint($time_point) + { + if (is_null($time_point)) { + throw new \InvalidArgumentException('non-nullable time_point cannot be null'); + } + $this->container['time_point'] = $time_point; + + return $this; + } + + /** + * Gets visits + * + * @return int + */ + public function getVisits() + { + return $this->container['visits']; + } + + /** + * Sets visits + * + * @param int $visits visits + * + * @return self + */ + public function setVisits($visits) + { + if (is_null($visits)) { + throw new \InvalidArgumentException('non-nullable visits cannot be null'); + } + $this->container['visits'] = $visits; + + return $this; + } + + /** + * Gets webauthn + * + * @return int + */ + public function getWebauthn() + { + return $this->container['webauthn']; + } + + /** + * Sets webauthn + * + * @param int $webauthn webauthn + * + * @return self + */ + public function setWebauthn($webauthn) + { + if (is_null($webauthn)) { + throw new \InvalidArgumentException('non-nullable webauthn cannot be null'); + } + $this->container['webauthn'] = $webauthn; + + return $this; + } + + /** + * Gets platform + * + * @return int + */ + public function getPlatform() + { + return $this->container['platform']; + } + + /** + * Sets platform + * + * @param int $platform platform + * + * @return self + */ + public function setPlatform($platform) + { + if (is_null($platform)) { + throw new \InvalidArgumentException('non-nullable platform cannot be null'); + } + $this->container['platform'] = $platform; + + return $this; + } + + /** + * Gets conditional_ui + * + * @return int + */ + public function getConditionalUi() + { + return $this->container['conditional_ui']; + } + + /** + * Sets conditional_ui + * + * @param int $conditional_ui conditional_ui + * + * @return self + */ + public function setConditionalUi($conditional_ui) + { + if (is_null($conditional_ui)) { + throw new \InvalidArgumentException('non-nullable conditional_ui cannot be null'); + } + $this->container['conditional_ui'] = $conditional_ui; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/TrackingDetailedStatsListRsp.php b/src/Generated/Model/TrackingDetailedStatsListRsp.php new file mode 100644 index 0000000..4702908 --- /dev/null +++ b/src/Generated/Model/TrackingDetailedStatsListRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * TrackingDetailedStatsListRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class TrackingDetailedStatsListRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'trackingDetailedStatsListRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'data' => '\Corbado\Generated\Model\TrackingDetailedStatsListRspAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling TrackingDetailedStatsListRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling TrackingDetailedStatsListRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets data + * + * @return \Corbado\Generated\Model\TrackingDetailedStatsListRspAllOfData + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Corbado\Generated\Model\TrackingDetailedStatsListRspAllOfData $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/TrackingDetailedStatsListRspAllOfData.php b/src/Generated/Model/TrackingDetailedStatsListRspAllOfData.php new file mode 100644 index 0000000..792991d --- /dev/null +++ b/src/Generated/Model/TrackingDetailedStatsListRspAllOfData.php @@ -0,0 +1,450 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * TrackingDetailedStatsListRspAllOfData Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class TrackingDetailedStatsListRspAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'trackingDetailedStatsListRsp_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'stats' => '\Corbado\Generated\Model\TrackingDetailedStats[]', + 'paging' => '\Corbado\Generated\Model\Paging' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'stats' => null, + 'paging' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'stats' => false, + 'paging' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'stats' => 'stats', + 'paging' => 'paging' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'stats' => 'setStats', + 'paging' => 'setPaging' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'stats' => 'getStats', + 'paging' => 'getPaging' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('stats', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['stats'] === null) { + $invalidProperties[] = "'stats' can't be null"; + } + if ($this->container['paging'] === null) { + $invalidProperties[] = "'paging' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets stats + * + * @return \Corbado\Generated\Model\TrackingDetailedStats[] + */ + public function getStats() + { + return $this->container['stats']; + } + + /** + * Sets stats + * + * @param \Corbado\Generated\Model\TrackingDetailedStats[] $stats stats + * + * @return self + */ + public function setStats($stats) + { + if (is_null($stats)) { + throw new \InvalidArgumentException('non-nullable stats cannot be null'); + } + $this->container['stats'] = $stats; + + return $this; + } + + /** + * Gets paging + * + * @return \Corbado\Generated\Model\Paging + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \Corbado\Generated\Model\Paging $paging paging + * + * @return self + */ + public function setPaging($paging) + { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } + $this->container['paging'] = $paging; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/TrackingEnums.php b/src/Generated/Model/TrackingEnums.php new file mode 100644 index 0000000..a427777 --- /dev/null +++ b/src/Generated/Model/TrackingEnums.php @@ -0,0 +1,487 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * TrackingEnums Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class TrackingEnums implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'trackingEnums'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'browser_names' => 'string[]', + 'os_names' => 'string[]', + 'os_platforms' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'browser_names' => null, + 'os_names' => null, + 'os_platforms' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'browser_names' => false, + 'os_names' => false, + 'os_platforms' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'browser_names' => 'browserNames', + 'os_names' => 'osNames', + 'os_platforms' => 'osPlatforms' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'browser_names' => 'setBrowserNames', + 'os_names' => 'setOsNames', + 'os_platforms' => 'setOsPlatforms' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'browser_names' => 'getBrowserNames', + 'os_names' => 'getOsNames', + 'os_platforms' => 'getOsPlatforms' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('browser_names', $data ?? [], null); + $this->setIfExists('os_names', $data ?? [], null); + $this->setIfExists('os_platforms', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['browser_names'] === null) { + $invalidProperties[] = "'browser_names' can't be null"; + } + if ($this->container['os_names'] === null) { + $invalidProperties[] = "'os_names' can't be null"; + } + if ($this->container['os_platforms'] === null) { + $invalidProperties[] = "'os_platforms' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets browser_names + * + * @return string[] + */ + public function getBrowserNames() + { + return $this->container['browser_names']; + } + + /** + * Sets browser_names + * + * @param string[] $browser_names browser_names + * + * @return self + */ + public function setBrowserNames($browser_names) + { + if (is_null($browser_names)) { + throw new \InvalidArgumentException('non-nullable browser_names cannot be null'); + } + $this->container['browser_names'] = $browser_names; + + return $this; + } + + /** + * Gets os_names + * + * @return string[] + */ + public function getOsNames() + { + return $this->container['os_names']; + } + + /** + * Sets os_names + * + * @param string[] $os_names os_names + * + * @return self + */ + public function setOsNames($os_names) + { + if (is_null($os_names)) { + throw new \InvalidArgumentException('non-nullable os_names cannot be null'); + } + $this->container['os_names'] = $os_names; + + return $this; + } + + /** + * Gets os_platforms + * + * @return string[] + */ + public function getOsPlatforms() + { + return $this->container['os_platforms']; + } + + /** + * Sets os_platforms + * + * @param string[] $os_platforms os_platforms + * + * @return self + */ + public function setOsPlatforms($os_platforms) + { + if (is_null($os_platforms)) { + throw new \InvalidArgumentException('non-nullable os_platforms cannot be null'); + } + $this->container['os_platforms'] = $os_platforms; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/TrackingEnumsGetRsp.php b/src/Generated/Model/TrackingEnumsGetRsp.php new file mode 100644 index 0000000..05c74b7 --- /dev/null +++ b/src/Generated/Model/TrackingEnumsGetRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * TrackingEnumsGetRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class TrackingEnumsGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'trackingEnumsGetRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'data' => '\Corbado\Generated\Model\TrackingEnums' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling TrackingEnumsGetRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling TrackingEnumsGetRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets data + * + * @return \Corbado\Generated\Model\TrackingEnums + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Corbado\Generated\Model\TrackingEnums $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/TrackingOSDetailedStats.php b/src/Generated/Model/TrackingOSDetailedStats.php index 7bd5e1f..bebc875 100644 --- a/src/Generated/Model/TrackingOSDetailedStats.php +++ b/src/Generated/Model/TrackingOSDetailedStats.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -61,7 +61,11 @@ class TrackingOSDetailedStats implements ModelInterface, ArrayAccess, \JsonSeria 'time_point' => 'string', 'os_name' => 'string', 'os_version' => 'string', - 'cnt' => 'int' + 'os_platform' => 'string', + 'cnt' => 'int', + 'webauthn' => 'int', + 'platform' => 'int', + 'conditional_ui' => 'int' ]; /** @@ -75,7 +79,11 @@ class TrackingOSDetailedStats implements ModelInterface, ArrayAccess, \JsonSeria 'time_point' => 'yyyy-MM-dd', 'os_name' => null, 'os_version' => null, - 'cnt' => null + 'os_platform' => null, + 'cnt' => null, + 'webauthn' => null, + 'platform' => null, + 'conditional_ui' => null ]; /** @@ -85,9 +93,13 @@ class TrackingOSDetailedStats implements ModelInterface, ArrayAccess, \JsonSeria */ protected static array $openAPINullables = [ 'time_point' => false, - 'os_name' => false, - 'os_version' => false, - 'cnt' => false + 'os_name' => false, + 'os_version' => false, + 'os_platform' => false, + 'cnt' => false, + 'webauthn' => false, + 'platform' => false, + 'conditional_ui' => false ]; /** @@ -179,7 +191,11 @@ public function isNullableSetToNull(string $property): bool 'time_point' => 'timePoint', 'os_name' => 'osName', 'os_version' => 'osVersion', - 'cnt' => 'cnt' + 'os_platform' => 'osPlatform', + 'cnt' => 'cnt', + 'webauthn' => 'webauthn', + 'platform' => 'platform', + 'conditional_ui' => 'conditional_ui' ]; /** @@ -191,7 +207,11 @@ public function isNullableSetToNull(string $property): bool 'time_point' => 'setTimePoint', 'os_name' => 'setOsName', 'os_version' => 'setOsVersion', - 'cnt' => 'setCnt' + 'os_platform' => 'setOsPlatform', + 'cnt' => 'setCnt', + 'webauthn' => 'setWebauthn', + 'platform' => 'setPlatform', + 'conditional_ui' => 'setConditionalUi' ]; /** @@ -203,7 +223,11 @@ public function isNullableSetToNull(string $property): bool 'time_point' => 'getTimePoint', 'os_name' => 'getOsName', 'os_version' => 'getOsVersion', - 'cnt' => 'getCnt' + 'os_platform' => 'getOsPlatform', + 'cnt' => 'getCnt', + 'webauthn' => 'getWebauthn', + 'platform' => 'getPlatform', + 'conditional_ui' => 'getConditionalUi' ]; /** @@ -247,6 +271,23 @@ public function getModelName() return self::$openAPIModelName; } + public const OS_PLATFORM_DESKTOP = 'desktop'; + public const OS_PLATFORM_MOBILE = 'mobile'; + public const OS_PLATFORM_UNKNOWN = 'unknown'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOsPlatformAllowableValues() + { + return [ + self::OS_PLATFORM_DESKTOP, + self::OS_PLATFORM_MOBILE, + self::OS_PLATFORM_UNKNOWN, + ]; + } /** * Associative array for storing property values @@ -266,7 +307,11 @@ public function __construct(array $data = null) $this->setIfExists('time_point', $data ?? [], null); $this->setIfExists('os_name', $data ?? [], null); $this->setIfExists('os_version', $data ?? [], null); + $this->setIfExists('os_platform', $data ?? [], null); $this->setIfExists('cnt', $data ?? [], null); + $this->setIfExists('webauthn', $data ?? [], null); + $this->setIfExists('platform', $data ?? [], null); + $this->setIfExists('conditional_ui', $data ?? [], null); } /** @@ -305,9 +350,30 @@ public function listInvalidProperties() if ($this->container['os_version'] === null) { $invalidProperties[] = "'os_version' can't be null"; } + if ($this->container['os_platform'] === null) { + $invalidProperties[] = "'os_platform' can't be null"; + } + $allowedValues = $this->getOsPlatformAllowableValues(); + if (!is_null($this->container['os_platform']) && !in_array($this->container['os_platform'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'os_platform', must be one of '%s'", + $this->container['os_platform'], + implode("', '", $allowedValues) + ); + } + if ($this->container['cnt'] === null) { $invalidProperties[] = "'cnt' can't be null"; } + if ($this->container['webauthn'] === null) { + $invalidProperties[] = "'webauthn' can't be null"; + } + if ($this->container['platform'] === null) { + $invalidProperties[] = "'platform' can't be null"; + } + if ($this->container['conditional_ui'] === null) { + $invalidProperties[] = "'conditional_ui' can't be null"; + } return $invalidProperties; } @@ -404,6 +470,43 @@ public function setOsVersion($os_version) return $this; } + /** + * Gets os_platform + * + * @return string + */ + public function getOsPlatform() + { + return $this->container['os_platform']; + } + + /** + * Sets os_platform + * + * @param string $os_platform os_platform + * + * @return self + */ + public function setOsPlatform($os_platform) + { + if (is_null($os_platform)) { + throw new \InvalidArgumentException('non-nullable os_platform cannot be null'); + } + $allowedValues = $this->getOsPlatformAllowableValues(); + if (!in_array($os_platform, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'os_platform', must be one of '%s'", + $os_platform, + implode("', '", $allowedValues) + ) + ); + } + $this->container['os_platform'] = $os_platform; + + return $this; + } + /** * Gets cnt * @@ -430,6 +533,87 @@ public function setCnt($cnt) return $this; } + + /** + * Gets webauthn + * + * @return int + */ + public function getWebauthn() + { + return $this->container['webauthn']; + } + + /** + * Sets webauthn + * + * @param int $webauthn webauthn + * + * @return self + */ + public function setWebauthn($webauthn) + { + if (is_null($webauthn)) { + throw new \InvalidArgumentException('non-nullable webauthn cannot be null'); + } + $this->container['webauthn'] = $webauthn; + + return $this; + } + + /** + * Gets platform + * + * @return int + */ + public function getPlatform() + { + return $this->container['platform']; + } + + /** + * Sets platform + * + * @param int $platform platform + * + * @return self + */ + public function setPlatform($platform) + { + if (is_null($platform)) { + throw new \InvalidArgumentException('non-nullable platform cannot be null'); + } + $this->container['platform'] = $platform; + + return $this; + } + + /** + * Gets conditional_ui + * + * @return int + */ + public function getConditionalUi() + { + return $this->container['conditional_ui']; + } + + /** + * Sets conditional_ui + * + * @param int $conditional_ui conditional_ui + * + * @return self + */ + public function setConditionalUi($conditional_ui) + { + if (is_null($conditional_ui)) { + throw new \InvalidArgumentException('non-nullable conditional_ui cannot be null'); + } + $this->container['conditional_ui'] = $conditional_ui; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Generated/Model/TrackingOSDetailedStatsListRsp.php b/src/Generated/Model/TrackingOSDetailedStatsListRsp.php index 383f97c..17453fd 100644 --- a/src/Generated/Model/TrackingOSDetailedStatsListRsp.php +++ b/src/Generated/Model/TrackingOSDetailedStatsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class TrackingOSDetailedStatsListRsp implements ModelInterface, ArrayAccess, \Js */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/TrackingOSDetailedStatsListRspAllOfData.php b/src/Generated/Model/TrackingOSDetailedStatsListRspAllOfData.php index c5bf79e..7d89de5 100644 --- a/src/Generated/Model/TrackingOSDetailedStatsListRspAllOfData.php +++ b/src/Generated/Model/TrackingOSDetailedStatsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class TrackingOSDetailedStatsListRspAllOfData implements ModelInterface, ArrayAc */ protected static array $openAPINullables = [ 'stats' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/TrackingOSStats.php b/src/Generated/Model/TrackingOSStats.php index 3291791..39bb5d7 100644 --- a/src/Generated/Model/TrackingOSStats.php +++ b/src/Generated/Model/TrackingOSStats.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class TrackingOSStats implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'time_point' => false, - 'macos' => false, - 'windows' => false, - 'ios' => false, - 'android' => false, - 'other' => false + 'macos' => false, + 'windows' => false, + 'ios' => false, + 'android' => false, + 'other' => false ]; /** diff --git a/src/Generated/Model/TrackingOSStatsListRsp.php b/src/Generated/Model/TrackingOSStatsListRsp.php index 41ea671..a06018f 100644 --- a/src/Generated/Model/TrackingOSStatsListRsp.php +++ b/src/Generated/Model/TrackingOSStatsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class TrackingOSStatsListRsp implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/TrackingOSStatsListRspAllOfData.php b/src/Generated/Model/TrackingOSStatsListRspAllOfData.php index fddf23d..a0c8802 100644 --- a/src/Generated/Model/TrackingOSStatsListRspAllOfData.php +++ b/src/Generated/Model/TrackingOSStatsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class TrackingOSStatsListRspAllOfData implements ModelInterface, ArrayAccess, \J */ protected static array $openAPINullables = [ 'stats' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/TrackingRawListRow.php b/src/Generated/Model/TrackingRawListRow.php index c588225..926def9 100644 --- a/src/Generated/Model/TrackingRawListRow.php +++ b/src/Generated/Model/TrackingRawListRow.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class TrackingRawListRow implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'time_point' => false, - 'has_webauthn' => false, - 'has_platform_auth' => false, - 'has_conditional_ui' => false, - 'os_id' => false, - 'browser_id' => false + 'has_webauthn' => false, + 'has_platform_auth' => false, + 'has_conditional_ui' => false, + 'os_id' => false, + 'browser_id' => false ]; /** diff --git a/src/Generated/Model/TrackingRawListRsp.php b/src/Generated/Model/TrackingRawListRsp.php index 0b6e0bc..6f29310 100644 --- a/src/Generated/Model/TrackingRawListRsp.php +++ b/src/Generated/Model/TrackingRawListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class TrackingRawListRsp implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'rows' => false, - 'paging' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'rows' => false, + 'paging' => false ]; /** diff --git a/src/Generated/Model/TrackingStats.php b/src/Generated/Model/TrackingStats.php index eb9bbf7..bb000fb 100644 --- a/src/Generated/Model/TrackingStats.php +++ b/src/Generated/Model/TrackingStats.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class TrackingStats implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'time_point' => false, - 'aggregate_visits' => false, - 'aggregate_webauthn' => false, - 'aggregate_platform' => false, - 'aggregate_conditional_ui' => false + 'aggregate_visits' => false, + 'aggregate_webauthn' => false, + 'aggregate_platform' => false, + 'aggregate_conditional_ui' => false ]; /** diff --git a/src/Generated/Model/TrackingStatsListRsp.php b/src/Generated/Model/TrackingStatsListRsp.php index f7149a0..06dec5c 100644 --- a/src/Generated/Model/TrackingStatsListRsp.php +++ b/src/Generated/Model/TrackingStatsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class TrackingStatsListRsp implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/TrackingStatsListRspAllOfData.php b/src/Generated/Model/TrackingStatsListRspAllOfData.php index 3ec71a3..0b0bd42 100644 --- a/src/Generated/Model/TrackingStatsListRspAllOfData.php +++ b/src/Generated/Model/TrackingStatsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class TrackingStatsListRspAllOfData implements ModelInterface, ArrayAccess, \Jso */ protected static array $openAPINullables = [ 'stats' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/User.php b/src/Generated/Model/User.php index c8ac77c..299b3e2 100644 --- a/src/Generated/Model/User.php +++ b/src/Generated/Model/User.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -63,7 +63,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable 'name' => 'string', 'full_name' => 'string', 'created' => 'string', - 'updated' => 'string' + 'updated' => 'string', + 'status' => 'string' ]; /** @@ -78,7 +79,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable 'name' => null, 'full_name' => null, 'created' => null, - 'updated' => null + 'updated' => null, + 'status' => null ]; /** @@ -88,10 +90,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'name' => false, - 'full_name' => false, - 'created' => false, - 'updated' => false + 'name' => false, + 'full_name' => false, + 'created' => false, + 'updated' => false, + 'status' => false ]; /** @@ -184,7 +187,8 @@ public function isNullableSetToNull(string $property): bool 'name' => 'name', 'full_name' => 'fullName', 'created' => 'created', - 'updated' => 'updated' + 'updated' => 'updated', + 'status' => 'status' ]; /** @@ -197,7 +201,8 @@ public function isNullableSetToNull(string $property): bool 'name' => 'setName', 'full_name' => 'setFullName', 'created' => 'setCreated', - 'updated' => 'setUpdated' + 'updated' => 'setUpdated', + 'status' => 'setStatus' ]; /** @@ -210,7 +215,8 @@ public function isNullableSetToNull(string $property): bool 'name' => 'getName', 'full_name' => 'getFullName', 'created' => 'getCreated', - 'updated' => 'getUpdated' + 'updated' => 'getUpdated', + 'status' => 'getStatus' ]; /** @@ -275,6 +281,7 @@ public function __construct(array $data = null) $this->setIfExists('full_name', $data ?? [], null); $this->setIfExists('created', $data ?? [], null); $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); } /** @@ -319,6 +326,9 @@ public function listInvalidProperties() if ($this->container['updated'] === null) { $invalidProperties[] = "'updated' can't be null"; } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } return $invalidProperties; } @@ -468,6 +478,33 @@ public function setUpdated($updated) return $this; } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Generated/Model/UserAuthLog.php b/src/Generated/Model/UserAuthLog.php index 2ac34c4..53c963d 100644 --- a/src/Generated/Model/UserAuthLog.php +++ b/src/Generated/Model/UserAuthLog.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class UserAuthLog implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'user_id' => false, - 'user_name' => false, - 'method' => false, - 'event_type' => false, - 'status' => false, - 'created' => false + 'user_name' => false, + 'method' => false, + 'event_type' => false, + 'status' => false, + 'created' => false ]; /** diff --git a/src/Generated/Model/UserAuthLogListRsp.php b/src/Generated/Model/UserAuthLogListRsp.php index 7a052bd..feb101c 100644 --- a/src/Generated/Model/UserAuthLogListRsp.php +++ b/src/Generated/Model/UserAuthLogListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserAuthLogListRsp implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserAuthLogListRspAllOfData.php b/src/Generated/Model/UserAuthLogListRspAllOfData.php index d18b282..0591899 100644 --- a/src/Generated/Model/UserAuthLogListRspAllOfData.php +++ b/src/Generated/Model/UserAuthLogListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class UserAuthLogListRspAllOfData implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'rows' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/UserCreateReq.php b/src/Generated/Model/UserCreateReq.php index d3c6c93..6b65543 100644 --- a/src/Generated/Model/UserCreateReq.php +++ b/src/Generated/Model/UserCreateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class UserCreateReq implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'name' => false, - 'full_name' => false, - 'email' => false, - 'phone_number' => false, - 'request_id' => false, - 'client_info' => false + 'full_name' => false, + 'email' => false, + 'phone_number' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/UserCreateRsp.php b/src/Generated/Model/UserCreateRsp.php index f957104..4bc8750 100644 --- a/src/Generated/Model/UserCreateRsp.php +++ b/src/Generated/Model/UserCreateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserCreateRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserCreateRspAllOfData.php b/src/Generated/Model/UserCreateRspAllOfData.php index cc483a5..27a0be9 100644 --- a/src/Generated/Model/UserCreateRspAllOfData.php +++ b/src/Generated/Model/UserCreateRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class UserCreateRspAllOfData implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'user_id' => false, - 'email_id' => false, - 'phone_number_id' => false + 'email_id' => false, + 'phone_number_id' => false ]; /** diff --git a/src/Generated/Model/UserCustomLoginIdentifierCreateReq.php b/src/Generated/Model/UserCustomLoginIdentifierCreateReq.php new file mode 100644 index 0000000..10f5b93 --- /dev/null +++ b/src/Generated/Model/UserCustomLoginIdentifierCreateReq.php @@ -0,0 +1,515 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * UserCustomLoginIdentifierCreateReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class UserCustomLoginIdentifierCreateReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'userCustomLoginIdentifierCreateReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_login_identifier' => 'string', + 'additional_data' => 'string', + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_login_identifier' => null, + 'additional_data' => null, + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_login_identifier' => false, + 'additional_data' => false, + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'custom_login_identifier' => 'customLoginIdentifier', + 'additional_data' => 'additionalData', + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'custom_login_identifier' => 'setCustomLoginIdentifier', + 'additional_data' => 'setAdditionalData', + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'custom_login_identifier' => 'getCustomLoginIdentifier', + 'additional_data' => 'getAdditionalData', + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('custom_login_identifier', $data ?? [], null); + $this->setIfExists('additional_data', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['custom_login_identifier'] === null) { + $invalidProperties[] = "'custom_login_identifier' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets custom_login_identifier + * + * @return string + */ + public function getCustomLoginIdentifier() + { + return $this->container['custom_login_identifier']; + } + + /** + * Sets custom_login_identifier + * + * @param string $custom_login_identifier custom_login_identifier + * + * @return self + */ + public function setCustomLoginIdentifier($custom_login_identifier) + { + if (is_null($custom_login_identifier)) { + throw new \InvalidArgumentException('non-nullable custom_login_identifier cannot be null'); + } + $this->container['custom_login_identifier'] = $custom_login_identifier; + + return $this; + } + + /** + * Gets additional_data + * + * @return string|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param string|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data) + { + if (is_null($additional_data)) { + throw new \InvalidArgumentException('non-nullable additional_data cannot be null'); + } + $this->container['additional_data'] = $additional_data; + + return $this; + } + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo|null + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo|null $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/UserCustomLoginIdentifierCreateRsp.php b/src/Generated/Model/UserCustomLoginIdentifierCreateRsp.php new file mode 100644 index 0000000..68219cb --- /dev/null +++ b/src/Generated/Model/UserCustomLoginIdentifierCreateRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * UserCustomLoginIdentifierCreateRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class UserCustomLoginIdentifierCreateRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'userCustomLoginIdentifierCreateRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'data' => '\Corbado\Generated\Model\UserCustomLoginIdentifierCreateRspAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling UserCustomLoginIdentifierCreateRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling UserCustomLoginIdentifierCreateRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets data + * + * @return \Corbado\Generated\Model\UserCustomLoginIdentifierCreateRspAllOfData + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierCreateRspAllOfData $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/UserCustomLoginIdentifierCreateRspAllOfData.php b/src/Generated/Model/UserCustomLoginIdentifierCreateRspAllOfData.php new file mode 100644 index 0000000..d35cc63 --- /dev/null +++ b/src/Generated/Model/UserCustomLoginIdentifierCreateRspAllOfData.php @@ -0,0 +1,413 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * UserCustomLoginIdentifierCreateRspAllOfData Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class UserCustomLoginIdentifierCreateRspAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'userCustomLoginIdentifierCreateRsp_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_login_identifier_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_login_identifier_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_login_identifier_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'custom_login_identifier_id' => 'customLoginIdentifierID' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'custom_login_identifier_id' => 'setCustomLoginIdentifierId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'custom_login_identifier_id' => 'getCustomLoginIdentifierId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('custom_login_identifier_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['custom_login_identifier_id'] === null) { + $invalidProperties[] = "'custom_login_identifier_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets custom_login_identifier_id + * + * @return string + */ + public function getCustomLoginIdentifierId() + { + return $this->container['custom_login_identifier_id']; + } + + /** + * Sets custom_login_identifier_id + * + * @param string $custom_login_identifier_id custom_login_identifier_id + * + * @return self + */ + public function setCustomLoginIdentifierId($custom_login_identifier_id) + { + if (is_null($custom_login_identifier_id)) { + throw new \InvalidArgumentException('non-nullable custom_login_identifier_id cannot be null'); + } + $this->container['custom_login_identifier_id'] = $custom_login_identifier_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/UserCustomLoginIdentifierDeleteReq.php b/src/Generated/Model/UserCustomLoginIdentifierDeleteReq.php new file mode 100644 index 0000000..f72d808 --- /dev/null +++ b/src/Generated/Model/UserCustomLoginIdentifierDeleteReq.php @@ -0,0 +1,444 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * UserCustomLoginIdentifierDeleteReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class UserCustomLoginIdentifierDeleteReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'userCustomLoginIdentifierDeleteReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo|null + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo|null $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/UserCustomLoginIdentifierGetRsp.php b/src/Generated/Model/UserCustomLoginIdentifierGetRsp.php new file mode 100644 index 0000000..0b426a3 --- /dev/null +++ b/src/Generated/Model/UserCustomLoginIdentifierGetRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * UserCustomLoginIdentifierGetRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class UserCustomLoginIdentifierGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'userCustomLoginIdentifierGetRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'data' => '\Corbado\Generated\Model\UserCustomLoginIdentifierGetRspAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling UserCustomLoginIdentifierGetRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling UserCustomLoginIdentifierGetRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets data + * + * @return \Corbado\Generated\Model\UserCustomLoginIdentifierGetRspAllOfData + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Corbado\Generated\Model\UserCustomLoginIdentifierGetRspAllOfData $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/UserCustomLoginIdentifierGetRspAllOfData.php b/src/Generated/Model/UserCustomLoginIdentifierGetRspAllOfData.php new file mode 100644 index 0000000..b85d4fd --- /dev/null +++ b/src/Generated/Model/UserCustomLoginIdentifierGetRspAllOfData.php @@ -0,0 +1,413 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * UserCustomLoginIdentifierGetRspAllOfData Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class UserCustomLoginIdentifierGetRspAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'userCustomLoginIdentifierGetRsp_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_login_identifier' => '\Corbado\Generated\Model\CustomLoginIdentifier' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_login_identifier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_login_identifier' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'custom_login_identifier' => 'customLoginIdentifier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'custom_login_identifier' => 'setCustomLoginIdentifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'custom_login_identifier' => 'getCustomLoginIdentifier' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('custom_login_identifier', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['custom_login_identifier'] === null) { + $invalidProperties[] = "'custom_login_identifier' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets custom_login_identifier + * + * @return \Corbado\Generated\Model\CustomLoginIdentifier + */ + public function getCustomLoginIdentifier() + { + return $this->container['custom_login_identifier']; + } + + /** + * Sets custom_login_identifier + * + * @param \Corbado\Generated\Model\CustomLoginIdentifier $custom_login_identifier custom_login_identifier + * + * @return self + */ + public function setCustomLoginIdentifier($custom_login_identifier) + { + if (is_null($custom_login_identifier)) { + throw new \InvalidArgumentException('non-nullable custom_login_identifier cannot be null'); + } + $this->container['custom_login_identifier'] = $custom_login_identifier; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/UserDeleteReq.php b/src/Generated/Model/UserDeleteReq.php index 4d6021f..f97aa4b 100644 --- a/src/Generated/Model/UserDeleteReq.php +++ b/src/Generated/Model/UserDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class UserDeleteReq implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/UserDevice.php b/src/Generated/Model/UserDevice.php index 6a944fe..f3acd56 100644 --- a/src/Generated/Model/UserDevice.php +++ b/src/Generated/Model/UserDevice.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class UserDevice implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'name' => false, - 'fingerprint' => false, - 'status' => false, - 'device' => false, - 'created' => false, - 'browser_name' => false, - 'browser_version' => false, - 'os_name' => false, - 'os_version' => false + 'fingerprint' => false, + 'status' => false, + 'device' => false, + 'created' => false, + 'browser_name' => false, + 'browser_version' => false, + 'os_name' => false, + 'os_version' => false ]; /** diff --git a/src/Generated/Model/UserDeviceListRsp.php b/src/Generated/Model/UserDeviceListRsp.php index e858d36..f720c36 100644 --- a/src/Generated/Model/UserDeviceListRsp.php +++ b/src/Generated/Model/UserDeviceListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class UserDeviceListRsp implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'devices' => false, - 'paging' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'devices' => false, + 'paging' => false ]; /** diff --git a/src/Generated/Model/UserEmail.php b/src/Generated/Model/UserEmail.php index 02eab71..a1e1500 100644 --- a/src/Generated/Model/UserEmail.php +++ b/src/Generated/Model/UserEmail.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -88,10 +88,10 @@ class UserEmail implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'email' => false, - 'created' => false, - 'updated' => false, - 'status' => false + 'email' => false, + 'created' => false, + 'updated' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/UserEmailCreateReq.php b/src/Generated/Model/UserEmailCreateReq.php index a7814ea..57d6e6a 100644 --- a/src/Generated/Model/UserEmailCreateReq.php +++ b/src/Generated/Model/UserEmailCreateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class UserEmailCreateReq implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'email' => false, - 'request_id' => false, - 'client_info' => false + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/UserEmailCreateRsp.php b/src/Generated/Model/UserEmailCreateRsp.php index 83356cd..9275315 100644 --- a/src/Generated/Model/UserEmailCreateRsp.php +++ b/src/Generated/Model/UserEmailCreateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserEmailCreateRsp implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserEmailCreateRspAllOfData.php b/src/Generated/Model/UserEmailCreateRspAllOfData.php index 4047ce3..266531e 100644 --- a/src/Generated/Model/UserEmailCreateRspAllOfData.php +++ b/src/Generated/Model/UserEmailCreateRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/UserEmailDeleteReq.php b/src/Generated/Model/UserEmailDeleteReq.php index a9fc4c9..e590264 100644 --- a/src/Generated/Model/UserEmailDeleteReq.php +++ b/src/Generated/Model/UserEmailDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class UserEmailDeleteReq implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/UserEmailGetRsp.php b/src/Generated/Model/UserEmailGetRsp.php index c69ebf6..ddc3114 100644 --- a/src/Generated/Model/UserEmailGetRsp.php +++ b/src/Generated/Model/UserEmailGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserEmailGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserEmailGetRspAllOfData.php b/src/Generated/Model/UserEmailGetRspAllOfData.php index 7178211..195f1e5 100644 --- a/src/Generated/Model/UserEmailGetRspAllOfData.php +++ b/src/Generated/Model/UserEmailGetRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/UserGetRsp.php b/src/Generated/Model/UserGetRsp.php index 2cf4c04..5eaa91c 100644 --- a/src/Generated/Model/UserGetRsp.php +++ b/src/Generated/Model/UserGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserGetRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserListRsp.php b/src/Generated/Model/UserListRsp.php index e2082c8..8018d5c 100644 --- a/src/Generated/Model/UserListRsp.php +++ b/src/Generated/Model/UserListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserListRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserListRspAllOfData.php b/src/Generated/Model/UserListRspAllOfData.php index c6c7bad..1bbfe2d 100644 --- a/src/Generated/Model/UserListRspAllOfData.php +++ b/src/Generated/Model/UserListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class UserListRspAllOfData implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'users' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/UserPhoneNumber.php b/src/Generated/Model/UserPhoneNumber.php index 2208a10..8e256b9 100644 --- a/src/Generated/Model/UserPhoneNumber.php +++ b/src/Generated/Model/UserPhoneNumber.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -88,10 +88,10 @@ class UserPhoneNumber implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, - 'phone_number' => false, - 'created' => false, - 'updated' => false, - 'status' => false + 'phone_number' => false, + 'created' => false, + 'updated' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/UserPhoneNumberCreateReq.php b/src/Generated/Model/UserPhoneNumberCreateReq.php index d046405..68f5525 100644 --- a/src/Generated/Model/UserPhoneNumberCreateReq.php +++ b/src/Generated/Model/UserPhoneNumberCreateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class UserPhoneNumberCreateReq implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'phone_number' => false, - 'request_id' => false, - 'client_info' => false + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/UserPhoneNumberCreateRsp.php b/src/Generated/Model/UserPhoneNumberCreateRsp.php index ead997d..d1d785c 100644 --- a/src/Generated/Model/UserPhoneNumberCreateRsp.php +++ b/src/Generated/Model/UserPhoneNumberCreateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserPhoneNumberCreateRsp implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserPhoneNumberCreateRspAllOfData.php b/src/Generated/Model/UserPhoneNumberCreateRspAllOfData.php index 8ee2da4..0c0715f 100644 --- a/src/Generated/Model/UserPhoneNumberCreateRspAllOfData.php +++ b/src/Generated/Model/UserPhoneNumberCreateRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/UserPhoneNumberDeleteReq.php b/src/Generated/Model/UserPhoneNumberDeleteReq.php index 7f9aa3d..278b192 100644 --- a/src/Generated/Model/UserPhoneNumberDeleteReq.php +++ b/src/Generated/Model/UserPhoneNumberDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class UserPhoneNumberDeleteReq implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/UserPhoneNumberGetRsp.php b/src/Generated/Model/UserPhoneNumberGetRsp.php index 15f08f5..5735a57 100644 --- a/src/Generated/Model/UserPhoneNumberGetRsp.php +++ b/src/Generated/Model/UserPhoneNumberGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserPhoneNumberGetRsp implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserPhoneNumberGetRspAllOfData.php b/src/Generated/Model/UserPhoneNumberGetRspAllOfData.php index ff84f7f..a908acb 100644 --- a/src/Generated/Model/UserPhoneNumberGetRspAllOfData.php +++ b/src/Generated/Model/UserPhoneNumberGetRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** diff --git a/src/Generated/Model/UserStats.php b/src/Generated/Model/UserStats.php index a2849c1..6cd31d4 100644 --- a/src/Generated/Model/UserStats.php +++ b/src/Generated/Model/UserStats.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class UserStats implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'time_point' => false, - 'total_users' => false, - 'sign_ups' => false, - 'active_users' => false, - 'count_passkey_login' => false, - 'count_email_login' => false, - 'count_password_login' => false, - 'successful_logins' => false, - 'failed_logins' => false + 'total_users' => false, + 'sign_ups' => false, + 'active_users' => false, + 'count_passkey_login' => false, + 'count_email_login' => false, + 'count_password_login' => false, + 'successful_logins' => false, + 'failed_logins' => false ]; /** diff --git a/src/Generated/Model/UserStatsListRsp.php b/src/Generated/Model/UserStatsListRsp.php index ee1b710..4a47ac4 100644 --- a/src/Generated/Model/UserStatsListRsp.php +++ b/src/Generated/Model/UserStatsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserStatsListRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/UserStatsListRspAllOfData.php b/src/Generated/Model/UserStatsListRspAllOfData.php index 7d364d8..d06d4a6 100644 --- a/src/Generated/Model/UserStatsListRspAllOfData.php +++ b/src/Generated/Model/UserStatsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class UserStatsListRspAllOfData implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'stats' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/Model/UserUpdateReq.php b/src/Generated/Model/UserUpdateReq.php index d279657..aa90b63 100644 --- a/src/Generated/Model/UserUpdateReq.php +++ b/src/Generated/Model/UserUpdateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -60,6 +60,7 @@ class UserUpdateReq implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'name' => 'string', 'full_name' => 'string', + 'status' => 'string', 'request_id' => 'string', 'client_info' => '\Corbado\Generated\Model\ClientInfo' ]; @@ -74,6 +75,7 @@ class UserUpdateReq implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'name' => null, 'full_name' => null, + 'status' => null, 'request_id' => null, 'client_info' => null ]; @@ -85,9 +87,10 @@ class UserUpdateReq implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'name' => false, - 'full_name' => false, - 'request_id' => false, - 'client_info' => false + 'full_name' => false, + 'status' => false, + 'request_id' => false, + 'client_info' => false ]; /** @@ -178,6 +181,7 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'name' => 'name', 'full_name' => 'fullName', + 'status' => 'status', 'request_id' => 'requestID', 'client_info' => 'clientInfo' ]; @@ -190,6 +194,7 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'name' => 'setName', 'full_name' => 'setFullName', + 'status' => 'setStatus', 'request_id' => 'setRequestId', 'client_info' => 'setClientInfo' ]; @@ -202,6 +207,7 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'name' => 'getName', 'full_name' => 'getFullName', + 'status' => 'getStatus', 'request_id' => 'getRequestId', 'client_info' => 'getClientInfo' ]; @@ -247,6 +253,21 @@ public function getModelName() return self::$openAPIModelName; } + public const STATUS_ACTIVE = 'active'; + public const STATUS_DISABLED = 'disabled'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_ACTIVE, + self::STATUS_DISABLED, + ]; + } /** * Associative array for storing property values @@ -265,6 +286,7 @@ public function __construct(array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('full_name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); $this->setIfExists('request_id', $data ?? [], null); $this->setIfExists('client_info', $data ?? [], null); } @@ -296,6 +318,15 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -365,6 +396,43 @@ public function setFullName($full_name) return $this; } + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** * Gets request_id * diff --git a/src/Generated/Model/UserUpdateRsp.php b/src/Generated/Model/UserUpdateRsp.php index 0f320bc..6da6afc 100644 --- a/src/Generated/Model/UserUpdateRsp.php +++ b/src/Generated/Model/UserUpdateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class UserUpdateRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/ValidateEmailReq.php b/src/Generated/Model/ValidateEmailReq.php index 7da2c08..ee7521f 100644 --- a/src/Generated/Model/ValidateEmailReq.php +++ b/src/Generated/Model/ValidateEmailReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class ValidateEmailReq implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'email' => false, - 'smtp_check' => false, - 'suggest_domain' => false, - 'request_id' => false, - 'client_info' => false + 'smtp_check' => false, + 'suggest_domain' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/ValidateEmailRsp.php b/src/Generated/Model/ValidateEmailRsp.php index 27faf20..b8a680a 100644 --- a/src/Generated/Model/ValidateEmailRsp.php +++ b/src/Generated/Model/ValidateEmailRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class ValidateEmailRsp implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/ValidatePhoneNumberReq.php b/src/Generated/Model/ValidatePhoneNumberReq.php index e70581a..9795ab3 100644 --- a/src/Generated/Model/ValidatePhoneNumberReq.php +++ b/src/Generated/Model/ValidatePhoneNumberReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class ValidatePhoneNumberReq implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'region_code' => false, - 'phone_number' => false, - 'request_id' => false, - 'client_info' => false + 'phone_number' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/ValidatePhoneNumberRsp.php b/src/Generated/Model/ValidatePhoneNumberRsp.php index e20c039..3092b89 100644 --- a/src/Generated/Model/ValidatePhoneNumberRsp.php +++ b/src/Generated/Model/ValidatePhoneNumberRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class ValidatePhoneNumberRsp implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/ValidationEmail.php b/src/Generated/Model/ValidationEmail.php index 3be7c39..c1d2336 100644 --- a/src/Generated/Model/ValidationEmail.php +++ b/src/Generated/Model/ValidationEmail.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class ValidationEmail implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'username' => false, - 'domain' => false, - 'reachable' => false, - 'disposable' => false, - 'free' => false, - 'has_mx_records' => false + 'domain' => false, + 'reachable' => false, + 'disposable' => false, + 'free' => false, + 'has_mx_records' => false ]; /** diff --git a/src/Generated/Model/ValidationPhoneNumber.php b/src/Generated/Model/ValidationPhoneNumber.php index a21d4fa..bf70aa8 100644 --- a/src/Generated/Model/ValidationPhoneNumber.php +++ b/src/Generated/Model/ValidationPhoneNumber.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class ValidationPhoneNumber implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'national_number' => false, - 'country_code' => false, - 'region_code' => false, - 'national_formatted' => false, - 'international_formatted' => false + 'country_code' => false, + 'region_code' => false, + 'national_formatted' => false, + 'international_formatted' => false ]; /** diff --git a/src/Generated/Model/WebAuthnAssociateStartReq.php b/src/Generated/Model/WebAuthnAssociateStartReq.php new file mode 100644 index 0000000..985891b --- /dev/null +++ b/src/Generated/Model/WebAuthnAssociateStartReq.php @@ -0,0 +1,481 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * WebAuthnAssociateStartReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class WebAuthnAssociateStartReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'webAuthnAssociateStartReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_token' => 'string', + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_token' => null, + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_token' => false, + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_token' => 'associationToken', + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_token' => 'setAssociationToken', + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_token' => 'getAssociationToken', + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('association_token', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_token'] === null) { + $invalidProperties[] = "'association_token' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_token + * + * @return string + */ + public function getAssociationToken() + { + return $this->container['association_token']; + } + + /** + * Sets association_token + * + * @param string $association_token association_token + * + * @return self + */ + public function setAssociationToken($association_token) + { + if (is_null($association_token)) { + throw new \InvalidArgumentException('non-nullable association_token cannot be null'); + } + $this->container['association_token'] = $association_token; + + return $this; + } + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo|null + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo|null $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/WebAuthnAssociateStartRsp.php b/src/Generated/Model/WebAuthnAssociateStartRsp.php new file mode 100644 index 0000000..67de091 --- /dev/null +++ b/src/Generated/Model/WebAuthnAssociateStartRsp.php @@ -0,0 +1,648 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * WebAuthnAssociateStartRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class WebAuthnAssociateStartRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'webAuthnAssociateStartRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'status' => 'string', + 'public_key_credential_creation_options' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'status' => null, + 'public_key_credential_creation_options' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'status' => false, + 'public_key_credential_creation_options' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'status' => 'status', + 'public_key_credential_creation_options' => 'publicKeyCredentialCreationOptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'status' => 'setStatus', + 'public_key_credential_creation_options' => 'setPublicKeyCredentialCreationOptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'status' => 'getStatus', + 'public_key_credential_creation_options' => 'getPublicKeyCredentialCreationOptions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_SUCCESS = 'success'; + public const STATUS_DUPLICATE = 'duplicate'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCESS, + self::STATUS_DUPLICATE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('public_key_credential_creation_options', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['public_key_credential_creation_options'] === null) { + $invalidProperties[] = "'public_key_credential_creation_options' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling WebAuthnAssociateStartRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling WebAuthnAssociateStartRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status represents information if user signup was successful or the user with its credentials already exists + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets public_key_credential_creation_options + * + * @return string + */ + public function getPublicKeyCredentialCreationOptions() + { + return $this->container['public_key_credential_creation_options']; + } + + /** + * Sets public_key_credential_creation_options + * + * @param string $public_key_credential_creation_options Contains JSON payload data to start Passkeys (Biometrics) sign up challenge + * + * @return self + */ + public function setPublicKeyCredentialCreationOptions($public_key_credential_creation_options) + { + if (is_null($public_key_credential_creation_options)) { + throw new \InvalidArgumentException('non-nullable public_key_credential_creation_options cannot be null'); + } + $this->container['public_key_credential_creation_options'] = $public_key_credential_creation_options; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/WebAuthnAuthenticateFinishRsp.php b/src/Generated/Model/WebAuthnAuthenticateFinishRsp.php index 278d11c..a9fc35f 100644 --- a/src/Generated/Model/WebAuthnAuthenticateFinishRsp.php +++ b/src/Generated/Model/WebAuthnAuthenticateFinishRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class WebAuthnAuthenticateFinishRsp implements ModelInterface, ArrayAccess, \Jso */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'user_id' => false, - 'username' => false, - 'credential_id' => false, - 'user_full_name' => false, - 'status' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'user_id' => false, + 'username' => false, + 'credential_id' => false, + 'user_full_name' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/WebAuthnAuthenticateStartReq.php b/src/Generated/Model/WebAuthnAuthenticateStartReq.php index a278700..c2243d4 100644 --- a/src/Generated/Model/WebAuthnAuthenticateStartReq.php +++ b/src/Generated/Model/WebAuthnAuthenticateStartReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -58,7 +58,6 @@ class WebAuthnAuthenticateStartReq implements ModelInterface, ArrayAccess, \Json * @var string[] */ protected static $openAPITypes = [ - 'origin' => 'string', 'username' => 'string', 'request_id' => 'string', 'client_info' => '\Corbado\Generated\Model\ClientInfo' @@ -72,7 +71,6 @@ class WebAuthnAuthenticateStartReq implements ModelInterface, ArrayAccess, \Json * @psalm-var array */ protected static $openAPIFormats = [ - 'origin' => null, 'username' => null, 'request_id' => null, 'client_info' => null @@ -84,10 +82,9 @@ class WebAuthnAuthenticateStartReq implements ModelInterface, ArrayAccess, \Json * @var boolean[] */ protected static array $openAPINullables = [ - 'origin' => false, - 'username' => false, - 'request_id' => false, - 'client_info' => false + 'username' => false, + 'request_id' => false, + 'client_info' => false ]; /** @@ -176,7 +173,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'origin' => 'origin', 'username' => 'username', 'request_id' => 'requestID', 'client_info' => 'clientInfo' @@ -188,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'origin' => 'setOrigin', 'username' => 'setUsername', 'request_id' => 'setRequestId', 'client_info' => 'setClientInfo' @@ -200,7 +195,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'origin' => 'getOrigin', 'username' => 'getUsername', 'request_id' => 'getRequestId', 'client_info' => 'getClientInfo' @@ -263,7 +257,6 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('origin', $data ?? [], null); $this->setIfExists('username', $data ?? [], null); $this->setIfExists('request_id', $data ?? [], null); $this->setIfExists('client_info', $data ?? [], null); @@ -296,9 +289,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['origin'] === null) { - $invalidProperties[] = "'origin' can't be null"; - } if ($this->container['username'] === null) { $invalidProperties[] = "'username' can't be null"; } @@ -320,33 +310,6 @@ public function valid() } - /** - * Gets origin - * - * @return string - */ - public function getOrigin() - { - return $this->container['origin']; - } - - /** - * Sets origin - * - * @param string $origin External application address including protocol and port when not 80 or 443 - * - * @return self - */ - public function setOrigin($origin) - { - if (is_null($origin)) { - throw new \InvalidArgumentException('non-nullable origin cannot be null'); - } - $this->container['origin'] = $origin; - - return $this; - } - /** * Gets username * diff --git a/src/Generated/Model/WebAuthnAuthenticateStartRsp.php b/src/Generated/Model/WebAuthnAuthenticateStartRsp.php index cc1b52c..6463213 100644 --- a/src/Generated/Model/WebAuthnAuthenticateStartRsp.php +++ b/src/Generated/Model/WebAuthnAuthenticateStartRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class WebAuthnAuthenticateStartRsp implements ModelInterface, ArrayAccess, \Json */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'public_key_credential_request_options' => false, - 'status' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'public_key_credential_request_options' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/WebAuthnAuthenticateSuccess.php b/src/Generated/Model/WebAuthnAuthenticateSuccess.php index 829e182..eff64f0 100644 --- a/src/Generated/Model/WebAuthnAuthenticateSuccess.php +++ b/src/Generated/Model/WebAuthnAuthenticateSuccess.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -93,13 +93,13 @@ class WebAuthnAuthenticateSuccess implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'user_id' => false, - 'username' => false, - 'credential_id' => false, - 'user_full_name' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'user_id' => false, + 'username' => false, + 'credential_id' => false, + 'user_full_name' => false ]; /** diff --git a/src/Generated/Model/WebAuthnAuthenticatorUpdateReq.php b/src/Generated/Model/WebAuthnAuthenticatorUpdateReq.php new file mode 100644 index 0000000..abd1122 --- /dev/null +++ b/src/Generated/Model/WebAuthnAuthenticatorUpdateReq.php @@ -0,0 +1,481 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * WebAuthnAuthenticatorUpdateReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class WebAuthnAuthenticatorUpdateReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'webAuthnAuthenticatorUpdateReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo|null + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo|null $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/WebAuthnCredentialExistsReq.php b/src/Generated/Model/WebAuthnCredentialExistsReq.php new file mode 100644 index 0000000..45fee4a --- /dev/null +++ b/src/Generated/Model/WebAuthnCredentialExistsReq.php @@ -0,0 +1,521 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * WebAuthnCredentialExistsReq Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class WebAuthnCredentialExistsReq implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'webAuthnCredentialExistsReq'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'login_identifier' => 'string', + 'login_identifier_type' => '\Corbado\Generated\Model\LoginIdentifierType', + 'request_id' => 'string', + 'client_info' => '\Corbado\Generated\Model\ClientInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'login_identifier' => null, + 'login_identifier_type' => null, + 'request_id' => null, + 'client_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'login_identifier' => false, + 'login_identifier_type' => false, + 'request_id' => false, + 'client_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'login_identifier' => 'loginIdentifier', + 'login_identifier_type' => 'loginIdentifierType', + 'request_id' => 'requestID', + 'client_info' => 'clientInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'login_identifier' => 'setLoginIdentifier', + 'login_identifier_type' => 'setLoginIdentifierType', + 'request_id' => 'setRequestId', + 'client_info' => 'setClientInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'login_identifier' => 'getLoginIdentifier', + 'login_identifier_type' => 'getLoginIdentifierType', + 'request_id' => 'getRequestId', + 'client_info' => 'getClientInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('login_identifier', $data ?? [], null); + $this->setIfExists('login_identifier_type', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('client_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['login_identifier'] === null) { + $invalidProperties[] = "'login_identifier' can't be null"; + } + if ($this->container['login_identifier_type'] === null) { + $invalidProperties[] = "'login_identifier_type' can't be null"; + } + if ($this->container['client_info'] === null) { + $invalidProperties[] = "'client_info' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets login_identifier + * + * @return string + */ + public function getLoginIdentifier() + { + return $this->container['login_identifier']; + } + + /** + * Sets login_identifier + * + * @param string $login_identifier login_identifier + * + * @return self + */ + public function setLoginIdentifier($login_identifier) + { + if (is_null($login_identifier)) { + throw new \InvalidArgumentException('non-nullable login_identifier cannot be null'); + } + $this->container['login_identifier'] = $login_identifier; + + return $this; + } + + /** + * Gets login_identifier_type + * + * @return \Corbado\Generated\Model\LoginIdentifierType + */ + public function getLoginIdentifierType() + { + return $this->container['login_identifier_type']; + } + + /** + * Sets login_identifier_type + * + * @param \Corbado\Generated\Model\LoginIdentifierType $login_identifier_type login_identifier_type + * + * @return self + */ + public function setLoginIdentifierType($login_identifier_type) + { + if (is_null($login_identifier_type)) { + throw new \InvalidArgumentException('non-nullable login_identifier_type cannot be null'); + } + $this->container['login_identifier_type'] = $login_identifier_type; + + return $this; + } + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id Unique ID of request, you can provide your own while making the request, if not the ID will be randomly generated on server side + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets client_info + * + * @return \Corbado\Generated\Model\ClientInfo + */ + public function getClientInfo() + { + return $this->container['client_info']; + } + + /** + * Sets client_info + * + * @param \Corbado\Generated\Model\ClientInfo $client_info client_info + * + * @return self + */ + public function setClientInfo($client_info) + { + if (is_null($client_info)) { + throw new \InvalidArgumentException('non-nullable client_info cannot be null'); + } + $this->container['client_info'] = $client_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/WebAuthnCredentialExistsRsp.php b/src/Generated/Model/WebAuthnCredentialExistsRsp.php new file mode 100644 index 0000000..78b49ce --- /dev/null +++ b/src/Generated/Model/WebAuthnCredentialExistsRsp.php @@ -0,0 +1,577 @@ +:>` The **authorization header** needs to be **Base64 encoded** to be working. If the authorization header is missing or incorrect, the API will respond with status code 401. # Error types As mentioned above we make use of HTTP status codes. **4xx** errors indicate so called client errors, meaning the error occurred on client side and you need to fix it. **5xx** errors indicate server errors, which means the error occurred on server side and outside your control. Besides HTTP status codes Corbado uses what we call error types which gives more details in error cases and help you to debug your request. ## internal_error The error type **internal_error** is used when some internal error occurred at Corbado. You can retry your request but usually there is nothing you can do about it. All internal errors get logged and will triggert an alert to our operations team which takes care of the situation as soon as possible. ## not_found The error type **not_found** is used when you try to get a resource which cannot be found. Most common case is that you provided a wrong ID. ## method_not_allowed The error type **method_not_allowed** is used when you use a HTTP method (GET for example) on a resource/endpoint which it not supports. ## validation_error The error type **validation_error** is used when there is validation error on the data you provided in the request payload or path. There will be detailed information in the JSON response about the validation error like what exactly went wrong on what field. ## project_id_mismatch The error type **project_id_mismatch** is used when there is a project ID you provided mismatch. ## login_error The error type **login_error** is used when the authentication failed. Most common case is that you provided a wrong pair of project ID and API secret. As mentioned above with use HTTP Basic Auth for authentication. ## invalid_json The error type **invalid_json** is used when you send invalid JSON as request body. There will be detailed information in the JSON response about what went wrong. ## rate_limited The error type **rate_limited** is used when ran into rate limiting of the Corbado Backend API. Right now you can do a maximum of **2000 requests** within **10 seconds** from a **single IP**. Throttle your requests and try again. If you think you need more contact support@corbado.com. ## invalid_origin The error type **invalid_origin** is used when the API has been called from a origin which is not authorized (CORS). Add the origin to your project at https://app.corbado.com/app/settings/credentials/authorized-origins. ## already_exists The error type **already_exists** is used when you try create a resource which already exists. Most common case is that there is some unique constraint on one of the fields. # Security and privacy Corbado services are designed, developed, monitored, and updated with security at our core to protect you and your customers’ data and privacy. ## Security ### Infrastructure security Corbado leverages highly available and secure cloud infrastructure to ensure that our services are always available and securely delivered. Corbado's services are operated in uvensys GmbH's data centers in Germany and comply with ISO standard 27001. All data centers have redundant power and internet connections to avoid failure. The main location of the servers used is in Linden and offers 24/7 support. We do not use any AWS, GCP or Azure services. Each server is monitored 24/7 and in the event of problems, automated information is sent via SMS and e-mail. The monitoring is done by the external service provider Serverguard24 GmbH. All Corbado hardware and networking is routinely updated and audited to ensure systems are secure and that least privileged access is followed. Additionally we implement robust logging and audit protocols that allow us high visibility into system use. ### Responsible disclosure program Here at Corbado, we take the security of our user’s data and of our services seriously. As such, we encourage responsible security research on Corbado services and products. If you believe you’ve discovered a potential vulnerability, please let us know by emailing us at [security@corbado.com](mailto:security@corbado.com). We will acknowledge your email within 2 business days. As public disclosures of a security vulnerability could put the entire Corbado community at risk, we ask that you keep such potential vulnerabilities confidential until we are able to address them. We aim to resolve critical issues within 30 days of disclosure. Please make a good faith effort to avoid violating privacy, destroying data, or interrupting or degrading the Corbado service. Please only interact with accounts you own or for which you have explicit permission from the account holder. While researching, please refrain from: - Distributed Denial of Service (DDoS) - Spamming - Social engineering or phishing of Corbado employees or contractors - Any attacks against Corbado's physical property or data centers Thank you for helping to keep Corbado and our users safe! ### Rate limiting At Corbado, we apply rate limit policies on our APIs in order to protect your application and user management infrastructure, so your users will have a frictionless non-interrupted experience. Corbado responds with HTTP status code 429 (too many requests) when the rate limits exceed. Your code logic should be able to handle such cases by checking the status code on the response and recovering from such cases. If a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. The current rate limit for all our API endpoints is **max. 100 requests per 10 seconds**. ## Privacy Corbado is committed to protecting the personal data of our customers and their customers. Corbado has in place appropriate data security measures that meet industry standards. We regularly review and make enhancements to our processes, products, documentation, and contracts to help support ours and our customers’ compliance for the processing of personal data. We try to minimize the usage and processing of personally identifiable information. Therefore, all our services are constructed to avoid unnecessary data consumption. To make our services work, we only require the following data: - any kind of identifier (e.g. UUID, phone number, email address) - IP address (only temporarily for rate limiting aspects) - User agent (for device management) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@corbado.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 7.2.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace Corbado\Generated\Model; + +use \ArrayAccess; +use \Corbado\Generated\ObjectSerializer; + +/** + * WebAuthnCredentialExistsRsp Class Doc Comment + * + * @category Class + * @package Corbado\Generated + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class WebAuthnCredentialExistsRsp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'webAuthnCredentialExistsRsp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'http_status_code' => 'int', + 'message' => 'string', + 'request_data' => '\Corbado\Generated\Model\RequestData', + 'runtime' => 'float', + 'exists' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'http_status_code' => 'int32', + 'message' => null, + 'request_data' => null, + 'runtime' => 'float', + 'exists' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'http_status_code' => false, + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'exists' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'http_status_code' => 'httpStatusCode', + 'message' => 'message', + 'request_data' => 'requestData', + 'runtime' => 'runtime', + 'exists' => 'exists' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'http_status_code' => 'setHttpStatusCode', + 'message' => 'setMessage', + 'request_data' => 'setRequestData', + 'runtime' => 'setRuntime', + 'exists' => 'setExists' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'http_status_code' => 'getHttpStatusCode', + 'message' => 'getMessage', + 'request_data' => 'getRequestData', + 'runtime' => 'getRuntime', + 'exists' => 'getExists' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('request_data', $data ?? [], null); + $this->setIfExists('runtime', $data ?? [], null); + $this->setIfExists('exists', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + if (($this->container['http_status_code'] > 599)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be smaller than or equal to 599."; + } + + if (($this->container['http_status_code'] < 200)) { + $invalidProperties[] = "invalid value for 'http_status_code', must be bigger than or equal to 200."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['request_data'] === null) { + $invalidProperties[] = "'request_data' can't be null"; + } + if ($this->container['runtime'] === null) { + $invalidProperties[] = "'runtime' can't be null"; + } + if ($this->container['exists'] === null) { + $invalidProperties[] = "'exists' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets http_status_code + * + * @return int + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param int $http_status_code HTTP status code of operation + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + + if (($http_status_code > 599)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling WebAuthnCredentialExistsRsp., must be smaller than or equal to 599.'); + } + if (($http_status_code < 200)) { + throw new \InvalidArgumentException('invalid value for $http_status_code when calling WebAuthnCredentialExistsRsp., must be bigger than or equal to 200.'); + } + + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets request_data + * + * @return \Corbado\Generated\Model\RequestData + */ + public function getRequestData() + { + return $this->container['request_data']; + } + + /** + * Sets request_data + * + * @param \Corbado\Generated\Model\RequestData $request_data request_data + * + * @return self + */ + public function setRequestData($request_data) + { + if (is_null($request_data)) { + throw new \InvalidArgumentException('non-nullable request_data cannot be null'); + } + $this->container['request_data'] = $request_data; + + return $this; + } + + /** + * Gets runtime + * + * @return float + */ + public function getRuntime() + { + return $this->container['runtime']; + } + + /** + * Sets runtime + * + * @param float $runtime Runtime in seconds for this request + * + * @return self + */ + public function setRuntime($runtime) + { + if (is_null($runtime)) { + throw new \InvalidArgumentException('non-nullable runtime cannot be null'); + } + $this->container['runtime'] = $runtime; + + return $this; + } + + /** + * Gets exists + * + * @return bool + */ + public function getExists() + { + return $this->container['exists']; + } + + /** + * Sets exists + * + * @param bool $exists exists + * + * @return self + */ + public function setExists($exists) + { + if (is_null($exists)) { + throw new \InvalidArgumentException('non-nullable exists cannot be null'); + } + $this->container['exists'] = $exists; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Generated/Model/WebAuthnCredentialItemRsp.php b/src/Generated/Model/WebAuthnCredentialItemRsp.php index ac02880..0cd2d2b 100644 --- a/src/Generated/Model/WebAuthnCredentialItemRsp.php +++ b/src/Generated/Model/WebAuthnCredentialItemRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -63,7 +63,19 @@ class WebAuthnCredentialItemRsp implements ModelInterface, ArrayAccess, \JsonSer 'request_data' => '\Corbado\Generated\Model\RequestData', 'runtime' => 'float', 'id' => 'string', - 'status' => 'string' + 'credential_hash' => 'string', + 'aaguid' => 'string', + 'attestation_type' => 'string', + 'backup_state' => 'bool', + 'backup_eligible' => 'bool', + 'transport' => 'string[]', + 'status' => 'string', + 'user_agent' => 'string', + 'created' => 'string', + 'authenticator_id' => 'string', + 'authenticator_name' => 'string', + 'last_used' => 'string', + 'last_used_device_name' => 'string' ]; /** @@ -79,7 +91,19 @@ class WebAuthnCredentialItemRsp implements ModelInterface, ArrayAccess, \JsonSer 'request_data' => null, 'runtime' => 'float', 'id' => null, - 'status' => null + 'credential_hash' => null, + 'aaguid' => null, + 'attestation_type' => null, + 'backup_state' => null, + 'backup_eligible' => null, + 'transport' => null, + 'status' => null, + 'user_agent' => null, + 'created' => null, + 'authenticator_id' => null, + 'authenticator_name' => null, + 'last_used' => null, + 'last_used_device_name' => null ]; /** @@ -89,11 +113,23 @@ class WebAuthnCredentialItemRsp implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'id' => false, - 'status' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'id' => false, + 'credential_hash' => false, + 'aaguid' => false, + 'attestation_type' => false, + 'backup_state' => false, + 'backup_eligible' => false, + 'transport' => false, + 'status' => false, + 'user_agent' => false, + 'created' => false, + 'authenticator_id' => false, + 'authenticator_name' => false, + 'last_used' => false, + 'last_used_device_name' => false ]; /** @@ -187,7 +223,19 @@ public function isNullableSetToNull(string $property): bool 'request_data' => 'requestData', 'runtime' => 'runtime', 'id' => 'id', - 'status' => 'status' + 'credential_hash' => 'credentialHash', + 'aaguid' => 'aaguid', + 'attestation_type' => 'attestationType', + 'backup_state' => 'backupState', + 'backup_eligible' => 'backupEligible', + 'transport' => 'transport', + 'status' => 'status', + 'user_agent' => 'userAgent', + 'created' => 'created', + 'authenticator_id' => 'authenticatorID', + 'authenticator_name' => 'authenticatorName', + 'last_used' => 'lastUsed', + 'last_used_device_name' => 'lastUsedDeviceName' ]; /** @@ -201,7 +249,19 @@ public function isNullableSetToNull(string $property): bool 'request_data' => 'setRequestData', 'runtime' => 'setRuntime', 'id' => 'setId', - 'status' => 'setStatus' + 'credential_hash' => 'setCredentialHash', + 'aaguid' => 'setAaguid', + 'attestation_type' => 'setAttestationType', + 'backup_state' => 'setBackupState', + 'backup_eligible' => 'setBackupEligible', + 'transport' => 'setTransport', + 'status' => 'setStatus', + 'user_agent' => 'setUserAgent', + 'created' => 'setCreated', + 'authenticator_id' => 'setAuthenticatorId', + 'authenticator_name' => 'setAuthenticatorName', + 'last_used' => 'setLastUsed', + 'last_used_device_name' => 'setLastUsedDeviceName' ]; /** @@ -215,7 +275,19 @@ public function isNullableSetToNull(string $property): bool 'request_data' => 'getRequestData', 'runtime' => 'getRuntime', 'id' => 'getId', - 'status' => 'getStatus' + 'credential_hash' => 'getCredentialHash', + 'aaguid' => 'getAaguid', + 'attestation_type' => 'getAttestationType', + 'backup_state' => 'getBackupState', + 'backup_eligible' => 'getBackupEligible', + 'transport' => 'getTransport', + 'status' => 'getStatus', + 'user_agent' => 'getUserAgent', + 'created' => 'getCreated', + 'authenticator_id' => 'getAuthenticatorId', + 'authenticator_name' => 'getAuthenticatorName', + 'last_used' => 'getLastUsed', + 'last_used_device_name' => 'getLastUsedDeviceName' ]; /** @@ -259,9 +331,32 @@ public function getModelName() return self::$openAPIModelName; } + public const TRANSPORT_USB = 'usb'; + public const TRANSPORT_NFC = 'nfc'; + public const TRANSPORT_BLE = 'ble'; + public const TRANSPORT_INTERNAL = 'internal'; + public const TRANSPORT_HYBRID = 'hybrid'; + public const TRANSPORT_SMART_CARD = 'smart-card'; public const STATUS_PENDING = 'pending'; public const STATUS_ACTIVE = 'active'; + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTransportAllowableValues() + { + return [ + self::TRANSPORT_USB, + self::TRANSPORT_NFC, + self::TRANSPORT_BLE, + self::TRANSPORT_INTERNAL, + self::TRANSPORT_HYBRID, + self::TRANSPORT_SMART_CARD, + ]; + } + /** * Gets allowable values of the enum * @@ -295,7 +390,19 @@ public function __construct(array $data = null) $this->setIfExists('request_data', $data ?? [], null); $this->setIfExists('runtime', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('credential_hash', $data ?? [], null); + $this->setIfExists('aaguid', $data ?? [], null); + $this->setIfExists('attestation_type', $data ?? [], null); + $this->setIfExists('backup_state', $data ?? [], null); + $this->setIfExists('backup_eligible', $data ?? [], null); + $this->setIfExists('transport', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('user_agent', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('authenticator_id', $data ?? [], null); + $this->setIfExists('authenticator_name', $data ?? [], null); + $this->setIfExists('last_used', $data ?? [], null); + $this->setIfExists('last_used_device_name', $data ?? [], null); } /** @@ -348,6 +455,21 @@ public function listInvalidProperties() if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } + if ($this->container['credential_hash'] === null) { + $invalidProperties[] = "'credential_hash' can't be null"; + } + if ($this->container['aaguid'] === null) { + $invalidProperties[] = "'aaguid' can't be null"; + } + if ($this->container['attestation_type'] === null) { + $invalidProperties[] = "'attestation_type' can't be null"; + } + if ($this->container['backup_eligible'] === null) { + $invalidProperties[] = "'backup_eligible' can't be null"; + } + if ($this->container['transport'] === null) { + $invalidProperties[] = "'transport' can't be null"; + } if ($this->container['status'] === null) { $invalidProperties[] = "'status' can't be null"; } @@ -360,6 +482,24 @@ public function listInvalidProperties() ); } + if ($this->container['user_agent'] === null) { + $invalidProperties[] = "'user_agent' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['authenticator_id'] === null) { + $invalidProperties[] = "'authenticator_id' can't be null"; + } + if ($this->container['authenticator_name'] === null) { + $invalidProperties[] = "'authenticator_name' can't be null"; + } + if ($this->container['last_used'] === null) { + $invalidProperties[] = "'last_used' can't be null"; + } + if ($this->container['last_used_device_name'] === null) { + $invalidProperties[] = "'last_used_device_name' can't be null"; + } return $invalidProperties; } @@ -518,6 +658,177 @@ public function setId($id) return $this; } + /** + * Gets credential_hash + * + * @return string + */ + public function getCredentialHash() + { + return $this->container['credential_hash']; + } + + /** + * Sets credential_hash + * + * @param string $credential_hash credential_hash + * + * @return self + */ + public function setCredentialHash($credential_hash) + { + if (is_null($credential_hash)) { + throw new \InvalidArgumentException('non-nullable credential_hash cannot be null'); + } + $this->container['credential_hash'] = $credential_hash; + + return $this; + } + + /** + * Gets aaguid + * + * @return string + */ + public function getAaguid() + { + return $this->container['aaguid']; + } + + /** + * Sets aaguid + * + * @param string $aaguid aaguid + * + * @return self + */ + public function setAaguid($aaguid) + { + if (is_null($aaguid)) { + throw new \InvalidArgumentException('non-nullable aaguid cannot be null'); + } + $this->container['aaguid'] = $aaguid; + + return $this; + } + + /** + * Gets attestation_type + * + * @return string + */ + public function getAttestationType() + { + return $this->container['attestation_type']; + } + + /** + * Sets attestation_type + * + * @param string $attestation_type attestation_type + * + * @return self + */ + public function setAttestationType($attestation_type) + { + if (is_null($attestation_type)) { + throw new \InvalidArgumentException('non-nullable attestation_type cannot be null'); + } + $this->container['attestation_type'] = $attestation_type; + + return $this; + } + + /** + * Gets backup_state + * + * @return bool|null + */ + public function getBackupState() + { + return $this->container['backup_state']; + } + + /** + * Sets backup_state + * + * @param bool|null $backup_state Backup state + * + * @return self + */ + public function setBackupState($backup_state) + { + if (is_null($backup_state)) { + throw new \InvalidArgumentException('non-nullable backup_state cannot be null'); + } + $this->container['backup_state'] = $backup_state; + + return $this; + } + + /** + * Gets backup_eligible + * + * @return bool + */ + public function getBackupEligible() + { + return $this->container['backup_eligible']; + } + + /** + * Sets backup_eligible + * + * @param bool $backup_eligible Backup eligible + * + * @return self + */ + public function setBackupEligible($backup_eligible) + { + if (is_null($backup_eligible)) { + throw new \InvalidArgumentException('non-nullable backup_eligible cannot be null'); + } + $this->container['backup_eligible'] = $backup_eligible; + + return $this; + } + + /** + * Gets transport + * + * @return string[] + */ + public function getTransport() + { + return $this->container['transport']; + } + + /** + * Sets transport + * + * @param string[] $transport Transport + * + * @return self + */ + public function setTransport($transport) + { + if (is_null($transport)) { + throw new \InvalidArgumentException('non-nullable transport cannot be null'); + } + $allowedValues = $this->getTransportAllowableValues(); + if (array_diff($transport, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'transport', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['transport'] = $transport; + + return $this; + } + /** * Gets status * @@ -554,6 +865,168 @@ public function setStatus($status) return $this; } + + /** + * Gets user_agent + * + * @return string + */ + public function getUserAgent() + { + return $this->container['user_agent']; + } + + /** + * Sets user_agent + * + * @param string $user_agent User agent + * + * @return self + */ + public function setUserAgent($user_agent) + { + if (is_null($user_agent)) { + throw new \InvalidArgumentException('non-nullable user_agent cannot be null'); + } + $this->container['user_agent'] = $user_agent; + + return $this; + } + + /** + * Gets created + * + * @return string + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param string $created Timestamp of when the entity was created in yyyy-MM-dd'T'HH:mm:ss format + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets authenticator_id + * + * @return string + */ + public function getAuthenticatorId() + { + return $this->container['authenticator_id']; + } + + /** + * Sets authenticator_id + * + * @param string $authenticator_id Authenticator ID + * + * @return self + */ + public function setAuthenticatorId($authenticator_id) + { + if (is_null($authenticator_id)) { + throw new \InvalidArgumentException('non-nullable authenticator_id cannot be null'); + } + $this->container['authenticator_id'] = $authenticator_id; + + return $this; + } + + /** + * Gets authenticator_name + * + * @return string + */ + public function getAuthenticatorName() + { + return $this->container['authenticator_name']; + } + + /** + * Sets authenticator_name + * + * @param string $authenticator_name authenticator_name + * + * @return self + */ + public function setAuthenticatorName($authenticator_name) + { + if (is_null($authenticator_name)) { + throw new \InvalidArgumentException('non-nullable authenticator_name cannot be null'); + } + $this->container['authenticator_name'] = $authenticator_name; + + return $this; + } + + /** + * Gets last_used + * + * @return string + */ + public function getLastUsed() + { + return $this->container['last_used']; + } + + /** + * Sets last_used + * + * @param string $last_used Timestamp of when the passkey was last used in yyyy-MM-dd'T'HH:mm:ss format + * + * @return self + */ + public function setLastUsed($last_used) + { + if (is_null($last_used)) { + throw new \InvalidArgumentException('non-nullable last_used cannot be null'); + } + $this->container['last_used'] = $last_used; + + return $this; + } + + /** + * Gets last_used_device_name + * + * @return string + */ + public function getLastUsedDeviceName() + { + return $this->container['last_used_device_name']; + } + + /** + * Sets last_used_device_name + * + * @param string $last_used_device_name last_used_device_name + * + * @return self + */ + public function setLastUsedDeviceName($last_used_device_name) + { + if (is_null($last_used_device_name)) { + throw new \InvalidArgumentException('non-nullable last_used_device_name cannot be null'); + } + $this->container['last_used_device_name'] = $last_used_device_name; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Generated/Model/WebAuthnCredentialListRsp.php b/src/Generated/Model/WebAuthnCredentialListRsp.php index 3197787..887deef 100644 --- a/src/Generated/Model/WebAuthnCredentialListRsp.php +++ b/src/Generated/Model/WebAuthnCredentialListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class WebAuthnCredentialListRsp implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'rows' => false, - 'paging' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'rows' => false, + 'paging' => false ]; /** diff --git a/src/Generated/Model/WebAuthnCredentialReq.php b/src/Generated/Model/WebAuthnCredentialReq.php index 3672721..a10d3cd 100644 --- a/src/Generated/Model/WebAuthnCredentialReq.php +++ b/src/Generated/Model/WebAuthnCredentialReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -83,8 +83,8 @@ class WebAuthnCredentialReq implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'status' => false, - 'request_id' => false, - 'client_info' => false + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/WebAuthnCredentialRsp.php b/src/Generated/Model/WebAuthnCredentialRsp.php index 8b60ee7..c67412e 100644 --- a/src/Generated/Model/WebAuthnCredentialRsp.php +++ b/src/Generated/Model/WebAuthnCredentialRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class WebAuthnCredentialRsp implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'status' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/WebAuthnFinishReq.php b/src/Generated/Model/WebAuthnFinishReq.php index ae34012..e81975e 100644 --- a/src/Generated/Model/WebAuthnFinishReq.php +++ b/src/Generated/Model/WebAuthnFinishReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -58,7 +58,6 @@ class WebAuthnFinishReq implements ModelInterface, ArrayAccess, \JsonSerializabl * @var string[] */ protected static $openAPITypes = [ - 'origin' => 'string', 'public_key_credential' => 'string', 'request_id' => 'string', 'client_info' => '\Corbado\Generated\Model\ClientInfo' @@ -72,7 +71,6 @@ class WebAuthnFinishReq implements ModelInterface, ArrayAccess, \JsonSerializabl * @psalm-var array */ protected static $openAPIFormats = [ - 'origin' => null, 'public_key_credential' => null, 'request_id' => null, 'client_info' => null @@ -84,10 +82,9 @@ class WebAuthnFinishReq implements ModelInterface, ArrayAccess, \JsonSerializabl * @var boolean[] */ protected static array $openAPINullables = [ - 'origin' => false, - 'public_key_credential' => false, - 'request_id' => false, - 'client_info' => false + 'public_key_credential' => false, + 'request_id' => false, + 'client_info' => false ]; /** @@ -176,7 +173,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'origin' => 'origin', 'public_key_credential' => 'publicKeyCredential', 'request_id' => 'requestID', 'client_info' => 'clientInfo' @@ -188,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'origin' => 'setOrigin', 'public_key_credential' => 'setPublicKeyCredential', 'request_id' => 'setRequestId', 'client_info' => 'setClientInfo' @@ -200,7 +195,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'origin' => 'getOrigin', 'public_key_credential' => 'getPublicKeyCredential', 'request_id' => 'getRequestId', 'client_info' => 'getClientInfo' @@ -263,7 +257,6 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('origin', $data ?? [], null); $this->setIfExists('public_key_credential', $data ?? [], null); $this->setIfExists('request_id', $data ?? [], null); $this->setIfExists('client_info', $data ?? [], null); @@ -296,9 +289,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['origin'] === null) { - $invalidProperties[] = "'origin' can't be null"; - } if ($this->container['public_key_credential'] === null) { $invalidProperties[] = "'public_key_credential' can't be null"; } @@ -320,33 +310,6 @@ public function valid() } - /** - * Gets origin - * - * @return string - */ - public function getOrigin() - { - return $this->container['origin']; - } - - /** - * Sets origin - * - * @param string $origin External application address including protocol and port when not 80 or 443 - * - * @return self - */ - public function setOrigin($origin) - { - if (is_null($origin)) { - throw new \InvalidArgumentException('non-nullable origin cannot be null'); - } - $this->container['origin'] = $origin; - - return $this; - } - /** * Gets public_key_credential * diff --git a/src/Generated/Model/WebAuthnMediationStartReq.php b/src/Generated/Model/WebAuthnMediationStartReq.php index c7a6f29..800d8eb 100644 --- a/src/Generated/Model/WebAuthnMediationStartReq.php +++ b/src/Generated/Model/WebAuthnMediationStartReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -59,7 +59,6 @@ class WebAuthnMediationStartReq implements ModelInterface, ArrayAccess, \JsonSer */ protected static $openAPITypes = [ 'username' => 'string', - 'origin' => 'string', 'request_id' => 'string', 'client_info' => '\Corbado\Generated\Model\ClientInfo' ]; @@ -73,7 +72,6 @@ class WebAuthnMediationStartReq implements ModelInterface, ArrayAccess, \JsonSer */ protected static $openAPIFormats = [ 'username' => null, - 'origin' => null, 'request_id' => null, 'client_info' => null ]; @@ -85,9 +83,8 @@ class WebAuthnMediationStartReq implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'username' => false, - 'origin' => false, - 'request_id' => false, - 'client_info' => false + 'request_id' => false, + 'client_info' => false ]; /** @@ -177,7 +174,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'username' => 'username', - 'origin' => 'origin', 'request_id' => 'requestID', 'client_info' => 'clientInfo' ]; @@ -189,7 +185,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'username' => 'setUsername', - 'origin' => 'setOrigin', 'request_id' => 'setRequestId', 'client_info' => 'setClientInfo' ]; @@ -201,7 +196,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'username' => 'getUsername', - 'origin' => 'getOrigin', 'request_id' => 'getRequestId', 'client_info' => 'getClientInfo' ]; @@ -264,7 +258,6 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('username', $data ?? [], null); - $this->setIfExists('origin', $data ?? [], null); $this->setIfExists('request_id', $data ?? [], null); $this->setIfExists('client_info', $data ?? [], null); } @@ -296,9 +289,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['origin'] === null) { - $invalidProperties[] = "'origin' can't be null"; - } if ($this->container['client_info'] === null) { $invalidProperties[] = "'client_info' can't be null"; } @@ -344,33 +334,6 @@ public function setUsername($username) return $this; } - /** - * Gets origin - * - * @return string - */ - public function getOrigin() - { - return $this->container['origin']; - } - - /** - * Sets origin - * - * @param string $origin External application address including protocol and port when not 80 or 443 - * - * @return self - */ - public function setOrigin($origin) - { - if (is_null($origin)) { - throw new \InvalidArgumentException('non-nullable origin cannot be null'); - } - $this->container['origin'] = $origin; - - return $this; - } - /** * Gets request_id * diff --git a/src/Generated/Model/WebAuthnMediationStartRsp.php b/src/Generated/Model/WebAuthnMediationStartRsp.php index e2f4716..e91f6f7 100644 --- a/src/Generated/Model/WebAuthnMediationStartRsp.php +++ b/src/Generated/Model/WebAuthnMediationStartRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class WebAuthnMediationStartRsp implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'challenge' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'challenge' => false ]; /** diff --git a/src/Generated/Model/WebAuthnRegisterFinishRsp.php b/src/Generated/Model/WebAuthnRegisterFinishRsp.php index 144e1ed..ccb94b9 100644 --- a/src/Generated/Model/WebAuthnRegisterFinishRsp.php +++ b/src/Generated/Model/WebAuthnRegisterFinishRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class WebAuthnRegisterFinishRsp implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'user_id' => false, - 'username' => false, - 'credential_id' => false, - 'user_full_name' => false, - 'status' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'user_id' => false, + 'username' => false, + 'credential_id' => false, + 'user_full_name' => false, + 'status' => false ]; /** diff --git a/src/Generated/Model/WebAuthnRegisterStartReq.php b/src/Generated/Model/WebAuthnRegisterStartReq.php index 0352e2a..513435e 100644 --- a/src/Generated/Model/WebAuthnRegisterStartReq.php +++ b/src/Generated/Model/WebAuthnRegisterStartReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -58,7 +58,6 @@ class WebAuthnRegisterStartReq implements ModelInterface, ArrayAccess, \JsonSeri * @var string[] */ protected static $openAPITypes = [ - 'origin' => 'string', 'username' => 'string', 'user_full_name' => 'string', 'request_id' => 'string', @@ -74,7 +73,6 @@ class WebAuthnRegisterStartReq implements ModelInterface, ArrayAccess, \JsonSeri * @psalm-var array */ protected static $openAPIFormats = [ - 'origin' => null, 'username' => null, 'user_full_name' => null, 'request_id' => null, @@ -88,12 +86,11 @@ class WebAuthnRegisterStartReq implements ModelInterface, ArrayAccess, \JsonSeri * @var boolean[] */ protected static array $openAPINullables = [ - 'origin' => false, - 'username' => false, - 'user_full_name' => false, - 'request_id' => false, - 'client_info' => false, - 'credential_status' => false + 'username' => false, + 'user_full_name' => false, + 'request_id' => false, + 'client_info' => false, + 'credential_status' => false ]; /** @@ -182,7 +179,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'origin' => 'origin', 'username' => 'username', 'user_full_name' => 'userFullName', 'request_id' => 'requestID', @@ -196,7 +192,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'origin' => 'setOrigin', 'username' => 'setUsername', 'user_full_name' => 'setUserFullName', 'request_id' => 'setRequestId', @@ -210,7 +205,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'origin' => 'getOrigin', 'username' => 'getUsername', 'user_full_name' => 'getUserFullName', 'request_id' => 'getRequestId', @@ -290,7 +284,6 @@ public function getCredentialStatusAllowableValues() */ public function __construct(array $data = null) { - $this->setIfExists('origin', $data ?? [], null); $this->setIfExists('username', $data ?? [], null); $this->setIfExists('user_full_name', $data ?? [], null); $this->setIfExists('request_id', $data ?? [], null); @@ -325,9 +318,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['origin'] === null) { - $invalidProperties[] = "'origin' can't be null"; - } if ($this->container['username'] === null) { $invalidProperties[] = "'username' can't be null"; } @@ -358,33 +348,6 @@ public function valid() } - /** - * Gets origin - * - * @return string - */ - public function getOrigin() - { - return $this->container['origin']; - } - - /** - * Sets origin - * - * @param string $origin External application address including protocol and port when not 80 or 443 - * - * @return self - */ - public function setOrigin($origin) - { - if (is_null($origin)) { - throw new \InvalidArgumentException('non-nullable origin cannot be null'); - } - $this->container['origin'] = $origin; - - return $this; - } - /** * Gets username * diff --git a/src/Generated/Model/WebAuthnRegisterStartRsp.php b/src/Generated/Model/WebAuthnRegisterStartRsp.php index 6d254f2..fb07c24 100644 --- a/src/Generated/Model/WebAuthnRegisterStartRsp.php +++ b/src/Generated/Model/WebAuthnRegisterStartRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class WebAuthnRegisterStartRsp implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'status' => false, - 'public_key_credential_creation_options' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'status' => false, + 'public_key_credential_creation_options' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingCreate.php b/src/Generated/Model/WebauthnSettingCreate.php index c481198..f25519e 100644 --- a/src/Generated/Model/WebauthnSettingCreate.php +++ b/src/Generated/Model/WebauthnSettingCreate.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class WebauthnSettingCreate implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'name' => false, - 'origin' => false + 'origin' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingCreateReq.php b/src/Generated/Model/WebauthnSettingCreateReq.php index 65277a1..abc745a 100644 --- a/src/Generated/Model/WebauthnSettingCreateReq.php +++ b/src/Generated/Model/WebauthnSettingCreateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class WebauthnSettingCreateReq implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'name' => false, - 'origin' => false, - 'request_id' => false, - 'client_info' => false + 'origin' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingCreateRsp.php b/src/Generated/Model/WebauthnSettingCreateRsp.php index 25695c4..6dff874 100644 --- a/src/Generated/Model/WebauthnSettingCreateRsp.php +++ b/src/Generated/Model/WebauthnSettingCreateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class WebauthnSettingCreateRsp implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'name' => false, - 'origin' => false, - 'id' => false, - 'created' => false, - 'updated' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'name' => false, + 'origin' => false, + 'id' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingDeleteReq.php b/src/Generated/Model/WebauthnSettingDeleteReq.php index 0e95caf..ad4e8e8 100644 --- a/src/Generated/Model/WebauthnSettingDeleteReq.php +++ b/src/Generated/Model/WebauthnSettingDeleteReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class WebauthnSettingDeleteReq implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'request_id' => false, - 'client_info' => false + 'client_info' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingGetRsp.php b/src/Generated/Model/WebauthnSettingGetRsp.php index 8ec464d..02cc29e 100644 --- a/src/Generated/Model/WebauthnSettingGetRsp.php +++ b/src/Generated/Model/WebauthnSettingGetRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class WebauthnSettingGetRsp implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'name' => false, - 'origin' => false, - 'id' => false, - 'created' => false, - 'updated' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'name' => false, + 'origin' => false, + 'id' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingItem.php b/src/Generated/Model/WebauthnSettingItem.php index 54795bc..1a6976d 100644 --- a/src/Generated/Model/WebauthnSettingItem.php +++ b/src/Generated/Model/WebauthnSettingItem.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class WebauthnSettingItem implements ModelInterface, ArrayAccess, \JsonSerializa */ protected static array $openAPINullables = [ 'name' => false, - 'origin' => false, - 'id' => false, - 'created' => false, - 'updated' => false + 'origin' => false, + 'id' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingListRsp.php b/src/Generated/Model/WebauthnSettingListRsp.php index 82def0e..6e75805 100644 --- a/src/Generated/Model/WebauthnSettingListRsp.php +++ b/src/Generated/Model/WebauthnSettingListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -89,11 +89,11 @@ class WebauthnSettingListRsp implements ModelInterface, ArrayAccess, \JsonSerial */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'rows' => false, - 'paging' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'rows' => false, + 'paging' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingUpdateReq.php b/src/Generated/Model/WebauthnSettingUpdateReq.php index 85d451f..732d19f 100644 --- a/src/Generated/Model/WebauthnSettingUpdateReq.php +++ b/src/Generated/Model/WebauthnSettingUpdateReq.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -85,9 +85,9 @@ class WebauthnSettingUpdateReq implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'name' => false, - 'origin' => false, - 'request_id' => false, - 'client_info' => false + 'origin' => false, + 'request_id' => false, + 'client_info' => false ]; /** diff --git a/src/Generated/Model/WebauthnSettingUpdateRsp.php b/src/Generated/Model/WebauthnSettingUpdateRsp.php index de41c3b..d37e5ae 100644 --- a/src/Generated/Model/WebauthnSettingUpdateRsp.php +++ b/src/Generated/Model/WebauthnSettingUpdateRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -95,14 +95,14 @@ class WebauthnSettingUpdateRsp implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'name' => false, - 'origin' => false, - 'id' => false, - 'created' => false, - 'updated' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'name' => false, + 'origin' => false, + 'id' => false, + 'created' => false, + 'updated' => false ]; /** diff --git a/src/Generated/Model/WebhookLog.php b/src/Generated/Model/WebhookLog.php index 8cb58ae..646f1ea 100644 --- a/src/Generated/Model/WebhookLog.php +++ b/src/Generated/Model/WebhookLog.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -102,17 +102,17 @@ class WebhookLog implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'webhook_id' => false, - 'project_id' => false, - 'action' => false, - 'response_id' => false, - 'request_url' => false, - 'request_body' => false, - 'response_status' => false, - 'response_headers' => false, - 'response_body' => false, - 'response_error' => false, - 'runtime' => false, - 'created' => false + 'project_id' => false, + 'action' => false, + 'response_id' => false, + 'request_url' => false, + 'request_body' => false, + 'response_status' => false, + 'response_headers' => false, + 'response_body' => false, + 'response_error' => false, + 'runtime' => false, + 'created' => false ]; /** diff --git a/src/Generated/Model/WebhookLogsListRsp.php b/src/Generated/Model/WebhookLogsListRsp.php index db439fe..c9b4576 100644 --- a/src/Generated/Model/WebhookLogsListRsp.php +++ b/src/Generated/Model/WebhookLogsListRsp.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -87,10 +87,10 @@ class WebhookLogsListRsp implements ModelInterface, ArrayAccess, \JsonSerializab */ protected static array $openAPINullables = [ 'http_status_code' => false, - 'message' => false, - 'request_data' => false, - 'runtime' => false, - 'data' => false + 'message' => false, + 'request_data' => false, + 'runtime' => false, + 'data' => false ]; /** diff --git a/src/Generated/Model/WebhookLogsListRspAllOfData.php b/src/Generated/Model/WebhookLogsListRspAllOfData.php index f8ca650..64ee51c 100644 --- a/src/Generated/Model/WebhookLogsListRspAllOfData.php +++ b/src/Generated/Model/WebhookLogsListRspAllOfData.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** @@ -81,7 +81,7 @@ class WebhookLogsListRspAllOfData implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'logs' => false, - 'paging' => false + 'paging' => false ]; /** diff --git a/src/Generated/ObjectSerializer.php b/src/Generated/ObjectSerializer.php index a67c72c..1b3b30c 100644 --- a/src/Generated/ObjectSerializer.php +++ b/src/Generated/ObjectSerializer.php @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 1.0.0 * Contact: support@corbado.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.6.0 + * OpenAPI Generator version: 7.2.0-SNAPSHOT */ /** From 373c6c280ef5ba465ffed4b3a067909f994dbcb6 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 10:03:52 +0100 Subject: [PATCH 25/81] Minor changes --- scripts/generate-openapi.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/generate-openapi.sh b/scripts/generate-openapi.sh index 391fc84..bc2832c 100644 --- a/scripts/generate-openapi.sh +++ b/scripts/generate-openapi.sh @@ -10,7 +10,6 @@ cd .gen curl -s -O https://api.corbado.com/docs/api/openapi/backend_api_public.yml docker pull openapitools/openapi-generator-cli docker run -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/backend_api_public.yml -g php -o /local --additional-properties=invokerPackage=Corbado\\Generated - cp -r lib/* ../../src/Generated echo " done!" \ No newline at end of file From e4aa6763b7b8f6e2de41b00df82cae4320ab9c80 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 10:06:20 +0100 Subject: [PATCH 26/81] Generation cleanup --- scripts/generate-openapi.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/generate-openapi.sh b/scripts/generate-openapi.sh index bc2832c..f87badb 100644 --- a/scripts/generate-openapi.sh +++ b/scripts/generate-openapi.sh @@ -12,4 +12,7 @@ docker pull openapitools/openapi-generator-cli docker run -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/backend_api_public.yml -g php -o /local --additional-properties=invokerPackage=Corbado\\Generated cp -r lib/* ../../src/Generated +cd .. +rm -rf .gen + echo " done!" \ No newline at end of file From 4f101ef0d308cab10ac79086dc0430a66f9b0e35 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 10:20:29 +0100 Subject: [PATCH 27/81] Added email codes --- src/Classes/Apis/EmailCodes.php | 75 ++++++++++++++++++++++++ src/Classes/Apis/EmailCodesInterface.php | 8 +++ src/SDK.php | 20 +++++++ 3 files changed, 103 insertions(+) create mode 100644 src/Classes/Apis/EmailCodes.php create mode 100644 src/Classes/Apis/EmailCodesInterface.php diff --git a/src/Classes/Apis/EmailCodes.php b/src/Classes/Apis/EmailCodes.php new file mode 100644 index 0000000..a8d8170 --- /dev/null +++ b/src/Classes/Apis/EmailCodes.php @@ -0,0 +1,75 @@ +client = $client; + } + + /** + * @throws AssertException + * @throws ServerException + * @throws StandardException + */ + public function send(EmailCodeSendReq $req): EmailCodeSendRsp + { + Assert::notNull($req); + + try { + $rsp = $this->client->emailCodeSend($req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } + + /** + * @throws StandardException + * @throws AssertException + * @throws ServerException + */ + public function validate(string $id, EmailCodeValidateReq $req): EmailCodeValidateRsp + { + Assert::stringNotEmpty($id); + Assert::notNull($req); + + try { + $rsp = $this->client->emailCodeValidate($id, $req); + } catch (ApiException $e) { + throw Helper::convertToServerException($e); + } + + if ($rsp instanceof ErrorRsp) { + throw new StandardException('Got unexpected ErrorRsp'); + } + + return $rsp; + } +} diff --git a/src/Classes/Apis/EmailCodesInterface.php b/src/Classes/Apis/EmailCodesInterface.php new file mode 100644 index 0000000..db700f9 --- /dev/null +++ b/src/Classes/Apis/EmailCodesInterface.php @@ -0,0 +1,8 @@ +authTokens; } + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function emailCodes(): EmailCodesInterface + { + if ($this->emailCodes === null) { + $this->emailCodes = new EmailCodes( + // @phpstan-ignore-next-line + new EmailOTPApi($this->client, $this->createGeneratedConfiguration()) + ); + } + + return $this->emailCodes; + } + /** * @return Generated\Configuration * @throws Classes\Exceptions\ConfigurationException From c08f9042aa4e928d0fd63e17498fce47cd4b34f7 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:55:11 +0100 Subject: [PATCH 28/81] Added integration tests for email link, email code and SMS code --- src/Classes/Apis/EmailCodesInterface.php | 8 ++- src/Classes/Exceptions/ServerException.php | 13 +++-- .../EmailCode/EmailCodeSendTest.php | 48 ++++++++++++++++ .../EmailCode/EmailCodeValidateTest.php | 56 +++++++++++++++++++ .../EmailLink/EmailLinkSendTest.php | 50 +++++++++++++++++ .../EmailLink/EmailLinkValidateTest.php | 55 ++++++++++++++++++ tests/integration/SMSCode/SMSCodeSendTest.php | 49 ++++++++++++++++ .../SMSCode/SMSCodeValidateTest.php | 56 +++++++++++++++++++ tests/integration/User/UserCreateTest.php | 2 +- tests/integration/User/UserDeleteTest.php | 2 +- tests/integration/User/UserListTest.php | 2 +- tests/integration/Utils.php | 18 ++++++ .../Validation/ValidateEmailTest.php | 2 +- .../Validation/ValidatePhoneNumberTest.php | 4 +- 14 files changed, 353 insertions(+), 12 deletions(-) create mode 100644 tests/integration/EmailCode/EmailCodeSendTest.php create mode 100644 tests/integration/EmailCode/EmailCodeValidateTest.php create mode 100644 tests/integration/EmailLink/EmailLinkSendTest.php create mode 100644 tests/integration/EmailLink/EmailLinkValidateTest.php create mode 100644 tests/integration/SMSCode/SMSCodeSendTest.php create mode 100644 tests/integration/SMSCode/SMSCodeValidateTest.php diff --git a/src/Classes/Apis/EmailCodesInterface.php b/src/Classes/Apis/EmailCodesInterface.php index db700f9..ac4919e 100644 --- a/src/Classes/Apis/EmailCodesInterface.php +++ b/src/Classes/Apis/EmailCodesInterface.php @@ -2,7 +2,13 @@ namespace Corbado\Classes\Apis; +use Corbado\Generated\Model\EmailCodeSendReq; +use Corbado\Generated\Model\EmailCodeSendRsp; +use Corbado\Generated\Model\EmailCodeValidateReq; +use Corbado\Generated\Model\EmailCodeValidateRsp; + interface EmailCodesInterface { - + public function send(EmailCodeSendReq $req): EmailCodeSendRsp; + public function validate(string $id, EmailCodeValidateReq $req): EmailCodeValidateRsp; } \ No newline at end of file diff --git a/src/Classes/Exceptions/ServerException.php b/src/Classes/Exceptions/ServerException.php index 74b25e3..3b0dec3 100644 --- a/src/Classes/Exceptions/ServerException.php +++ b/src/Classes/Exceptions/ServerException.php @@ -28,7 +28,7 @@ public function __construct(int $httpStatusCode, string $message, array $request $this->runtime = $runtime; $this->error = $error; - $message = $message . ' (HTTP status code: ' . $httpStatusCode . ', validation message: ' . $this->getValidationMessage() . ')'; + $message = $message . ' (HTTP status code: ' . $httpStatusCode . ', validation message: ' . implode('; ', $this->getValidationMessages()) . ')'; parent::__construct($message, $httpStatusCode); } @@ -59,14 +59,17 @@ public function getError(): array return $this->error; } - public function getValidationMessage(): string + /** + * @return array + */ + public function getValidationMessages(): array { if (empty($this->error)) { - return ''; + return []; } if (empty($this->error['validation'])) { - return ''; + return []; } $messages = []; @@ -74,6 +77,6 @@ public function getValidationMessage(): string $messages[] = $item['field'] . ': ' . $item['message']; } - return implode('; ', $messages); + return $messages; } } diff --git a/tests/integration/EmailCode/EmailCodeSendTest.php b/tests/integration/EmailCode/EmailCodeSendTest.php new file mode 100644 index 0000000..45f4fbc --- /dev/null +++ b/tests/integration/EmailCode/EmailCodeSendTest.php @@ -0,0 +1,48 @@ +setEmail(''); + + Utils::SDK()->emailCodes()->send($req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEqualsCanonicalizing(['email: cannot be blank'], $exception->getValidationMessages()); + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testEmailCodeSendSuccess(): void + { + $req = new EmailCodeSendReq(); + $req->setEmail(Utils::createRandomTestEmail()); + $req->setCreate(true); + + $rsp = Utils::SDK()->emailCodes()->send($req); + $this->assertEquals(200, $rsp->getHttpStatusCode()); + } +} diff --git a/tests/integration/EmailCode/EmailCodeValidateTest.php b/tests/integration/EmailCode/EmailCodeValidateTest.php new file mode 100644 index 0000000..a595ae7 --- /dev/null +++ b/tests/integration/EmailCode/EmailCodeValidateTest.php @@ -0,0 +1,56 @@ +setCode(''); + + Utils::SDK()->emailCodes()->validate('emc-123456789', $req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEquals(['code: cannot be blank'], $exception->getValidationMessages()); + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testEmailCodeValidateValidationErrorInvalidID(): void + { + $exception = null; + + try { + $req = new EmailCodeValidateReq(); + $req->setCode('123456'); + + Utils::SDK()->emailCodes()->validate('emc-123456789', $req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEquals(404, $exception->getHttpStatusCode()); + } +} diff --git a/tests/integration/EmailLink/EmailLinkSendTest.php b/tests/integration/EmailLink/EmailLinkSendTest.php new file mode 100644 index 0000000..6f938a9 --- /dev/null +++ b/tests/integration/EmailLink/EmailLinkSendTest.php @@ -0,0 +1,50 @@ +setEmail(''); + $req->setRedirect(''); + + Utils::SDK()->emailLinks()->send($req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEqualsCanonicalizing(['email: cannot be blank', 'redirect: cannot be blank'], $exception->getValidationMessages()); + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testEmailLinkSendSuccess(): void + { + $req = new EmailLinkSendReq(); + $req->setEmail(Utils::createRandomTestEmail()); + $req->setRedirect('https://example.com'); + $req->setCreate(true); + + $rsp = Utils::SDK()->emailLinks()->send($req); + $this->assertEquals(200, $rsp->getHttpStatusCode()); + } +} diff --git a/tests/integration/EmailLink/EmailLinkValidateTest.php b/tests/integration/EmailLink/EmailLinkValidateTest.php new file mode 100644 index 0000000..ccff575 --- /dev/null +++ b/tests/integration/EmailLink/EmailLinkValidateTest.php @@ -0,0 +1,55 @@ +setToken(''); + + Utils::SDK()->emailLinks()->validate('eml-123456789', $req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEquals(['token: cannot be blank'], $exception->getValidationMessages()); + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testEmailLinkValidateValidationErrorInvalidID(): void + { + $exception = null; + + try { + $req = new EmailLinksValidateReq(); + $req->setToken('fdfdsfdss1fdfdsfdss1'); + + Utils::SDK()->emailLinks()->validate('eml-123456789', $req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEquals(404, $exception->getHttpStatusCode()); + } +} diff --git a/tests/integration/SMSCode/SMSCodeSendTest.php b/tests/integration/SMSCode/SMSCodeSendTest.php new file mode 100644 index 0000000..8fc668e --- /dev/null +++ b/tests/integration/SMSCode/SMSCodeSendTest.php @@ -0,0 +1,49 @@ +setPhoneNumber(''); + + Utils::SDK()->smsCodes()->send($req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEqualsCanonicalizing(['phoneNumber: cannot be blank'], $exception->getValidationMessages()); + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testSMSCodeSendSuccess(): void + { + $req = new SMSCodeSendReq(); + $req->setPhoneNumber(Utils::createRandomTestPhoneNumber()); + $req->setCreate(true); + + $rsp = Utils::SDK()->smsCodes()->send($req); + $this->assertEquals(200, $rsp->getHttpStatusCode()); + } +} diff --git a/tests/integration/SMSCode/SMSCodeValidateTest.php b/tests/integration/SMSCode/SMSCodeValidateTest.php new file mode 100644 index 0000000..b48ac6e --- /dev/null +++ b/tests/integration/SMSCode/SMSCodeValidateTest.php @@ -0,0 +1,56 @@ +setCode(''); + + Utils::SDK()->emailCodes()->validate('emc-123456789', $req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEquals(['code: cannot be blank'], $exception->getValidationMessages()); + } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testEmailCodeValidateValidationErrorInvalidID(): void + { + $exception = null; + + try { + $req = new EmailCodeValidateReq(); + $req->setCode('123456'); + + Utils::SDK()->emailCodes()->validate('emc-123456789', $req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEquals(404, $exception->getHttpStatusCode()); + } +} diff --git a/tests/integration/User/UserCreateTest.php b/tests/integration/User/UserCreateTest.php index ef14e30..0cc6e89 100644 --- a/tests/integration/User/UserCreateTest.php +++ b/tests/integration/User/UserCreateTest.php @@ -31,7 +31,7 @@ public function testUserCreateValidationError(): void $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals('name: cannot be blank', $exception->getValidationMessage()); + $this->assertEquals(['name: cannot be blank'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/User/UserDeleteTest.php b/tests/integration/User/UserDeleteTest.php index d5cc836..7caf706 100644 --- a/tests/integration/User/UserDeleteTest.php +++ b/tests/integration/User/UserDeleteTest.php @@ -27,7 +27,7 @@ public function testUserDeleteNotFound(): void $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals('userID: does not exist', $exception->getValidationMessage()); + $this->assertEquals(['userID: does not exist'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/User/UserListTest.php b/tests/integration/User/UserListTest.php index be77d26..d3c3d09 100644 --- a/tests/integration/User/UserListTest.php +++ b/tests/integration/User/UserListTest.php @@ -27,7 +27,7 @@ public function testUserListValidationError(): void $this->assertNotNull($exception); $this->assertEquals(422, $exception->getHttpStatusCode()); - $this->assertEquals('sort: Invalid order direction \'bar\'', $exception->getValidationMessage()); + $this->assertEquals(['sort: Invalid order direction \'bar\''], $exception->getValidationMessages()); } /** diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index 809ebda..e5e5c6c 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -52,6 +52,19 @@ private static function generateString(int $length): string return $string; } + private static function generateNumber(int $length): string + { + $characters = '0123456789'; + $charactersLength = strlen($characters); + + $string = ''; + for ($i = 0; $i < $length; $i++) { + $string .= $characters[rand(0, $charactersLength - 1)]; + } + + return $string; + } + public static function createRandomTestName(): string { return self::generateString(10); @@ -62,6 +75,11 @@ public static function createRandomTestEmail(): string return self::generateString(10) . '@test.de'; } + public static function createRandomTestPhoneNumber(): string + { + return '+49' . self::generateNumber(13); + } + /** * @throws AssertException * @throws ConfigurationException diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php index 25a2da2..81e42da 100644 --- a/tests/integration/Validation/ValidateEmailTest.php +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -30,7 +30,7 @@ public function testValidateEmailValidationError(): void $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals('email: cannot be blank', $exception->getValidationMessage()); + $this->assertEquals(['email: cannot be blank'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/Validation/ValidatePhoneNumberTest.php b/tests/integration/Validation/ValidatePhoneNumberTest.php index 60ed0ef..545fa86 100644 --- a/tests/integration/Validation/ValidatePhoneNumberTest.php +++ b/tests/integration/Validation/ValidatePhoneNumberTest.php @@ -28,9 +28,9 @@ public function testValidatePhoneNumberValidationError(): void $exception = $e; } - $this->assertNotNull($e); + $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals('phoneNumber: cannot be blank', $exception->getValidationMessage()); + $this->assertEquals(['phoneNumber: cannot be blank'], $exception->getValidationMessages()); } /** From c32a0b0de0c714c24948546c10e0e16694f181e4 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:59:08 +0100 Subject: [PATCH 29/81] CS fixes --- src/Classes/Apis/EmailCodesInterface.php | 2 +- tests/integration/User/UserCreateTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Classes/Apis/EmailCodesInterface.php b/src/Classes/Apis/EmailCodesInterface.php index ac4919e..8c314c8 100644 --- a/src/Classes/Apis/EmailCodesInterface.php +++ b/src/Classes/Apis/EmailCodesInterface.php @@ -11,4 +11,4 @@ interface EmailCodesInterface { public function send(EmailCodeSendReq $req): EmailCodeSendRsp; public function validate(string $id, EmailCodeValidateReq $req): EmailCodeValidateRsp; -} \ No newline at end of file +} diff --git a/tests/integration/User/UserCreateTest.php b/tests/integration/User/UserCreateTest.php index 0cc6e89..1e7a905 100644 --- a/tests/integration/User/UserCreateTest.php +++ b/tests/integration/User/UserCreateTest.php @@ -47,4 +47,4 @@ public function testUserCreateSuccess(): void $rsp = Utils::SDK()->users()->create($req); $this->assertEquals(200, $rsp->getHttpStatusCode()); } -} \ No newline at end of file +} From ef5355daab09ffaba7735387a7ad937c6af08b2b Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 12:32:40 +0100 Subject: [PATCH 30/81] Minor bug fixes, added integration test for auth tokens --- .../AuthToken/AuthTokenValidateTest.php | 37 +++++++++++++++++++ .../EmailCode/EmailCodeValidateTest.php | 2 +- .../EmailLink/EmailLinkValidateTest.php | 2 +- .../SMSCode/SMSCodeValidateTest.php | 2 +- tests/integration/User/UserCreateTest.php | 2 +- tests/integration/User/UserDeleteTest.php | 2 +- tests/integration/User/UserListTest.php | 2 +- tests/integration/Utils.php | 11 ++++++ .../Validation/ValidateEmailTest.php | 2 +- .../Validation/ValidatePhoneNumberTest.php | 2 +- 10 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 tests/integration/AuthToken/AuthTokenValidateTest.php diff --git a/tests/integration/AuthToken/AuthTokenValidateTest.php b/tests/integration/AuthToken/AuthTokenValidateTest.php new file mode 100644 index 0000000..780eb46 --- /dev/null +++ b/tests/integration/AuthToken/AuthTokenValidateTest.php @@ -0,0 +1,37 @@ +setToken(''); + $req->setClientInfo(Utils::createClientInfo()); + + Utils::SDK()->authTokens()->validate($req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEqualsCanonicalizing(['token: cannot be blank'], $exception->getValidationMessages()); + } +} diff --git a/tests/integration/EmailCode/EmailCodeValidateTest.php b/tests/integration/EmailCode/EmailCodeValidateTest.php index a595ae7..a61080a 100644 --- a/tests/integration/EmailCode/EmailCodeValidateTest.php +++ b/tests/integration/EmailCode/EmailCodeValidateTest.php @@ -30,7 +30,7 @@ public function testEmailCodeValidateValidationErrorEmptyCode(): void } $this->assertNotNull($exception); - $this->assertEquals(['code: cannot be blank'], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['code: cannot be blank'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/EmailLink/EmailLinkValidateTest.php b/tests/integration/EmailLink/EmailLinkValidateTest.php index ccff575..e87eceb 100644 --- a/tests/integration/EmailLink/EmailLinkValidateTest.php +++ b/tests/integration/EmailLink/EmailLinkValidateTest.php @@ -29,7 +29,7 @@ public function testEmailLinkValidateValidationErrorEmptyToken(): void } $this->assertNotNull($exception); - $this->assertEquals(['token: cannot be blank'], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['token: cannot be blank'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/SMSCode/SMSCodeValidateTest.php b/tests/integration/SMSCode/SMSCodeValidateTest.php index b48ac6e..bb5f88a 100644 --- a/tests/integration/SMSCode/SMSCodeValidateTest.php +++ b/tests/integration/SMSCode/SMSCodeValidateTest.php @@ -30,7 +30,7 @@ public function testEmailCodeValidateValidationErrorEmptyCode(): void } $this->assertNotNull($exception); - $this->assertEquals(['code: cannot be blank'], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['code: cannot be blank'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/User/UserCreateTest.php b/tests/integration/User/UserCreateTest.php index 1e7a905..9706d10 100644 --- a/tests/integration/User/UserCreateTest.php +++ b/tests/integration/User/UserCreateTest.php @@ -31,7 +31,7 @@ public function testUserCreateValidationError(): void $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals(['name: cannot be blank'], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['name: cannot be blank'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/User/UserDeleteTest.php b/tests/integration/User/UserDeleteTest.php index 7caf706..830f7bf 100644 --- a/tests/integration/User/UserDeleteTest.php +++ b/tests/integration/User/UserDeleteTest.php @@ -27,7 +27,7 @@ public function testUserDeleteNotFound(): void $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals(['userID: does not exist'], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['userID: does not exist'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/User/UserListTest.php b/tests/integration/User/UserListTest.php index d3c3d09..ef7b78e 100644 --- a/tests/integration/User/UserListTest.php +++ b/tests/integration/User/UserListTest.php @@ -27,7 +27,7 @@ public function testUserListValidationError(): void $this->assertNotNull($exception); $this->assertEquals(422, $exception->getHttpStatusCode()); - $this->assertEquals(['sort: Invalid order direction \'bar\''], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['sort: Invalid order direction \'bar\''], $exception->getValidationMessages()); } /** diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index e5e5c6c..404e9f4 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -6,6 +6,7 @@ use Corbado\Classes\Exceptions\ConfigurationException; use Corbado\Classes\Exceptions\ServerException; use Corbado\Configuration; +use Corbado\Generated\Model\ClientInfo; use Corbado\Generated\Model\UserCreateReq; use Corbado\SDK; use Exception; @@ -94,4 +95,14 @@ public static function createUser(): string return $rsp->getData()->getUserId(); } + + public static function createClientInfo(): ClientInfo + { + $clientInfo = new ClientInfo(); + $clientInfo->setUserAgent('Integration Test'); + $clientInfo->setRemoteAddress('127.0.0.1'); + + return $clientInfo; + } + } diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php index 81e42da..98440d5 100644 --- a/tests/integration/Validation/ValidateEmailTest.php +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -30,7 +30,7 @@ public function testValidateEmailValidationError(): void $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals(['email: cannot be blank'], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['email: cannot be blank'], $exception->getValidationMessages()); } /** diff --git a/tests/integration/Validation/ValidatePhoneNumberTest.php b/tests/integration/Validation/ValidatePhoneNumberTest.php index 545fa86..4b38b30 100644 --- a/tests/integration/Validation/ValidatePhoneNumberTest.php +++ b/tests/integration/Validation/ValidatePhoneNumberTest.php @@ -30,7 +30,7 @@ public function testValidatePhoneNumberValidationError(): void $this->assertNotNull($exception); $this->assertEquals(400, $exception->getHttpStatusCode()); - $this->assertEquals(['phoneNumber: cannot be blank'], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['phoneNumber: cannot be blank'], $exception->getValidationMessages()); } /** From e03c8ea992b17739ebb9d4f3965cf44b90c86bd6 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 17 Dec 2023 15:14:15 +0100 Subject: [PATCH 31/81] Code cleanup --- tests/integration/AuthToken/AuthTokenValidateTest.php | 3 ++- tests/integration/Utils.php | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/integration/AuthToken/AuthTokenValidateTest.php b/tests/integration/AuthToken/AuthTokenValidateTest.php index 780eb46..dbabd6e 100644 --- a/tests/integration/AuthToken/AuthTokenValidateTest.php +++ b/tests/integration/AuthToken/AuthTokenValidateTest.php @@ -8,6 +8,7 @@ use Corbado\Generated\Model\AuthTokenValidateReq; use Corbado\Generated\Model\EmailCodeValidateReq; use Corbado\Generated\Model\EmailLinksValidateReq; +use Corbado\SDK; use integration\Utils; use PHPUnit\Framework\TestCase; @@ -24,7 +25,7 @@ public function testAuthTokenValidateValidationErrorEmptyToken(): void try { $req = new AuthTokenValidateReq(); $req->setToken(''); - $req->setClientInfo(Utils::createClientInfo()); + $req->setClientInfo(SDK::createClientInfo('124.0.0.1', 'IntegrationTest')); Utils::SDK()->authTokens()->validate($req); } catch (ServerException $e) { diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index 404e9f4..ce6e525 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -95,14 +95,4 @@ public static function createUser(): string return $rsp->getData()->getUserId(); } - - public static function createClientInfo(): ClientInfo - { - $clientInfo = new ClientInfo(); - $clientInfo->setUserAgent('Integration Test'); - $clientInfo->setRemoteAddress('127.0.0.1'); - - return $clientInfo; - } - } From a894ce6cfa9e7e59056c169f77419631ecf0788d Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:17:58 +0100 Subject: [PATCH 32/81] Pimp my README --- README.md | 61 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 0a92851..af604d7 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,20 @@ # Corbado PHP SDK -PHP SDK for Corbado Backend API - [![Test Status](https://github.com/corbado/corbado-php/workflows/build/badge.svg)](https://github.com/corbado/corbado-php/actions?query=workflow%3Abuild) [![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://api.corbado.com/docs/api/) [![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/corbado-php) [![Latest Stable Version](http://poser.pugx.org/corbado/php-sdk/v)](https://packagist.org/packages/corbado/php-sdk) +The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. + +# Getting started + ## Requirements -The SDK supports PHP Version 7.2 and above. +- PHP 7.2 or later +- [Composer](https://getcomposer.org/) -## Usage +## Installation Use the following command to install the Corbado PHP SDK: @@ -19,44 +22,40 @@ Use the following command to install the Corbado PHP SDK: composer require corbado/php-sdk ``` -Now create a new SDK client: +## Usage + +To create a Corbado PHP SDK instance you need to provide your `project ID` and `API secret` which can be found at the [Developer Panel](https://app.corbado.com). ```PHP $config = new Corbado\Configuration("", ""); $corbado = new Corbado\SDK($config); ``` -## Services +# Advanced -The Corbado SDK provides a range of services including: +## Error handling -- `AuthTokens` -- `EmailLinks` -- `Sessions` -- `SMSCodes` -- `Validation` -- `Users` +The Corbado PHP SDK throws exceptions for all errors. The following exceptions are thrown: -To use a specific service, such as Session, invoke it as shown below: +- `Corbado\ApiException` for any API errors +- TODO -```PHP -$corbado->sessions()->getCurrentUser(); -``` +# Support & Feedback -## Corbado session management +## Raise an issue -Corbado offers an efficient and secure session management system (refer to -the [documentation](https://docs.corbado.com/sessions/overview) for more details). +If you encounter any bugs or have suggestions, please [open an issue](https://github.com/corbado/corbado-php/issues/new). -To validate a user after authentication, call `getCurrentUser()` which returns a user object with -all information about the current user. This object contains the current authentication state as well as user's id, -name, email and phone number. +## Slack channel -```PHP -$user = $corbado->sessions()->getCurrentUser(); -if ($user->isAuthenticated()) { - // Do anything with authenticated user -} else { - // Perform login ceremony -} -``` +Join our Slack channel to discuss questions or ideas with the Corbado team and other developers. + +[![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://corbado.slack.com) + +## Email + +You can also reach out to us via email at vincent.delitz@corbado.com. + +## Vulnerability Reporting + +Please report suspected security vulnerabilities in private to security@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities. \ No newline at end of file From bc81386422f81caf9e38d0867c8d0a18162adba3 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:25:19 +0100 Subject: [PATCH 33/81] Pimp my README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af604d7..28de435 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Corbado PHP SDK -[![Test Status](https://github.com/corbado/corbado-php/workflows/build/badge.svg)](https://github.com/corbado/corbado-php/actions?query=workflow%3Abuild) +[![Test Status](https://github.com/corbado/corbado-php/actions/workflows/build.yml/badge.svg)](https://github.com/corbado/corbado-php/actions) [![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://api.corbado.com/docs/api/) [![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/corbado-php) [![Latest Stable Version](http://poser.pugx.org/corbado/php-sdk/v)](https://packagist.org/packages/corbado/php-sdk) @@ -56,6 +56,6 @@ Join our Slack channel to discuss questions or ideas with the Corbado team and o You can also reach out to us via email at vincent.delitz@corbado.com. -## Vulnerability Reporting +## Vulnerability reporting Please report suspected security vulnerabilities in private to security@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities. \ No newline at end of file From 07d5d36f8fe0a47bfa67a914599ff08761d3840c Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:27:36 +0100 Subject: [PATCH 34/81] Pimp my README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 28de435..83dfa7e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # Corbado PHP SDK -[![Test Status](https://github.com/corbado/corbado-php/actions/workflows/build.yml/badge.svg)](https://github.com/corbado/corbado-php/actions) -[![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://api.corbado.com/docs/api/) [![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/corbado-php) [![Latest Stable Version](http://poser.pugx.org/corbado/php-sdk/v)](https://packagist.org/packages/corbado/php-sdk) +[![Test Status](https://github.com/corbado/corbado-php/actions/workflows/build.yml/badge.svg)](https://github.com/corbado/corbado-php/actions) +[![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://api.corbado.com/docs/api/) +[![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://corbado.slack.com) The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. From 47c7a42c01a1ce84627428863b5f60f69732d2d8 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:49:59 +0100 Subject: [PATCH 35/81] Pimp my README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 83dfa7e..14d8e93 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ [![Latest Stable Version](http://poser.pugx.org/corbado/php-sdk/v)](https://packagist.org/packages/corbado/php-sdk) [![Test Status](https://github.com/corbado/corbado-php/actions/workflows/build.yml/badge.svg)](https://github.com/corbado/corbado-php/actions) [![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://api.corbado.com/docs/api/) -[![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://corbado.slack.com) +[![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://join.slack.com/t/corbado/shared_invite/zt-1b7867yz8-V~Xr~ngmSGbt7IA~g16ZsQ) The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. -# Getting started +# :rocket: Getting started ## Requirements @@ -51,7 +51,7 @@ If you encounter any bugs or have suggestions, please [open an issue](https://gi Join our Slack channel to discuss questions or ideas with the Corbado team and other developers. -[![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://corbado.slack.com) +[![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://join.slack.com/t/corbado/shared_invite/zt-1b7867yz8-V~Xr~ngmSGbt7IA~g16ZsQ) ## Email From 178c514ee3d2e2616b65480fa36eb8365019eff0 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:50:49 +0100 Subject: [PATCH 36/81] Pimp my README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 14d8e93..5bac66f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ $config = new Corbado\Configuration("", ""); $corbado = new Corbado\SDK($config); ``` -# Advanced +# :books: Advanced ## Error handling @@ -41,7 +41,7 @@ The Corbado PHP SDK throws exceptions for all errors. The following exceptions a - `Corbado\ApiException` for any API errors - TODO -# Support & Feedback +# :speech_balloon: Support & Feedback ## Raise an issue From 739f43af74238ca191d12d76abf2872bb3350599 Mon Sep 17 00:00:00 2001 From: Vincent Delitz Date: Tue, 19 Dec 2023 21:52:40 +0100 Subject: [PATCH 37/81] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bac66f..1936c8c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +GitHub Repo Cover + + # Corbado PHP SDK [![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/corbado-php) @@ -59,4 +62,4 @@ You can also reach out to us via email at vincent.delitz@corbado.com. ## Vulnerability reporting -Please report suspected security vulnerabilities in private to security@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities. \ No newline at end of file +Please report suspected security vulnerabilities in private to security@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities. From 762ccab96ba58dabd07c0a2af80f87ee99a6a257 Mon Sep 17 00:00:00 2001 From: Vincent Delitz Date: Tue, 19 Dec 2023 21:54:21 +0100 Subject: [PATCH 38/81] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1936c8c..ee8ed40 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -GitHub Repo Cover +GitHub Repo Cover + # Corbado PHP SDK From 393ee97c05e223bf123b10be5b0731d70e067e9c Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:58:52 +0100 Subject: [PATCH 39/81] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index ee8ed40..b6c2011 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ GitHub Repo Cover - - # Corbado PHP SDK [![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/corbado-php) From c15760530f82c8a291ee5a44a5853970f4ae17ae Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 06:12:53 +0100 Subject: [PATCH 40/81] More fixes --- README.md | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b6c2011..8b232c7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Corbado PHP SDK -[![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/corbado-php) +[![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/php-sdk) [![Latest Stable Version](http://poser.pugx.org/corbado/php-sdk/v)](https://packagist.org/packages/corbado/php-sdk) [![Test Status](https://github.com/corbado/corbado-php/actions/workflows/build.yml/badge.svg)](https://github.com/corbado/corbado-php/actions) [![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://api.corbado.com/docs/api/) diff --git a/composer.json b/composer.json index cfa2fe2..09a8f54 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "corbado/php-sdk", - "description": "This PHP SDK eases the integration of Corbado's passkey-first authentication solution.", + "description": "Add passkeys to your PHP application with the Corbado PHP SDK.", "homepage": "https://www.corbado.com", "authors": [ { From bfbd90db01cacdc59acdb170cb1000caccb205cb Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 06:18:18 +0100 Subject: [PATCH 41/81] More fixes --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b232c7..09d8713 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,13 @@ To create a Corbado PHP SDK instance you need to provide your `project ID` and ` ```PHP $config = new Corbado\Configuration("", ""); -$corbado = new Corbado\SDK($config); +$sdk = new Corbado\SDK($config); ``` +## Examples + +A list of Corbado PHP SDK examples can be found in the integration tests [here](tests/integration). + # :books: Advanced ## Error handling From 6ef2c369d131fbd85f719cedacb317cb765c14f1 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 06:19:08 +0100 Subject: [PATCH 42/81] More fixes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09d8713..d73eaed 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ $sdk = new Corbado\SDK($config); ## Examples -A list of Corbado PHP SDK examples can be found in the integration tests [here](tests/integration). +A list of examples can be found in the integration tests [here](tests/integration). # :books: Advanced From ccac94a732fff80a449d623cfdae7c0a66b726ae Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 06:42:35 +0100 Subject: [PATCH 43/81] Added error handling to README.md, added more helper methods to ServerException --- README.md | 33 ++++++++++++++++++++-- src/Classes/Exceptions/ServerException.php | 5 ++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d73eaed..21b6cab 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,37 @@ A list of examples can be found in the integration tests [here](tests/integratio The Corbado PHP SDK throws exceptions for all errors. The following exceptions are thrown: -- `Corbado\ApiException` for any API errors -- TODO +- `AssertException` for failed assertions (client side) +- `ConfigurationException` for configuration errors (client side) +- `ServerException` for server errors (server side) +- `StandardException` for everything else (client side) + +If the Backend API returns a HTTP status code other than 200, the Corbado PHP SDK throws a `ServerException`. The `ServerException`class provides convenient methods to access all important data: + +```PHP +try { + // Try to get non-existing user with ID 'usr-123456789' + $user = $sdk->users()->get('usr-123456789'); +} catch (ServerException $e) { + // Show HTTP status code (404 in this case) + echo $e->getHttpStatusCode() . PHP_EOL; + + // Show request ID (can be used in developer panel to look up the full request and response, see https://app.corbado.com/app/logs/requests) + echo $e->getRequestID() . PHP_EOL; + + // Show full request data + var_dump($e->getRequestData()); + + // Show runtime of request in seconds (server side) + echo $e->getRuntime() . PHP_EOL; + + // Show validation error messages (server side validation in case of HTTP status code 400 (Bad Request)) + var_dump($e->getValidationMessages()); + + // Show full error data + var_dump($e->getError()); +} +``` # :speech_balloon: Support & Feedback diff --git a/src/Classes/Exceptions/ServerException.php b/src/Classes/Exceptions/ServerException.php index 3b0dec3..e8236db 100644 --- a/src/Classes/Exceptions/ServerException.php +++ b/src/Classes/Exceptions/ServerException.php @@ -46,6 +46,11 @@ public function getRequestData(): array return $this->requestData; } + public function getRequestID(): string + { + return $this->requestData['requestID'] ?? ''; + } + public function getRuntime(): float { return $this->runtime; From d1cd926b03533ba46a2e28ae02ec5626bce003e8 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 06:44:24 +0100 Subject: [PATCH 44/81] Line length --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 21b6cab..dcdb68c 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ try { // Show HTTP status code (404 in this case) echo $e->getHttpStatusCode() . PHP_EOL; - // Show request ID (can be used in developer panel to look up the full request and response, see https://app.corbado.com/app/logs/requests) + // Show request ID (can be used in developer panel to look up the full request + // and response, see https://app.corbado.com/app/logs/requests) echo $e->getRequestID() . PHP_EOL; // Show full request data @@ -68,7 +69,8 @@ try { // Show runtime of request in seconds (server side) echo $e->getRuntime() . PHP_EOL; - // Show validation error messages (server side validation in case of HTTP status code 400 (Bad Request)) + // Show validation error messages (server side validation in case of HTTP + // status code 400 (Bad Request)) var_dump($e->getValidationMessages()); // Show full error data From 0ca6b9c52ee04bda2e65cf81d35a6d606943b054 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 07:23:46 +0100 Subject: [PATCH 45/81] Cleanup --- tests/integration/User/UserGetTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/User/UserGetTest.php b/tests/integration/User/UserGetTest.php index 7458a30..7b9d350 100644 --- a/tests/integration/User/UserGetTest.php +++ b/tests/integration/User/UserGetTest.php @@ -5,7 +5,6 @@ use Corbado\Classes\Exceptions\AssertException; use Corbado\Classes\Exceptions\ConfigurationException; use Corbado\Classes\Exceptions\ServerException; -use Corbado\Generated\Model\UserDeleteReq; use integration\Utils; use PHPUnit\Framework\TestCase; From 6f3d2feec403e9376c5851ce600c0971e74e2ac1 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:11:07 +0100 Subject: [PATCH 46/81] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dcdb68c..5dd597c 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ try { # :speech_balloon: Support & Feedback -## Raise an issue +## Report an issue If you encounter any bugs or have suggestions, please [open an issue](https://github.com/corbado/corbado-php/issues/new). From b7138d9e89fbe9bd70a5235132e68b1ca946dd4a Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:13:40 +0100 Subject: [PATCH 47/81] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5dd597c..a34dcc8 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ $sdk = new Corbado\SDK($config); A list of examples can be found in the integration tests [here](tests/integration). +# :speedboat: Services + +TODO + # :books: Advanced ## Error handling From 6e5e62bb6f37beb9ea6b18cf9f2137c3dbc66bd9 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:22:36 +0100 Subject: [PATCH 48/81] More README optimizations --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a34dcc8..a9234df 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. +[Getting started](#rocket-getting-started) | [Services](#speedboat-services) | [Advanced](#books-advanced) | [Support & Feedback](#speech_balloon-support--feedback) + # :rocket: Getting started ## Requirements From 80198bfac58f169e1915a600e3db466cb5068f0c Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:24:30 +0100 Subject: [PATCH 49/81] More README optimizations --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a9234df..f8f1dae 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. -[Getting started](#rocket-getting-started) | [Services](#speedboat-services) | [Advanced](#books-advanced) | [Support & Feedback](#speech_balloon-support--feedback) +:rocket: [Getting started](#rocket-getting-started) | :speedboat: [Services](#speedboat-services) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support & Feedback](#speech_balloon-support--feedback) # :rocket: Getting started From 8783daa25c6fc4fb1ebfbc85b1981d5aa7041987 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:28:40 +0100 Subject: [PATCH 50/81] More README optimizations --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f8f1dae..7ff4857 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,11 @@ A list of examples can be found in the integration tests [here](tests/integratio # :speedboat: Services -TODO +The Corbado PHP SDK provides the following services: + +- `EmailLinks` for managing email links +- `EmailOTPs` for managing email OTPs +- `SMSOTPs` for managing SMS OTPs # :books: Advanced From 7334671333c83f9906fa22a16d81d41e4dcc8b10 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:31:46 +0100 Subject: [PATCH 51/81] More README optimizations --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ff4857..0bdbca0 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,13 @@ A list of examples can be found in the integration tests [here](tests/integratio The Corbado PHP SDK provides the following services: -- `EmailLinks` for managing email links +- `EmailLinks` for managing email links ([example](tests/integration/EmailLink)) - `EmailOTPs` for managing email OTPs - `SMSOTPs` for managing SMS OTPs +- `Sessions` for managing sessions +- `Users` for managing users +- `AuthTokens` for managing authentication tokens needed for own session management +- `Validations` for validating email addresses and phone numbers # :books: Advanced From 094fb1dc757068ed16823576bf35bea99ee32e66 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:33:13 +0100 Subject: [PATCH 52/81] More README optimizations --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0bdbca0..61f02e4 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,13 @@ A list of examples can be found in the integration tests [here](tests/integratio The Corbado PHP SDK provides the following services: -- `EmailLinks` for managing email links ([example](tests/integration/EmailLink)) -- `EmailOTPs` for managing email OTPs -- `SMSOTPs` for managing SMS OTPs -- `Sessions` for managing sessions -- `Users` for managing users -- `AuthTokens` for managing authentication tokens needed for own session management -- `Validations` for validating email addresses and phone numbers +- `EmailLinks` for managing email links ([examples](tests/integration/EmailLink)) +- `EmailOTPs` for managing email OTPs ([examples](tests/integration/todo)) +- `SMSOTPs` for managing SMS OTPs ([examples](tests/integration/todo)) +- `Sessions` for managing sessions ([examples](tests/integration/todo)) +- `Users` for managing users ([examples](tests/integration/todo)) +- `AuthTokens` for managing authentication tokens needed for own session management ([examples](tests/integration/todo)) +- `Validations` for validating email addresses and phone numbers ([examples](tests/integration/todo)) # :books: Advanced From 5f630cd6b8614cb4ed040c7d921ab090c4b398bc Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:43:29 +0100 Subject: [PATCH 53/81] More README optimizations --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 61f02e4..31ced8c 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,19 @@ A list of examples can be found in the integration tests [here](tests/integratio The Corbado PHP SDK provides the following services: -- `EmailLinks` for managing email links ([examples](tests/integration/EmailLink)) -- `EmailOTPs` for managing email OTPs ([examples](tests/integration/todo)) +- `emailLinks` for managing email links ([examples](tests/integration/EmailLink)) +- `emailOTPs` for managing email OTPs ([examples](tests/integration/todo)) - `SMSOTPs` for managing SMS OTPs ([examples](tests/integration/todo)) -- `Sessions` for managing sessions ([examples](tests/integration/todo)) -- `Users` for managing users ([examples](tests/integration/todo)) -- `AuthTokens` for managing authentication tokens needed for own session management ([examples](tests/integration/todo)) -- `Validations` for validating email addresses and phone numbers ([examples](tests/integration/todo)) +- `sessions` for managing sessions ([examples](tests/integration/todo)) +- `users` for managing users ([examples](tests/integration/todo)) +- `authTokens` for managing authentication tokens needed for own session management ([examples](tests/integration/todo)) +- `validations` for validating email addresses and phone numbers ([examples](tests/integration/todo)) + +To use a specific service, such as `sessions`, invoke it as shown below: + +```PHP +$user = $sdk->sessions()->getCurrentUser(); +``` # :books: Advanced From a7c893d5d7a1688355f480bc4975e8d3bbc72367 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:59:29 +0100 Subject: [PATCH 54/81] Major directory restructuring --- src/Classes/Apis/AuthTokens.php | 10 +++--- src/Classes/Apis/EmailCodes.php | 10 +++--- src/Classes/Apis/EmailLinks.php | 10 +++--- src/Classes/Apis/SMSCodes.php | 10 +++--- src/Classes/Apis/Users.php | 10 +++--- src/Classes/Apis/Validations.php | 18 +++------- src/Classes/Webhook.php | 13 +++---- src/Configuration.php | 34 +++++++++---------- .../Exceptions/AssertException.php | 2 +- .../Exceptions/ConfigurationException.php | 2 +- .../Exceptions/ServerException.php | 2 +- .../Exceptions/StandardException.php | 2 +- src/{Classes => Helper}/Assert.php | 20 ++++++----- src/{Classes => Helper}/Helper.php | 8 ++--- src/SDK.php | 14 ++++---- src/{Classes => Session}/Session.php | 13 +++---- src/{Classes => Session}/User.php | 4 +-- .../AuthToken/AuthTokenValidateTest.php | 8 ++--- .../EmailCode/EmailCodeSendTest.php | 6 ++-- .../EmailCode/EmailCodeValidateTest.php | 7 ++-- .../EmailLink/EmailLinkSendTest.php | 6 ++-- .../EmailLink/EmailLinkValidateTest.php | 6 ++-- tests/integration/SMSCode/SMSCodeSendTest.php | 7 ++-- .../SMSCode/SMSCodeValidateTest.php | 7 ++-- tests/integration/User/UserCreateTest.php | 6 ++-- tests/integration/User/UserDeleteTest.php | 6 ++-- tests/integration/User/UserGetTest.php | 6 ++-- tests/integration/User/UserListTest.php | 7 ++-- tests/integration/Utils.php | 6 ++-- .../Validation/ValidateEmailTest.php | 6 ++-- .../Validation/ValidatePhoneNumberTest.php | 6 ++-- tests/unit/Classes/SessionTest.php | 4 +-- tests/unit/Classes/UserTest.php | 4 +-- 33 files changed, 134 insertions(+), 146 deletions(-) rename src/{Classes => }/Exceptions/AssertException.php (58%) rename src/{Classes => }/Exceptions/ConfigurationException.php (61%) rename src/{Classes => }/Exceptions/ServerException.php (97%) rename src/{Classes => }/Exceptions/StandardException.php (59%) rename src/{Classes => Helper}/Assert.php (62%) rename src/{Classes => Helper}/Helper.php (95%) rename src/{Classes => Session}/Session.php (94%) rename src/{Classes => Session}/User.php (95%) diff --git a/src/Classes/Apis/AuthTokens.php b/src/Classes/Apis/AuthTokens.php index 7b4048e..62f0c4b 100644 --- a/src/Classes/Apis/AuthTokens.php +++ b/src/Classes/Apis/AuthTokens.php @@ -2,16 +2,16 @@ namespace Corbado\Classes\Apis; -use Corbado\Classes\Assert; -use Corbado\Classes\Exceptions\AssertException; -use Corbado\Classes\Exceptions\ServerException; -use Corbado\Classes\Exceptions\StandardException; -use Corbado\Classes\Helper; +use Corbado\Exceptions\AssertException; +use Corbado\Exceptions\ServerException; +use Corbado\Exceptions\StandardException; use Corbado\Generated\Api\AuthTokensApi; use Corbado\Generated\ApiException; use Corbado\Generated\Model\AuthTokenValidateReq; use Corbado\Generated\Model\AuthTokenValidateRsp; use Corbado\Generated\Model\ErrorRsp; +use Corbado\Helper\Assert; +use Corbado\Helper\Helper; class AuthTokens implements AuthTokensInterface { diff --git a/src/Classes/Apis/EmailCodes.php b/src/Classes/Apis/EmailCodes.php index a8d8170..95fb41a 100644 --- a/src/Classes/Apis/EmailCodes.php +++ b/src/Classes/Apis/EmailCodes.php @@ -2,11 +2,9 @@ namespace Corbado\Classes\Apis; -use Corbado\Classes\Assert; -use Corbado\Classes\Exceptions\AssertException; -use Corbado\Classes\Exceptions\ServerException; -use Corbado\Classes\Exceptions\StandardException; -use Corbado\Classes\Helper; +use Corbado\Exceptions\AssertException; +use Corbado\Exceptions\ServerException; +use Corbado\Exceptions\StandardException; use Corbado\Generated\Api\EmailOTPApi; use Corbado\Generated\ApiException; use Corbado\Generated\Model\EmailCodeSendReq; @@ -14,6 +12,8 @@ use Corbado\Generated\Model\EmailCodeValidateReq; use Corbado\Generated\Model\EmailCodeValidateRsp; use Corbado\Generated\Model\ErrorRsp; +use Corbado\Helper\Assert; +use Corbado\Helper\Helper; class EmailCodes implements EmailCodesInterface { diff --git a/src/Classes/Apis/EmailLinks.php b/src/Classes/Apis/EmailLinks.php index 33b9b49..db082bd 100644 --- a/src/Classes/Apis/EmailLinks.php +++ b/src/Classes/Apis/EmailLinks.php @@ -2,11 +2,9 @@ namespace Corbado\Classes\Apis; -use Corbado\Classes\Assert; -use Corbado\Classes\Exceptions\AssertException; -use Corbado\Classes\Exceptions\ServerException; -use Corbado\Classes\Exceptions\StandardException; -use Corbado\Classes\Helper; +use Corbado\Exceptions\AssertException; +use Corbado\Exceptions\ServerException; +use Corbado\Exceptions\StandardException; use Corbado\Generated\Api\EmailMagicLinksApi; use Corbado\Generated\ApiException; use Corbado\Generated\Model\EmailLinkSendReq; @@ -14,6 +12,8 @@ use Corbado\Generated\Model\EmailLinksValidateReq; use Corbado\Generated\Model\EmailLinkValidateRsp; use Corbado\Generated\Model\ErrorRsp; +use Corbado\Helper\Assert; +use Corbado\Helper\Helper; class EmailLinks implements EmailLinksInterface { diff --git a/src/Classes/Apis/SMSCodes.php b/src/Classes/Apis/SMSCodes.php index 0603ef9..b73382e 100644 --- a/src/Classes/Apis/SMSCodes.php +++ b/src/Classes/Apis/SMSCodes.php @@ -2,11 +2,9 @@ namespace Corbado\Classes\Apis; -use Corbado\Classes\Assert; -use Corbado\Classes\Exceptions\AssertException; -use Corbado\Classes\Exceptions\ServerException; -use Corbado\Classes\Exceptions\StandardException; -use Corbado\Classes\Helper; +use Corbado\Exceptions\AssertException; +use Corbado\Exceptions\ServerException; +use Corbado\Exceptions\StandardException; use Corbado\Generated\Api\SMSOTPApi; use Corbado\Generated\ApiException; use Corbado\Generated\Model\ErrorRsp; @@ -14,6 +12,8 @@ use Corbado\Generated\Model\SmsCodeSendRsp; use Corbado\Generated\Model\SmsCodeValidateReq; use Corbado\Generated\Model\SmsCodeValidateRsp; +use Corbado\Helper\Assert; +use Corbado\Helper\Helper; class SMSCodes implements SMSCodesInterface { diff --git a/src/Classes/Apis/Users.php b/src/Classes/Apis/Users.php index 745b370..aac3715 100644 --- a/src/Classes/Apis/Users.php +++ b/src/Classes/Apis/Users.php @@ -2,11 +2,9 @@ namespace Corbado\Classes\Apis; -use Corbado\Classes\Assert; -use Corbado\Classes\Exceptions\AssertException; -use Corbado\Classes\Exceptions\ServerException; -use Corbado\Classes\Exceptions\StandardException; -use Corbado\Classes\Helper; +use Corbado\Exceptions\AssertException; +use Corbado\Exceptions\ServerException; +use Corbado\Exceptions\StandardException; use Corbado\Generated\Api\UserApi; use Corbado\Generated\ApiException; use Corbado\Generated\Model\ErrorRsp; @@ -16,6 +14,8 @@ use Corbado\Generated\Model\UserDeleteReq; use Corbado\Generated\Model\UserGetRsp; use Corbado\Generated\Model\UserListRsp; +use Corbado\Helper\Assert; +use Corbado\Helper\Helper; class Users implements UsersInterface { diff --git a/src/Classes/Apis/Validations.php b/src/Classes/Apis/Validations.php index e335776..2ff7e09 100644 --- a/src/Classes/Apis/Validations.php +++ b/src/Classes/Apis/Validations.php @@ -2,27 +2,19 @@ namespace Corbado\Classes\Apis; -use Corbado\Classes\Assert; -use Corbado\Classes\Exceptions\AssertException; use Corbado\Classes\Exceptions\Http; -use Corbado\Classes\Exceptions\ServerException; -use Corbado\Classes\Exceptions\StandardException; -use Corbado\Classes\Helper; +use Corbado\Exceptions\AssertException; +use Corbado\Exceptions\ServerException; +use Corbado\Exceptions\StandardException; use Corbado\Generated\Api\ValidationApi; use Corbado\Generated\ApiException; -use Corbado\Generated\Model\EmailValidationResult; use Corbado\Generated\Model\ErrorRsp; -use Corbado\Generated\Model\PhoneNumberValidationResult; use Corbado\Generated\Model\ValidateEmailReq; use Corbado\Generated\Model\ValidateEmailRsp; use Corbado\Generated\Model\ValidatePhoneNumberReq; use Corbado\Generated\Model\ValidatePhoneNumberRsp; -use Corbado\Generated\Model\ValidationEmail; -use Corbado\Generated\Model\ValidationPhoneNumber; -use Corbado\SDK; -use GuzzleHttp\Psr7\Request; -use Psr\Http\Client\ClientExceptionInterface; -use Psr\Http\Client\ClientInterface; +use Corbado\Helper\Assert; +use Corbado\Helper\Helper; class Validations implements ValidationsInterface { diff --git a/src/Classes/Webhook.php b/src/Classes/Webhook.php index 6e21979..a54576c 100644 --- a/src/Classes/Webhook.php +++ b/src/Classes/Webhook.php @@ -2,8 +2,9 @@ namespace Corbado\Classes; -use Corbado\Classes; -use Corbado\Classes\Exceptions\StandardException; +use Corbado\Exceptions\StandardException; +use Corbado\Helper\Assert; +use Corbado\Helper\Helper; use Corbado\Model; class Webhook @@ -41,7 +42,7 @@ class Webhook * * @param string $username * @param string $password - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException */ public function __construct(string $username, string $password) { @@ -187,7 +188,7 @@ public function getAction(): string * Returns auth methods request model * * @return \Corbado\Classes\WebhookModels\AuthMethodsRequest - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException * @throws StandardException */ public function getAuthMethodsRequest(): \Corbado\Classes\WebhookModels\AuthMethodsRequest @@ -218,7 +219,7 @@ public function getAuthMethodsRequest(): \Corbado\Classes\WebhookModels\AuthMeth * @param bool $exit * @return void * @throws StandardException - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException */ public function sendAuthMethodsResponse(string $status, bool $exit = true, string $responseID = ''): void { @@ -245,7 +246,7 @@ public function sendAuthMethodsResponse(string $status, bool $exit = true, strin * * @return \Corbado\Classes\WebhookModels\PasswordVerifyRequest * @throws StandardException - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException */ public function getPasswordVerifyRequest(): \Corbado\Classes\WebhookModels\PasswordVerifyRequest { diff --git a/src/Configuration.php b/src/Configuration.php index b927a04..0dc5342 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -2,7 +2,7 @@ namespace Corbado; -use Corbado\Classes\Assert; +use Corbado\Helper\Assert; use Psr\Cache\CacheItemPoolInterface; use Psr\Http\Client\ClientInterface; @@ -23,19 +23,19 @@ class Configuration * passed via the constructor. All other options can be set via * setters. * - * @throws Classes\Exceptions\AssertException - * @throws Classes\Exceptions\ConfigurationException + * @throws \Corbado\Exceptions\AssertException + * @throws \Corbado\Exceptions\ConfigurationException */ public function __construct(string $projectID, string $apiSecret = '') { Assert::stringNotEmpty($projectID); if (!str_starts_with($projectID, 'pro-')) { - throw new Classes\Exceptions\ConfigurationException('Invalid project ID "' . $projectID . '" given, needs to start with "pro-"'); + throw new Exceptions\ConfigurationException('Invalid project ID "' . $projectID . '" given, needs to start with "pro-"'); } if ($apiSecret !== '' && !str_starts_with($apiSecret, 'corbado1_')) { - throw new Classes\Exceptions\ConfigurationException('Invalid API secret "' . $apiSecret . '" given, needs to start with "corbado1_"'); + throw new Exceptions\ConfigurationException('Invalid API secret "' . $apiSecret . '" given, needs to start with "corbado1_"'); } $this->projectID = $projectID; @@ -43,7 +43,7 @@ public function __construct(string $projectID, string $apiSecret = '') } /** - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException */ public function setFrontendAPI(string $frontendAPI): self { @@ -55,7 +55,7 @@ public function setFrontendAPI(string $frontendAPI): self } /** - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException */ public function setBackendAPI(string $backendAPI): self { @@ -67,7 +67,7 @@ public function setBackendAPI(string $backendAPI): self } /** - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException */ public function setShortSessionCookieName(string $shortSessionCookieName): self { @@ -147,7 +147,7 @@ public function getJwksCachePool(): ?CacheItemPoolInterface } /** - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException */ private function assertURL(string $url): void { @@ -155,35 +155,35 @@ private function assertURL(string $url): void $parts = parse_url($url); if ($parts === false) { - throw new Classes\Exceptions\AssertException('Assert failed: parse_url() returned error'); + throw new Exceptions\AssertException('Assert failed: parse_url() returned error'); } if (isset($parts['scheme']) && $parts['scheme'] !== 'https') { - throw new Classes\Exceptions\AssertException('Assert failed: scheme needs to be https'); + throw new Exceptions\AssertException('Assert failed: scheme needs to be https'); } if (!isset($parts['host'])) { - throw new Classes\Exceptions\AssertException('Assert failed: host is empty'); + throw new Exceptions\AssertException('Assert failed: host is empty'); } if (isset($parts['user'])) { - throw new Classes\Exceptions\AssertException('Assert failed: username needs to be empty'); + throw new Exceptions\AssertException('Assert failed: username needs to be empty'); } if (isset($parts['pass'])) { - throw new Classes\Exceptions\AssertException('Assert failed: password needs to be empty'); + throw new Exceptions\AssertException('Assert failed: password needs to be empty'); } if (isset($parts['path'])) { - throw new Classes\Exceptions\AssertException('Assert failed: path needs to be empty'); + throw new Exceptions\AssertException('Assert failed: path needs to be empty'); } if (isset($parts['query'])) { - throw new Classes\Exceptions\AssertException('Assert failed: querystring needs to be empty'); + throw new Exceptions\AssertException('Assert failed: querystring needs to be empty'); } if (isset($parts['fragment'])) { - throw new Classes\Exceptions\AssertException('Assert failed: fragment needs to be empty'); + throw new Exceptions\AssertException('Assert failed: fragment needs to be empty'); } } } diff --git a/src/Classes/Exceptions/AssertException.php b/src/Exceptions/AssertException.php similarity index 58% rename from src/Classes/Exceptions/AssertException.php rename to src/Exceptions/AssertException.php index aa6e8d8..5fe17c8 100644 --- a/src/Classes/Exceptions/AssertException.php +++ b/src/Exceptions/AssertException.php @@ -1,6 +1,6 @@ $possibleValues * @return void - * @throws \Corbado\Classes\Exceptions\AssertException + * @throws AssertException */ public static function stringEquals(string $data, array $possibleValues): void { @@ -48,7 +50,7 @@ public static function stringEquals(string $data, array $possibleValues): void return; } - throw new Exceptions\AssertException('Assert failed: Invalid value "' . $data . '" given, only the following are allowed: ' . implode(', ', $possibleValues)); + throw new AssertException('Assert failed: Invalid value "' . $data . '" given, only the following are allowed: ' . implode(', ', $possibleValues)); } /** @@ -57,13 +59,13 @@ public static function stringEquals(string $data, array $possibleValues): void * @param array $data * @param array $keys * @return void - * @throws \Corbado\Classes\Exceptions\AssertException + * @throws AssertException */ public static function arrayKeysExist(array $data, array $keys): void { foreach ($keys as $key) { if (!array_key_exists($key, $data)) { - throw new Exceptions\AssertException('Assert failed: Given array has no key "' . $key . '"'); + throw new AssertException('Assert failed: Given array has no key "' . $key . '"'); } } } diff --git a/src/Classes/Helper.php b/src/Helper/Helper.php similarity index 95% rename from src/Classes/Helper.php rename to src/Helper/Helper.php index 4e24b37..de5bb6d 100644 --- a/src/Classes/Helper.php +++ b/src/Helper/Helper.php @@ -1,10 +1,10 @@ config->getApiSecret() == '') { - throw new Classes\Exceptions\ConfigurationException('No API secret set, pass in constructor of configuration'); + throw new Exceptions\ConfigurationException('No API secret set, pass in constructor of configuration'); } $config = new Generated\Configuration(); @@ -225,7 +225,7 @@ private function createGeneratedConfiguration(): Generated\Configuration } /** - * @throws Classes\Exceptions\AssertException + * @throws \Corbado\Exceptions\AssertException */ public static function createClientInfo(string $remoteAddress, string $userAgent): ClientInfo { diff --git a/src/Classes/Session.php b/src/Session/Session.php similarity index 94% rename from src/Classes/Session.php rename to src/Session/Session.php index 8a2dec6..efcc630 100644 --- a/src/Classes/Session.php +++ b/src/Session/Session.php @@ -1,7 +1,8 @@ Date: Wed, 20 Dec 2023 18:59:55 +0100 Subject: [PATCH 55/81] Major directory restructuring --- src/SDK.php | 24 +++++++++---------- src/{Classes/Apis => Services}/AuthTokens.php | 2 +- .../Apis => Services}/AuthTokensInterface.php | 2 +- src/{Classes/Apis => Services}/EmailCodes.php | 2 +- .../Apis => Services}/EmailCodesInterface.php | 2 +- src/{Classes/Apis => Services}/EmailLinks.php | 2 +- .../Apis => Services}/EmailLinksInterface.php | 2 +- src/{Classes/Apis => Services}/SMSCodes.php | 2 +- .../Apis => Services}/SMSCodesInterface.php | 2 +- src/{Classes/Apis => Services}/Users.php | 2 +- .../Apis => Services}/UsersInterface.php | 2 +- .../Apis => Services}/Validations.php | 2 +- .../ValidationsInterface.php | 2 +- 13 files changed, 24 insertions(+), 24 deletions(-) rename src/{Classes/Apis => Services}/AuthTokens.php (97%) rename src/{Classes/Apis => Services}/AuthTokensInterface.php (87%) rename src/{Classes/Apis => Services}/EmailCodes.php (98%) rename src/{Classes/Apis => Services}/EmailCodesInterface.php (92%) rename src/{Classes/Apis => Services}/EmailLinks.php (98%) rename src/{Classes/Apis => Services}/EmailLinksInterface.php (92%) rename src/{Classes/Apis => Services}/SMSCodes.php (98%) rename src/{Classes/Apis => Services}/SMSCodesInterface.php (92%) rename src/{Classes/Apis => Services}/Users.php (98%) rename src/{Classes/Apis => Services}/UsersInterface.php (95%) rename src/{Classes/Apis => Services}/Validations.php (98%) rename src/{Classes/Apis => Services}/ValidationsInterface.php (92%) diff --git a/src/SDK.php b/src/SDK.php index a2a8f96..5b3d820 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -2,18 +2,18 @@ namespace Corbado; -use Corbado\Classes\Apis\AuthTokens; -use Corbado\Classes\Apis\AuthTokensInterface; -use Corbado\Classes\Apis\EmailCodes; -use Corbado\Classes\Apis\EmailCodesInterface; -use Corbado\Classes\Apis\EmailLinks; -use Corbado\Classes\Apis\EmailLinksInterface; -use Corbado\Classes\Apis\SMSCodes; -use Corbado\Classes\Apis\SMSCodesInterface; -use Corbado\Classes\Apis\Users; -use Corbado\Classes\Apis\UsersInterface; -use Corbado\Classes\Apis\Validations; -use Corbado\Classes\Apis\ValidationsInterface; +use Corbado\Services\AuthTokens; +use Corbado\Services\AuthTokensInterface; +use Corbado\Services\EmailCodes; +use Corbado\Services\EmailCodesInterface; +use Corbado\Services\EmailLinks; +use Corbado\Services\EmailLinksInterface; +use Corbado\Services\SMSCodes; +use Corbado\Services\SMSCodesInterface; +use Corbado\Services\Users; +use Corbado\Services\UsersInterface; +use Corbado\Services\Validations; +use Corbado\Services\ValidationsInterface; use Corbado\Exceptions\AssertException; use Corbado\Exceptions\ConfigurationException; use Corbado\Generated\Api\AuthTokensApi; diff --git a/src/Classes/Apis/AuthTokens.php b/src/Services/AuthTokens.php similarity index 97% rename from src/Classes/Apis/AuthTokens.php rename to src/Services/AuthTokens.php index 62f0c4b..765c95f 100644 --- a/src/Classes/Apis/AuthTokens.php +++ b/src/Services/AuthTokens.php @@ -1,6 +1,6 @@ Date: Wed, 20 Dec 2023 19:02:04 +0100 Subject: [PATCH 56/81] Major directory restructuring --- examples/webhook.php | 4 +-- .../Entities}/AuthMethodsDataRequest.php | 2 +- .../Entities}/AuthMethodsDataResponse.php | 2 +- .../Entities}/AuthMethodsRequest.php | 2 +- .../Entities}/AuthMethodsResponse.php | 2 +- .../Entities}/CommonRequest.php | 2 +- .../Entities}/CommonResponse.php | 2 +- .../Entities}/PasswordVerifyDataRequest.php | 2 +- .../Entities}/PasswordVerifyDataResponse.php | 2 +- .../Entities}/PasswordVerifyRequest.php | 2 +- .../Entities}/PasswordVerifyResponse.php | 2 +- src/{Classes => Webhook}/Webhook.php | 26 +++++++++---------- 12 files changed, 25 insertions(+), 25 deletions(-) rename src/{Classes/WebhookModels => Webhook/Entities}/AuthMethodsDataRequest.php (63%) rename src/{Classes/WebhookModels => Webhook/Entities}/AuthMethodsDataResponse.php (83%) rename src/{Classes/WebhookModels => Webhook/Entities}/AuthMethodsRequest.php (70%) rename src/{Classes/WebhookModels => Webhook/Entities}/AuthMethodsResponse.php (71%) rename src/{Classes/WebhookModels => Webhook/Entities}/CommonRequest.php (81%) rename src/{Classes/WebhookModels => Webhook/Entities}/CommonResponse.php (60%) rename src/{Classes/WebhookModels => Webhook/Entities}/PasswordVerifyDataRequest.php (71%) rename src/{Classes/WebhookModels => Webhook/Entities}/PasswordVerifyDataResponse.php (63%) rename src/{Classes/WebhookModels => Webhook/Entities}/PasswordVerifyRequest.php (72%) rename src/{Classes/WebhookModels => Webhook/Entities}/PasswordVerifyResponse.php (72%) rename src/{Classes => Webhook}/Webhook.php (88%) diff --git a/examples/webhook.php b/examples/webhook.php index e2a8d03..6e5099a 100644 --- a/examples/webhook.php +++ b/examples/webhook.php @@ -1,7 +1,7 @@ checkAutomaticAuthentication(); @@ -200,10 +200,10 @@ public function getAuthMethodsRequest(): \Corbado\Classes\WebhookModels\AuthMeth Assert::arrayKeysExist($data, self::STANDARD_FIELDS); Assert::arrayKeysExist($data['data'], ['username']); - $dataRequest = new \Corbado\Classes\WebhookModels\AuthMethodsDataRequest(); + $dataRequest = new Entities\AuthMethodsDataRequest(); $dataRequest->username = $data['data']['username']; - $request = new \Corbado\Classes\WebhookModels\AuthMethodsRequest(); + $request = new Entities\AuthMethodsRequest(); $request->id = $data['id']; $request->projectID = $data['projectID']; $request->action = self::ACTION_AUTH_METHODS; @@ -227,10 +227,10 @@ public function sendAuthMethodsResponse(string $status, bool $exit = true, strin $this->checkAutomaticAuthentication(); - $dataResponse = new \Corbado\Classes\WebhookModels\AuthMethodsDataResponse(); + $dataResponse = new Entities\AuthMethodsDataResponse(); $dataResponse->status = $status; - $response = new \Corbado\Classes\WebhookModels\AuthMethodsResponse(); + $response = new Entities\AuthMethodsResponse(); $response->responseID = $responseID; $response->data = $dataResponse; @@ -244,11 +244,11 @@ public function sendAuthMethodsResponse(string $status, bool $exit = true, strin /** * Returns password verify request model * - * @return \Corbado\Classes\WebhookModels\PasswordVerifyRequest + * @return \Corbado\Webhook\Entities\PasswordVerifyRequest * @throws StandardException * @throws \Corbado\Exceptions\AssertException */ - public function getPasswordVerifyRequest(): \Corbado\Classes\WebhookModels\PasswordVerifyRequest + public function getPasswordVerifyRequest(): Entities\PasswordVerifyRequest { $this->checkAutomaticAuthentication(); @@ -257,11 +257,11 @@ public function getPasswordVerifyRequest(): \Corbado\Classes\WebhookModels\Passw Assert::arrayKeysExist($data, self::STANDARD_FIELDS); Assert::arrayKeysExist($data['data'], ['username', 'password']); - $dataRequest = new \Corbado\Classes\WebhookModels\PasswordVerifyDataRequest(); + $dataRequest = new Entities\PasswordVerifyDataRequest(); $dataRequest->username = $data['data']['username']; $dataRequest->password = $data['data']['password']; - $request = new \Corbado\Classes\WebhookModels\PasswordVerifyRequest(); + $request = new Entities\PasswordVerifyRequest(); $request->id = $data['id']; $request->projectID = $data['projectID']; $request->action = self::ACTION_PASSWORD_VERIFY; @@ -282,10 +282,10 @@ public function sendPasswordVerifyResponse(bool $success, bool $exit = true, str { $this->checkAutomaticAuthentication(); - $dataResponse = new \Corbado\Classes\WebhookModels\PasswordVerifyDataResponse(); + $dataResponse = new Entities\PasswordVerifyDataResponse(); $dataResponse->success = $success; - $response = new \Corbado\Classes\WebhookModels\PasswordVerifyResponse(); + $response = new Entities\PasswordVerifyResponse(); $response->responseID = $responseID; $response->data = $dataResponse; From d2380882d566310ab84fa3b9fe475a17fe57933b Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 19:53:18 +0100 Subject: [PATCH 57/81] Renamed some services --- src/SDK.php | 60 ++++++++++--------- ...rface.php => EmailMagicLinksInterface.php} | 2 +- ...mailLinks.php => EmailMagicMagicLinks.php} | 2 +- .../{EmailCodes.php => EmailOTPs.php} | 2 +- ...esInterface.php => EmailOTPsInterface.php} | 2 +- src/Services/{SMSCodes.php => SmsOTPs.php} | 2 +- ...odesInterface.php => SmsOTPsInterface.php} | 2 +- .../EmailCode/EmailCodeSendTest.php | 4 +- .../EmailCode/EmailCodeValidateTest.php | 4 +- .../EmailLink/EmailLinkSendTest.php | 4 +- .../EmailLink/EmailLinkValidateTest.php | 4 +- tests/integration/SMSCode/SMSCodeSendTest.php | 4 +- .../SMSCode/SMSCodeValidateTest.php | 4 +- 13 files changed, 49 insertions(+), 47 deletions(-) rename src/Services/{EmailLinksInterface.php => EmailMagicLinksInterface.php} (91%) rename src/Services/{EmailLinks.php => EmailMagicMagicLinks.php} (96%) rename src/Services/{EmailCodes.php => EmailOTPs.php} (97%) rename src/Services/{EmailCodesInterface.php => EmailOTPsInterface.php} (92%) rename src/Services/{SMSCodes.php => SmsOTPs.php} (97%) rename src/Services/{SMSCodesInterface.php => SmsOTPsInterface.php} (93%) diff --git a/src/SDK.php b/src/SDK.php index 5b3d820..c7bd5bb 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -4,12 +4,12 @@ use Corbado\Services\AuthTokens; use Corbado\Services\AuthTokensInterface; -use Corbado\Services\EmailCodes; -use Corbado\Services\EmailCodesInterface; -use Corbado\Services\EmailLinks; -use Corbado\Services\EmailLinksInterface; -use Corbado\Services\SMSCodes; -use Corbado\Services\SMSCodesInterface; +use Corbado\Services\EmailOTPs; +use Corbado\Services\EmailOTPsInterface; +use Corbado\Services\EmailMagicMagicLinks; +use Corbado\Services\EmailMagicLinksInterface; +use Corbado\Services\SmsOTPs; +use Corbado\Services\SmsOTPsInterface; use Corbado\Services\Users; use Corbado\Services\UsersInterface; use Corbado\Services\Validations; @@ -32,13 +32,13 @@ class SDK { private Configuration $config; private ClientInterface $client; - private ?EmailLinksInterface $emailLinks = null; - private ?SMSCodesInterface $smsCodes = null; + private ?EmailMagicLinksInterface $emailMagicLinks = null; + private ?SmsOTPsInterface $smsOTPs = null; private ?ValidationsInterface $validations = null; private ?UsersInterface $users = null; private ?Session $session = null; private ?AuthTokensInterface $authTokens = null; - private ?EmailCodesInterface $emailCodes = null; + private ?EmailOTPsInterface $emailOTPs = null; public const VERSION = '1.0.0'; @@ -67,41 +67,41 @@ public function __construct(Configuration $config) } /** - * Returns email links handling + * Returns email magic link handling * - * @return EmailLinksInterface + * @return EmailMagicLinksInterface * @throws AssertException * @throws ConfigurationException */ - public function emailLinks(): EmailLinksInterface + public function emailMagicLinks(): EmailMagicLinksInterface { - if ($this->emailLinks === null) { - $this->emailLinks = new EmailLinks( + if ($this->emailMagicLinks === null) { + $this->emailMagicLinks = new EmailMagicMagicLinks( // @phpstan-ignore-next-line new EmailMagicLinksApi($this->client, $this->createGeneratedConfiguration()) ); } - return $this->emailLinks; + return $this->emailMagicLinks; } /** - * Returns SMS codes handling + * Returns SMS OTP handling * - * @return SMSCodesInterface + * @return SmsOTPsInterface * @throws AssertException * @throws ConfigurationException */ - public function smsCodes(): SMSCodesInterface + public function smsOTPs(): SmsOTPsInterface { - if ($this->smsCodes === null) { - $this->smsCodes = new SMSCodes( + if ($this->smsOTPs === null) { + $this->smsOTPs = new SmsOTPs( // @phpstan-ignore-next-line new SMSOTPApi($this->client, $this->createGeneratedConfiguration()) ); } - return $this->smsCodes; + return $this->smsOTPs; } /** @@ -124,7 +124,7 @@ public function validations(): ValidationsInterface } /** - * Returns users handling + * Returns user handling * * @return UsersInterface * @throws AssertException @@ -170,7 +170,7 @@ public function sessions(): Session } /** - * Returns auth tokens handling + * Returns auth token handling * * @return AuthTokensInterface * @throws ConfigurationException @@ -189,24 +189,26 @@ public function authTokens(): AuthTokensInterface } /** + * Returns email OTP handling + * * @throws AssertException * @throws ConfigurationException */ - public function emailCodes(): EmailCodesInterface + public function emailOTPs(): EmailOTPsInterface { - if ($this->emailCodes === null) { - $this->emailCodes = new EmailCodes( + if ($this->emailOTPs === null) { + $this->emailOTPs = new EmailOTPs( // @phpstan-ignore-next-line new EmailOTPApi($this->client, $this->createGeneratedConfiguration()) ); } - return $this->emailCodes; + return $this->emailOTPs; } /** * @return Generated\Configuration - * @throws \Corbado\Exceptions\ConfigurationException + * @throws ConfigurationException */ private function createGeneratedConfiguration(): Generated\Configuration { @@ -225,7 +227,7 @@ private function createGeneratedConfiguration(): Generated\Configuration } /** - * @throws \Corbado\Exceptions\AssertException + * @throws AssertException */ public static function createClientInfo(string $remoteAddress, string $userAgent): ClientInfo { diff --git a/src/Services/EmailLinksInterface.php b/src/Services/EmailMagicLinksInterface.php similarity index 91% rename from src/Services/EmailLinksInterface.php rename to src/Services/EmailMagicLinksInterface.php index 79ec987..d6a484a 100644 --- a/src/Services/EmailLinksInterface.php +++ b/src/Services/EmailMagicLinksInterface.php @@ -7,7 +7,7 @@ use Corbado\Generated\Model\EmailLinksValidateReq; use Corbado\Generated\Model\EmailLinkValidateRsp; -interface EmailLinksInterface +interface EmailMagicLinksInterface { public function send(EmailLinkSendReq $req): EmailLinkSendRsp; public function validate(string $id, EmailLinksValidateReq $req): EmailLinkValidateRsp; diff --git a/src/Services/EmailLinks.php b/src/Services/EmailMagicMagicLinks.php similarity index 96% rename from src/Services/EmailLinks.php rename to src/Services/EmailMagicMagicLinks.php index 25f3fdc..4b479d2 100644 --- a/src/Services/EmailLinks.php +++ b/src/Services/EmailMagicMagicLinks.php @@ -15,7 +15,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class EmailLinks implements EmailLinksInterface +class EmailMagicMagicLinks implements EmailMagicLinksInterface { private EmailMagicLinksApi $client; diff --git a/src/Services/EmailCodes.php b/src/Services/EmailOTPs.php similarity index 97% rename from src/Services/EmailCodes.php rename to src/Services/EmailOTPs.php index 7b1524b..92b19cf 100644 --- a/src/Services/EmailCodes.php +++ b/src/Services/EmailOTPs.php @@ -15,7 +15,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class EmailCodes implements EmailCodesInterface +class EmailOTPs implements EmailOTPsInterface { private EmailOTPApi $client; diff --git a/src/Services/EmailCodesInterface.php b/src/Services/EmailOTPsInterface.php similarity index 92% rename from src/Services/EmailCodesInterface.php rename to src/Services/EmailOTPsInterface.php index 6ebe3e2..27e3539 100644 --- a/src/Services/EmailCodesInterface.php +++ b/src/Services/EmailOTPsInterface.php @@ -7,7 +7,7 @@ use Corbado\Generated\Model\EmailCodeValidateReq; use Corbado\Generated\Model\EmailCodeValidateRsp; -interface EmailCodesInterface +interface EmailOTPsInterface { public function send(EmailCodeSendReq $req): EmailCodeSendRsp; public function validate(string $id, EmailCodeValidateReq $req): EmailCodeValidateRsp; diff --git a/src/Services/SMSCodes.php b/src/Services/SmsOTPs.php similarity index 97% rename from src/Services/SMSCodes.php rename to src/Services/SmsOTPs.php index e3ddfc5..474699b 100644 --- a/src/Services/SMSCodes.php +++ b/src/Services/SmsOTPs.php @@ -15,7 +15,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class SMSCodes implements SMSCodesInterface +class SmsOTPs implements SmsOTPsInterface { private SMSOTPApi $client; diff --git a/src/Services/SMSCodesInterface.php b/src/Services/SmsOTPsInterface.php similarity index 93% rename from src/Services/SMSCodesInterface.php rename to src/Services/SmsOTPsInterface.php index 91b28d0..897b3e4 100644 --- a/src/Services/SMSCodesInterface.php +++ b/src/Services/SmsOTPsInterface.php @@ -7,7 +7,7 @@ use Corbado\Generated\Model\SmsCodeValidateReq; use Corbado\Generated\Model\SmsCodeValidateRsp; -interface SMSCodesInterface +interface SmsOTPsInterface { public function send(SmsCodeSendReq $req): SmsCodeSendRsp; public function validate(string $id, SmsCodeValidateReq $req): SmsCodeValidateRsp; diff --git a/tests/integration/EmailCode/EmailCodeSendTest.php b/tests/integration/EmailCode/EmailCodeSendTest.php index bb76eb5..1425eb7 100644 --- a/tests/integration/EmailCode/EmailCodeSendTest.php +++ b/tests/integration/EmailCode/EmailCodeSendTest.php @@ -23,7 +23,7 @@ public function testEmailCodeSendValidationError(): void $req = new EmailCodeSendReq(); $req->setEmail(''); - Utils::SDK()->emailCodes()->send($req); + Utils::SDK()->emailOTPs()->send($req); } catch (ServerException $e) { $exception = $e; } @@ -42,7 +42,7 @@ public function testEmailCodeSendSuccess(): void $req->setEmail(Utils::createRandomTestEmail()); $req->setCreate(true); - $rsp = Utils::SDK()->emailCodes()->send($req); + $rsp = Utils::SDK()->emailOTPs()->send($req); $this->assertEquals(200, $rsp->getHttpStatusCode()); } } diff --git a/tests/integration/EmailCode/EmailCodeValidateTest.php b/tests/integration/EmailCode/EmailCodeValidateTest.php index 6ad6485..7cbb608 100644 --- a/tests/integration/EmailCode/EmailCodeValidateTest.php +++ b/tests/integration/EmailCode/EmailCodeValidateTest.php @@ -23,7 +23,7 @@ public function testEmailCodeValidateValidationErrorEmptyCode(): void $req = new EmailCodeValidateReq(); $req->setCode(''); - Utils::SDK()->emailCodes()->validate('emc-123456789', $req); + Utils::SDK()->emailOTPs()->validate('emc-123456789', $req); } catch (ServerException $e) { $exception = $e; } @@ -44,7 +44,7 @@ public function testEmailCodeValidateValidationErrorInvalidID(): void $req = new EmailCodeValidateReq(); $req->setCode('123456'); - Utils::SDK()->emailCodes()->validate('emc-123456789', $req); + Utils::SDK()->emailOTPs()->validate('emc-123456789', $req); } catch (ServerException $e) { $exception = $e; } diff --git a/tests/integration/EmailLink/EmailLinkSendTest.php b/tests/integration/EmailLink/EmailLinkSendTest.php index be8627e..308ac02 100644 --- a/tests/integration/EmailLink/EmailLinkSendTest.php +++ b/tests/integration/EmailLink/EmailLinkSendTest.php @@ -24,7 +24,7 @@ public function testEmailLinkSendValidationError(): void $req->setEmail(''); $req->setRedirect(''); - Utils::SDK()->emailLinks()->send($req); + Utils::SDK()->emailMagicLinks()->send($req); } catch (ServerException $e) { $exception = $e; } @@ -44,7 +44,7 @@ public function testEmailLinkSendSuccess(): void $req->setRedirect('https://example.com'); $req->setCreate(true); - $rsp = Utils::SDK()->emailLinks()->send($req); + $rsp = Utils::SDK()->emailMagicLinks()->send($req); $this->assertEquals(200, $rsp->getHttpStatusCode()); } } diff --git a/tests/integration/EmailLink/EmailLinkValidateTest.php b/tests/integration/EmailLink/EmailLinkValidateTest.php index d642ef3..07a31bd 100644 --- a/tests/integration/EmailLink/EmailLinkValidateTest.php +++ b/tests/integration/EmailLink/EmailLinkValidateTest.php @@ -23,7 +23,7 @@ public function testEmailLinkValidateValidationErrorEmptyToken(): void $req = new EmailLinksValidateReq(); $req->setToken(''); - Utils::SDK()->emailLinks()->validate('eml-123456789', $req); + Utils::SDK()->emailMagicLinks()->validate('eml-123456789', $req); } catch (ServerException $e) { $exception = $e; } @@ -44,7 +44,7 @@ public function testEmailLinkValidateValidationErrorInvalidID(): void $req = new EmailLinksValidateReq(); $req->setToken('fdfdsfdss1fdfdsfdss1'); - Utils::SDK()->emailLinks()->validate('eml-123456789', $req); + Utils::SDK()->emailMagicLinks()->validate('eml-123456789', $req); } catch (ServerException $e) { $exception = $e; } diff --git a/tests/integration/SMSCode/SMSCodeSendTest.php b/tests/integration/SMSCode/SMSCodeSendTest.php index 22ff57f..d0bea2b 100644 --- a/tests/integration/SMSCode/SMSCodeSendTest.php +++ b/tests/integration/SMSCode/SMSCodeSendTest.php @@ -23,7 +23,7 @@ public function testSMSCodeSendValidationError(): void $req = new SMSCodeSendReq(); $req->setPhoneNumber(''); - Utils::SDK()->smsCodes()->send($req); + Utils::SDK()->smsOTPs()->send($req); } catch (ServerException $e) { $exception = $e; } @@ -42,7 +42,7 @@ public function testSMSCodeSendSuccess(): void $req->setPhoneNumber(Utils::createRandomTestPhoneNumber()); $req->setCreate(true); - $rsp = Utils::SDK()->smsCodes()->send($req); + $rsp = Utils::SDK()->smsOTPs()->send($req); $this->assertEquals(200, $rsp->getHttpStatusCode()); } } diff --git a/tests/integration/SMSCode/SMSCodeValidateTest.php b/tests/integration/SMSCode/SMSCodeValidateTest.php index acf369e..3449ca6 100644 --- a/tests/integration/SMSCode/SMSCodeValidateTest.php +++ b/tests/integration/SMSCode/SMSCodeValidateTest.php @@ -23,7 +23,7 @@ public function testEmailCodeValidateValidationErrorEmptyCode(): void $req = new EmailCodeValidateReq(); $req->setCode(''); - Utils::SDK()->emailCodes()->validate('emc-123456789', $req); + Utils::SDK()->emailOTPs()->validate('emc-123456789', $req); } catch (ServerException $e) { $exception = $e; } @@ -44,7 +44,7 @@ public function testEmailCodeValidateValidationErrorInvalidID(): void $req = new EmailCodeValidateReq(); $req->setCode('123456'); - Utils::SDK()->emailCodes()->validate('emc-123456789', $req); + Utils::SDK()->emailOTPs()->validate('emc-123456789', $req); } catch (ServerException $e) { $exception = $e; } From 6acb3b2aa15ee250057137bc78887abef1ec04b1 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 19:54:23 +0100 Subject: [PATCH 58/81] Renamed some services --- src/SDK.php | 4 ++-- .../{EmailMagicMagicLinks.php => EmailMagicLinks.php} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/Services/{EmailMagicMagicLinks.php => EmailMagicLinks.php} (96%) diff --git a/src/SDK.php b/src/SDK.php index c7bd5bb..bc62fea 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -6,7 +6,7 @@ use Corbado\Services\AuthTokensInterface; use Corbado\Services\EmailOTPs; use Corbado\Services\EmailOTPsInterface; -use Corbado\Services\EmailMagicMagicLinks; +use Corbado\Services\EmailMagicLinks; use Corbado\Services\EmailMagicLinksInterface; use Corbado\Services\SmsOTPs; use Corbado\Services\SmsOTPsInterface; @@ -76,7 +76,7 @@ public function __construct(Configuration $config) public function emailMagicLinks(): EmailMagicLinksInterface { if ($this->emailMagicLinks === null) { - $this->emailMagicLinks = new EmailMagicMagicLinks( + $this->emailMagicLinks = new EmailMagicLinks( // @phpstan-ignore-next-line new EmailMagicLinksApi($this->client, $this->createGeneratedConfiguration()) ); diff --git a/src/Services/EmailMagicMagicLinks.php b/src/Services/EmailMagicLinks.php similarity index 96% rename from src/Services/EmailMagicMagicLinks.php rename to src/Services/EmailMagicLinks.php index 4b479d2..5ce4f10 100644 --- a/src/Services/EmailMagicMagicLinks.php +++ b/src/Services/EmailMagicLinks.php @@ -15,7 +15,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class EmailMagicMagicLinks implements EmailMagicLinksInterface +class EmailMagicLinks implements EmailMagicLinksInterface { private EmailMagicLinksApi $client; From 8b8d1093c64e8dcdfa268cd3f1aab72ca6a84ae0 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 19:56:14 +0100 Subject: [PATCH 59/81] README optimizations --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 31ced8c..d47bf2a 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the :rocket: [Getting started](#rocket-getting-started) | :speedboat: [Services](#speedboat-services) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support & Feedback](#speech_balloon-support--feedback) -# :rocket: Getting started +## :rocket: Getting started -## Requirements +### Requirements - PHP 7.2 or later - [Composer](https://getcomposer.org/) -## Installation +### Installation Use the following command to install the Corbado PHP SDK: @@ -27,7 +27,7 @@ Use the following command to install the Corbado PHP SDK: composer require corbado/php-sdk ``` -## Usage +### Usage To create a Corbado PHP SDK instance you need to provide your `project ID` and `API secret` which can be found at the [Developer Panel](https://app.corbado.com). @@ -36,11 +36,11 @@ $config = new Corbado\Configuration("", ""); $sdk = new Corbado\SDK($config); ``` -## Examples +### Examples A list of examples can be found in the integration tests [here](tests/integration). -# :speedboat: Services +## :speedboat: Services The Corbado PHP SDK provides the following services: @@ -58,9 +58,9 @@ To use a specific service, such as `sessions`, invoke it as shown below: $user = $sdk->sessions()->getCurrentUser(); ``` -# :books: Advanced +## :books: Advanced -## Error handling +### Error handling The Corbado PHP SDK throws exceptions for all errors. The following exceptions are thrown: @@ -98,22 +98,22 @@ try { } ``` -# :speech_balloon: Support & Feedback +## :speech_balloon: Support & Feedback -## Report an issue +### Report an issue If you encounter any bugs or have suggestions, please [open an issue](https://github.com/corbado/corbado-php/issues/new). -## Slack channel +### Slack channel Join our Slack channel to discuss questions or ideas with the Corbado team and other developers. [![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://join.slack.com/t/corbado/shared_invite/zt-1b7867yz8-V~Xr~ngmSGbt7IA~g16ZsQ) -## Email +### Email You can also reach out to us via email at vincent.delitz@corbado.com. -## Vulnerability reporting +### Vulnerability reporting Please report suspected security vulnerabilities in private to security@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities. From f4c7ea305f2828a7d6479451c885b7d3a07f5e4c Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 19:59:31 +0100 Subject: [PATCH 60/81] README optimizations --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d47bf2a..bd36664 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. -:rocket: [Getting started](#rocket-getting-started) | :speedboat: [Services](#speedboat-services) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support & Feedback](#speech_balloon-support--feedback) +:rocket: [Getting started](#rocket-getting-started) | :hammer_and_wrench: [Services](#hammerandwrench-services) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support & Feedback](#speech_balloon-support--feedback) ## :rocket: Getting started @@ -40,7 +40,7 @@ $sdk = new Corbado\SDK($config); A list of examples can be found in the integration tests [here](tests/integration). -## :speedboat: Services +## :hammer_and_wrench: Services The Corbado PHP SDK provides the following services: From 3cbaef8e4bd2e40de1060fa0b0f0583a33ecf1f4 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 20:00:17 +0100 Subject: [PATCH 61/81] README optimizations --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd36664..90a8674 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. -:rocket: [Getting started](#rocket-getting-started) | :hammer_and_wrench: [Services](#hammerandwrench-services) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support & Feedback](#speech_balloon-support--feedback) +:rocket: [Getting started](#rocket-getting-started) | :hammer_and_wrench: [Services](#hammer_and_wrench-services) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support & Feedback](#speech_balloon-support--feedback) ## :rocket: Getting started From 8605071bae9faf0c6515cbf42710c4bff602c3fa Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 20:07:05 +0100 Subject: [PATCH 62/81] More renames --- src/SDK.php | 70 +++++++++---------- ...nsInterface.php => AuthTokenInterface.php} | 2 +- .../{AuthTokens.php => AuthTokenService.php} | 2 +- ...erface.php => EmailMagicLinkInterface.php} | 2 +- ...gicLinks.php => EmailMagicLinkService.php} | 2 +- ...TPsInterface.php => EmailOTPInterface.php} | 2 +- .../{EmailOTPs.php => EmailOTPService.php} | 2 +- ...sOTPsInterface.php => SmsOTPInterface.php} | 2 +- .../{SmsOTPs.php => SmsOTPService.php} | 2 +- .../{UsersInterface.php => UserInterface.php} | 2 +- src/Services/{Users.php => UserService.php} | 2 +- ...sInterface.php => ValidationInterface.php} | 2 +- ...{Validations.php => ValidationService.php} | 2 +- 13 files changed, 47 insertions(+), 47 deletions(-) rename src/Services/{AuthTokensInterface.php => AuthTokenInterface.php} (88%) rename src/Services/{AuthTokens.php => AuthTokenService.php} (96%) rename src/Services/{EmailMagicLinksInterface.php => EmailMagicLinkInterface.php} (91%) rename src/Services/{EmailMagicLinks.php => EmailMagicLinkService.php} (96%) rename src/Services/{EmailOTPsInterface.php => EmailOTPInterface.php} (93%) rename src/Services/{EmailOTPs.php => EmailOTPService.php} (97%) rename src/Services/{SmsOTPsInterface.php => SmsOTPInterface.php} (93%) rename src/Services/{SmsOTPs.php => SmsOTPService.php} (97%) rename src/Services/{UsersInterface.php => UserInterface.php} (96%) rename src/Services/{Users.php => UserService.php} (98%) rename src/Services/{ValidationsInterface.php => ValidationInterface.php} (92%) rename src/Services/{Validations.php => ValidationService.php} (97%) diff --git a/src/SDK.php b/src/SDK.php index bc62fea..7e7d4c9 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -2,18 +2,18 @@ namespace Corbado; -use Corbado\Services\AuthTokens; -use Corbado\Services\AuthTokensInterface; -use Corbado\Services\EmailOTPs; -use Corbado\Services\EmailOTPsInterface; -use Corbado\Services\EmailMagicLinks; -use Corbado\Services\EmailMagicLinksInterface; -use Corbado\Services\SmsOTPs; -use Corbado\Services\SmsOTPsInterface; -use Corbado\Services\Users; -use Corbado\Services\UsersInterface; -use Corbado\Services\Validations; -use Corbado\Services\ValidationsInterface; +use Corbado\Services\AuthTokenService; +use Corbado\Services\AuthTokenInterface; +use Corbado\Services\EmailOTPService; +use Corbado\Services\EmailOTPInterface; +use Corbado\Services\EmailMagicLinkService; +use Corbado\Services\EmailMagicLinkInterface; +use Corbado\Services\SmsOTPService; +use Corbado\Services\SmsOTPInterface; +use Corbado\Services\UserService; +use Corbado\Services\UserInterface; +use Corbado\Services\ValidationService; +use Corbado\Services\ValidationInterface; use Corbado\Exceptions\AssertException; use Corbado\Exceptions\ConfigurationException; use Corbado\Generated\Api\AuthTokensApi; @@ -32,13 +32,13 @@ class SDK { private Configuration $config; private ClientInterface $client; - private ?EmailMagicLinksInterface $emailMagicLinks = null; - private ?SmsOTPsInterface $smsOTPs = null; - private ?ValidationsInterface $validations = null; - private ?UsersInterface $users = null; + private ?EmailMagicLinkInterface $emailMagicLinks = null; + private ?SmsOTPInterface $smsOTPs = null; + private ?ValidationInterface $validations = null; + private ?UserInterface $users = null; private ?Session $session = null; - private ?AuthTokensInterface $authTokens = null; - private ?EmailOTPsInterface $emailOTPs = null; + private ?AuthTokenInterface $authTokens = null; + private ?EmailOTPInterface $emailOTPs = null; public const VERSION = '1.0.0'; @@ -69,14 +69,14 @@ public function __construct(Configuration $config) /** * Returns email magic link handling * - * @return EmailMagicLinksInterface + * @return EmailMagicLinkInterface * @throws AssertException * @throws ConfigurationException */ - public function emailMagicLinks(): EmailMagicLinksInterface + public function emailMagicLinks(): EmailMagicLinkInterface { if ($this->emailMagicLinks === null) { - $this->emailMagicLinks = new EmailMagicLinks( + $this->emailMagicLinks = new EmailMagicLinkService( // @phpstan-ignore-next-line new EmailMagicLinksApi($this->client, $this->createGeneratedConfiguration()) ); @@ -88,14 +88,14 @@ public function emailMagicLinks(): EmailMagicLinksInterface /** * Returns SMS OTP handling * - * @return SmsOTPsInterface + * @return SmsOTPInterface * @throws AssertException * @throws ConfigurationException */ - public function smsOTPs(): SmsOTPsInterface + public function smsOTPs(): SmsOTPInterface { if ($this->smsOTPs === null) { - $this->smsOTPs = new SmsOTPs( + $this->smsOTPs = new SmsOTPService( // @phpstan-ignore-next-line new SMSOTPApi($this->client, $this->createGeneratedConfiguration()) ); @@ -107,14 +107,14 @@ public function smsOTPs(): SmsOTPsInterface /** * Returns validation handling * - * @return ValidationsInterface + * @return ValidationInterface * @throws AssertException * @throws ConfigurationException */ - public function validations(): ValidationsInterface + public function validations(): ValidationInterface { if ($this->validations === null) { - $this->validations = new Validations( + $this->validations = new ValidationService( // @phpstan-ignore-next-line new ValidationApi($this->client, $this->createGeneratedConfiguration()) ); @@ -126,14 +126,14 @@ public function validations(): ValidationsInterface /** * Returns user handling * - * @return UsersInterface + * @return UserInterface * @throws AssertException * @throws ConfigurationException */ - public function users(): UsersInterface + public function users(): UserInterface { if ($this->users === null) { - $this->users = new Users( + $this->users = new UserService( // @phpstan-ignore-next-line new UserApi($this->client, $this->createGeneratedConfiguration()) ); @@ -172,14 +172,14 @@ public function sessions(): Session /** * Returns auth token handling * - * @return AuthTokensInterface + * @return AuthTokenInterface * @throws ConfigurationException * @throws AssertException */ - public function authTokens(): AuthTokensInterface + public function authTokens(): AuthTokenInterface { if ($this->authTokens === null) { - $this->authTokens = new AuthTokens( + $this->authTokens = new AuthTokenService( // @phpstan-ignore-next-line new AuthTokensApi($this->client, $this->createGeneratedConfiguration()) ); @@ -194,10 +194,10 @@ public function authTokens(): AuthTokensInterface * @throws AssertException * @throws ConfigurationException */ - public function emailOTPs(): EmailOTPsInterface + public function emailOTPs(): EmailOTPInterface { if ($this->emailOTPs === null) { - $this->emailOTPs = new EmailOTPs( + $this->emailOTPs = new EmailOTPService( // @phpstan-ignore-next-line new EmailOTPApi($this->client, $this->createGeneratedConfiguration()) ); diff --git a/src/Services/AuthTokensInterface.php b/src/Services/AuthTokenInterface.php similarity index 88% rename from src/Services/AuthTokensInterface.php rename to src/Services/AuthTokenInterface.php index 3da83b5..c4d0202 100644 --- a/src/Services/AuthTokensInterface.php +++ b/src/Services/AuthTokenInterface.php @@ -5,7 +5,7 @@ use Corbado\Generated\Model\AuthTokenValidateReq; use Corbado\Generated\Model\AuthTokenValidateRsp; -interface AuthTokensInterface +interface AuthTokenInterface { public function validate(AuthTokenValidateReq $req): AuthTokenValidateRsp; } diff --git a/src/Services/AuthTokens.php b/src/Services/AuthTokenService.php similarity index 96% rename from src/Services/AuthTokens.php rename to src/Services/AuthTokenService.php index 765c95f..f366124 100644 --- a/src/Services/AuthTokens.php +++ b/src/Services/AuthTokenService.php @@ -13,7 +13,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class AuthTokens implements AuthTokensInterface +class AuthTokenService implements AuthTokenInterface { private AuthTokensApi $client; diff --git a/src/Services/EmailMagicLinksInterface.php b/src/Services/EmailMagicLinkInterface.php similarity index 91% rename from src/Services/EmailMagicLinksInterface.php rename to src/Services/EmailMagicLinkInterface.php index d6a484a..5b99223 100644 --- a/src/Services/EmailMagicLinksInterface.php +++ b/src/Services/EmailMagicLinkInterface.php @@ -7,7 +7,7 @@ use Corbado\Generated\Model\EmailLinksValidateReq; use Corbado\Generated\Model\EmailLinkValidateRsp; -interface EmailMagicLinksInterface +interface EmailMagicLinkInterface { public function send(EmailLinkSendReq $req): EmailLinkSendRsp; public function validate(string $id, EmailLinksValidateReq $req): EmailLinkValidateRsp; diff --git a/src/Services/EmailMagicLinks.php b/src/Services/EmailMagicLinkService.php similarity index 96% rename from src/Services/EmailMagicLinks.php rename to src/Services/EmailMagicLinkService.php index 5ce4f10..d952332 100644 --- a/src/Services/EmailMagicLinks.php +++ b/src/Services/EmailMagicLinkService.php @@ -15,7 +15,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class EmailMagicLinks implements EmailMagicLinksInterface +class EmailMagicLinkService implements EmailMagicLinkInterface { private EmailMagicLinksApi $client; diff --git a/src/Services/EmailOTPsInterface.php b/src/Services/EmailOTPInterface.php similarity index 93% rename from src/Services/EmailOTPsInterface.php rename to src/Services/EmailOTPInterface.php index 27e3539..e0d6fe4 100644 --- a/src/Services/EmailOTPsInterface.php +++ b/src/Services/EmailOTPInterface.php @@ -7,7 +7,7 @@ use Corbado\Generated\Model\EmailCodeValidateReq; use Corbado\Generated\Model\EmailCodeValidateRsp; -interface EmailOTPsInterface +interface EmailOTPInterface { public function send(EmailCodeSendReq $req): EmailCodeSendRsp; public function validate(string $id, EmailCodeValidateReq $req): EmailCodeValidateRsp; diff --git a/src/Services/EmailOTPs.php b/src/Services/EmailOTPService.php similarity index 97% rename from src/Services/EmailOTPs.php rename to src/Services/EmailOTPService.php index 92b19cf..862259a 100644 --- a/src/Services/EmailOTPs.php +++ b/src/Services/EmailOTPService.php @@ -15,7 +15,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class EmailOTPs implements EmailOTPsInterface +class EmailOTPService implements EmailOTPInterface { private EmailOTPApi $client; diff --git a/src/Services/SmsOTPsInterface.php b/src/Services/SmsOTPInterface.php similarity index 93% rename from src/Services/SmsOTPsInterface.php rename to src/Services/SmsOTPInterface.php index 897b3e4..e2d64fb 100644 --- a/src/Services/SmsOTPsInterface.php +++ b/src/Services/SmsOTPInterface.php @@ -7,7 +7,7 @@ use Corbado\Generated\Model\SmsCodeValidateReq; use Corbado\Generated\Model\SmsCodeValidateRsp; -interface SmsOTPsInterface +interface SmsOTPInterface { public function send(SmsCodeSendReq $req): SmsCodeSendRsp; public function validate(string $id, SmsCodeValidateReq $req): SmsCodeValidateRsp; diff --git a/src/Services/SmsOTPs.php b/src/Services/SmsOTPService.php similarity index 97% rename from src/Services/SmsOTPs.php rename to src/Services/SmsOTPService.php index 474699b..652e46c 100644 --- a/src/Services/SmsOTPs.php +++ b/src/Services/SmsOTPService.php @@ -15,7 +15,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class SmsOTPs implements SmsOTPsInterface +class SmsOTPService implements SmsOTPInterface { private SMSOTPApi $client; diff --git a/src/Services/UsersInterface.php b/src/Services/UserInterface.php similarity index 96% rename from src/Services/UsersInterface.php rename to src/Services/UserInterface.php index ef9b6b4..f61450d 100644 --- a/src/Services/UsersInterface.php +++ b/src/Services/UserInterface.php @@ -9,7 +9,7 @@ use Corbado\Generated\Model\UserGetRsp; use Corbado\Generated\Model\UserListRsp; -interface UsersInterface +interface UserInterface { public function create(UserCreateReq $req): UserCreateRsp; public function delete(string $id, UserDeleteReq $req): GenericRsp; diff --git a/src/Services/Users.php b/src/Services/UserService.php similarity index 98% rename from src/Services/Users.php rename to src/Services/UserService.php index 26067fa..7194974 100644 --- a/src/Services/Users.php +++ b/src/Services/UserService.php @@ -17,7 +17,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class Users implements UsersInterface +class UserService implements UserInterface { private UserApi $client; diff --git a/src/Services/ValidationsInterface.php b/src/Services/ValidationInterface.php similarity index 92% rename from src/Services/ValidationsInterface.php rename to src/Services/ValidationInterface.php index 845f957..f5c40ff 100644 --- a/src/Services/ValidationsInterface.php +++ b/src/Services/ValidationInterface.php @@ -7,7 +7,7 @@ use Corbado\Generated\Model\ValidatePhoneNumberReq; use Corbado\Generated\Model\ValidatePhoneNumberRsp; -interface ValidationsInterface +interface ValidationInterface { public function validateEmail(ValidateEmailReq $req): ValidateEmailRsp; public function validatePhoneNumber(ValidatePhoneNumberReq $req): ValidatePhoneNumberRsp; diff --git a/src/Services/Validations.php b/src/Services/ValidationService.php similarity index 97% rename from src/Services/Validations.php rename to src/Services/ValidationService.php index 8501c22..5c4be8a 100644 --- a/src/Services/Validations.php +++ b/src/Services/ValidationService.php @@ -16,7 +16,7 @@ use Corbado\Helper\Assert; use Corbado\Helper\Helper; -class Validations implements ValidationsInterface +class ValidationService implements ValidationInterface { private ValidationApi $client; From 503001e1959745ef86210a5bf1e16e78733c3e23 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 20:18:12 +0100 Subject: [PATCH 63/81] More renames & movements --- .../User.php => Entities/UserEntity.php} | 4 +-- src/SDK.php | 35 ++++++++++--------- src/Services/SessionInterface.php | 12 +++++++ .../SessionService.php} | 24 +++++++------ .../UserEntityTest.php} | 12 +++---- .../SessionServiceTest.php} | 10 +++--- .../{Classes => Services}/testdata/jwks.json | 0 .../{Classes => Services}/testdata/jwks.md | 0 .../testdata/privateKey.pem | 0 9 files changed, 56 insertions(+), 41 deletions(-) rename src/{Session/User.php => Entities/UserEntity.php} (97%) create mode 100644 src/Services/SessionInterface.php rename src/{Session/Session.php => Services/SessionService.php} (91%) rename tests/unit/{Classes/UserTest.php => Entities/UserEntityTest.php} (71%) rename tests/unit/{Classes/SessionTest.php => Services/SessionServiceTest.php} (97%) rename tests/unit/{Classes => Services}/testdata/jwks.json (100%) rename tests/unit/{Classes => Services}/testdata/jwks.md (100%) rename tests/unit/{Classes => Services}/testdata/privateKey.pem (100%) diff --git a/src/Session/User.php b/src/Entities/UserEntity.php similarity index 97% rename from src/Session/User.php rename to src/Entities/UserEntity.php index da746b8..a7d866d 100644 --- a/src/Session/User.php +++ b/src/Entities/UserEntity.php @@ -1,10 +1,10 @@ session === null) { if ($this->config->getJwksCachePool() === null) { throw new ConfigurationException('No JWKS cache pool set, use Configuration::setJwksCachePool()'); } - $this->session = new Session( + $this->session = new SessionService( $this->client, $this->config->getShortSessionCookieName(), $this->config->getFrontendAPI(), diff --git a/src/Services/SessionInterface.php b/src/Services/SessionInterface.php new file mode 100644 index 0000000..3090189 --- /dev/null +++ b/src/Services/SessionInterface.php @@ -0,0 +1,12 @@ +getShortSessionValue(); if (strlen($value) < 10) { @@ -151,7 +153,7 @@ public function getCurrentUser(): User $phoneNumber = $decoded->phone_number; } - return new User( + return new UserEntity( true, $decoded->sub, $name, @@ -168,7 +170,7 @@ public function getCurrentUser(): User * * @param string $authorizationHeader * @return string - * @throws \Corbado\Exceptions\AssertException + * @throws AssertException */ private function extractBearerToken(string $authorizationHeader): string { diff --git a/tests/unit/Classes/UserTest.php b/tests/unit/Entities/UserEntityTest.php similarity index 71% rename from tests/unit/Classes/UserTest.php rename to tests/unit/Entities/UserEntityTest.php index 564bd7b..890fb33 100644 --- a/tests/unit/Classes/UserTest.php +++ b/tests/unit/Entities/UserEntityTest.php @@ -1,21 +1,21 @@ assertFalse($user->isAuthenticated()); } public function testIsAuthenticated(): void { - $user = new User(true); + $user = new UserEntity(true); $this->assertTrue($user->isAuthenticated()); } @@ -24,7 +24,7 @@ public function testIsAuthenticated(): void */ public function testGetUserData(): void { - $user = new User(true, 'id', 'name', 'email', 'phone-number'); + $user = new UserEntity(true, 'id', 'name', 'email', 'phone-number'); $this->assertEquals('id', $user->getID()); $this->assertEquals('name', $user->getName()); $this->assertEquals('email', $user->getEmail()); diff --git a/tests/unit/Classes/SessionTest.php b/tests/unit/Services/SessionServiceTest.php similarity index 97% rename from tests/unit/Classes/SessionTest.php rename to tests/unit/Services/SessionServiceTest.php index 1a11698..85bbcaa 100644 --- a/tests/unit/Classes/SessionTest.php +++ b/tests/unit/Services/SessionServiceTest.php @@ -1,9 +1,9 @@ Date: Wed, 20 Dec 2023 20:31:32 +0100 Subject: [PATCH 64/81] Renamed integration tests and fixed some bugs --- README.md | 4 ++-- .../EmailOTPSendTest.php} | 8 +++---- .../EmailOTPValidateTest.php} | 8 +++---- .../SmsOTPSendTest.php} | 8 +++---- .../SmsOTPValidateTest.php} | 23 ++++++++++--------- 5 files changed, 26 insertions(+), 25 deletions(-) rename tests/integration/{EmailCode/EmailCodeSendTest.php => EmailOTP/EmailOTPSendTest.php} (85%) rename tests/integration/{SMSCode/SMSCodeValidateTest.php => EmailOTP/EmailOTPValidateTest.php} (84%) rename tests/integration/{SMSCode/SMSCodeSendTest.php => SmsOTP/SmsOTPSendTest.php} (85%) rename tests/integration/{EmailCode/EmailCodeValidateTest.php => SmsOTP/SmsOTPValidateTest.php} (55%) diff --git a/README.md b/README.md index 90a8674..6dcf7fc 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,9 @@ A list of examples can be found in the integration tests [here](tests/integratio The Corbado PHP SDK provides the following services: -- `emailLinks` for managing email links ([examples](tests/integration/EmailLink)) +- `emailMagicLinks` for managing email links ([examples](tests/integration/EmailLink)) - `emailOTPs` for managing email OTPs ([examples](tests/integration/todo)) -- `SMSOTPs` for managing SMS OTPs ([examples](tests/integration/todo)) +- `smsOTPs` for managing SMS OTPs ([examples](tests/integration/todo)) - `sessions` for managing sessions ([examples](tests/integration/todo)) - `users` for managing users ([examples](tests/integration/todo)) - `authTokens` for managing authentication tokens needed for own session management ([examples](tests/integration/todo)) diff --git a/tests/integration/EmailCode/EmailCodeSendTest.php b/tests/integration/EmailOTP/EmailOTPSendTest.php similarity index 85% rename from tests/integration/EmailCode/EmailCodeSendTest.php rename to tests/integration/EmailOTP/EmailOTPSendTest.php index 1425eb7..64bdaf8 100644 --- a/tests/integration/EmailCode/EmailCodeSendTest.php +++ b/tests/integration/EmailOTP/EmailOTPSendTest.php @@ -1,6 +1,6 @@ setEmail(Utils::createRandomTestEmail()); diff --git a/tests/integration/SMSCode/SMSCodeValidateTest.php b/tests/integration/EmailOTP/EmailOTPValidateTest.php similarity index 84% rename from tests/integration/SMSCode/SMSCodeValidateTest.php rename to tests/integration/EmailOTP/EmailOTPValidateTest.php index 3449ca6..209571b 100644 --- a/tests/integration/SMSCode/SMSCodeValidateTest.php +++ b/tests/integration/EmailOTP/EmailOTPValidateTest.php @@ -1,6 +1,6 @@ setPhoneNumber(Utils::createRandomTestPhoneNumber()); diff --git a/tests/integration/EmailCode/EmailCodeValidateTest.php b/tests/integration/SmsOTP/SmsOTPValidateTest.php similarity index 55% rename from tests/integration/EmailCode/EmailCodeValidateTest.php rename to tests/integration/SmsOTP/SmsOTPValidateTest.php index 7cbb608..62a3e83 100644 --- a/tests/integration/EmailCode/EmailCodeValidateTest.php +++ b/tests/integration/SmsOTP/SmsOTPValidateTest.php @@ -1,50 +1,51 @@ setCode(''); + $req = new SmsCodeValidateReq(); + $req->setSmsCode(''); - Utils::SDK()->emailOTPs()->validate('emc-123456789', $req); + Utils::SDK()->smsOTPs()->validate('sms-123456789', $req); } catch (ServerException $e) { $exception = $e; } $this->assertNotNull($exception); - $this->assertEqualsCanonicalizing(['code: cannot be blank'], $exception->getValidationMessages()); + $this->assertEqualsCanonicalizing(['smsCode: cannot be blank'], $exception->getValidationMessages()); } /** * @throws AssertException * @throws ConfigurationException */ - public function testEmailCodeValidateValidationErrorInvalidID(): void + public function testSmsOTPValidateValidationErrorInvalidID(): void { $exception = null; try { - $req = new EmailCodeValidateReq(); - $req->setCode('123456'); + $req = new SmsCodeValidateReq(); + $req->setSmsCode('123456'); - Utils::SDK()->emailOTPs()->validate('emc-123456789', $req); + Utils::SDK()->smsOTPs()->validate('sms-123456789', $req); } catch (ServerException $e) { $exception = $e; } From c39e4fb6169de9483b8148bd89390ca4c0a74174 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 20:39:11 +0100 Subject: [PATCH 65/81] More renames and finalizing README service list example links --- README.md | 14 +++++++------- .../EmailMagicLinkSendTest.php} | 8 ++++---- .../EmailMagicLinkValidateTest.php} | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) rename tests/integration/{EmailLink/EmailLinkSendTest.php => EmailMagicLink/EmailMagicLinkSendTest.php} (85%) rename tests/integration/{EmailLink/EmailLinkValidateTest.php => EmailMagicLink/EmailMagicLinkValidateTest.php} (83%) diff --git a/README.md b/README.md index 6dcf7fc..094e34f 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,13 @@ A list of examples can be found in the integration tests [here](tests/integratio The Corbado PHP SDK provides the following services: -- `emailMagicLinks` for managing email links ([examples](tests/integration/EmailLink)) -- `emailOTPs` for managing email OTPs ([examples](tests/integration/todo)) -- `smsOTPs` for managing SMS OTPs ([examples](tests/integration/todo)) -- `sessions` for managing sessions ([examples](tests/integration/todo)) -- `users` for managing users ([examples](tests/integration/todo)) -- `authTokens` for managing authentication tokens needed for own session management ([examples](tests/integration/todo)) -- `validations` for validating email addresses and phone numbers ([examples](tests/integration/todo)) +- `emailMagicLinks` for managing email links ([examples](tests/integration/EmailMagicLink)) +- `emailOTPs` for managing email OTPs ([examples](tests/integration/EmailOTP)) +- `smsOTPs` for managing SMS OTPs ([examples](tests/integration/SmsOTP)) +- `sessions` for managing sessions +- `users` for managing users ([examples](tests/integration/User)) +- `authTokens` for managing authentication tokens needed for own session management ([examples](tests/integration/AuthToken)) +- `validations` for validating email addresses and phone numbers ([examples](tests/integration/Validation)) To use a specific service, such as `sessions`, invoke it as shown below: diff --git a/tests/integration/EmailLink/EmailLinkSendTest.php b/tests/integration/EmailMagicLink/EmailMagicLinkSendTest.php similarity index 85% rename from tests/integration/EmailLink/EmailLinkSendTest.php rename to tests/integration/EmailMagicLink/EmailMagicLinkSendTest.php index 308ac02..bcabba8 100644 --- a/tests/integration/EmailLink/EmailLinkSendTest.php +++ b/tests/integration/EmailMagicLink/EmailMagicLinkSendTest.php @@ -1,6 +1,6 @@ setEmail(Utils::createRandomTestEmail()); diff --git a/tests/integration/EmailLink/EmailLinkValidateTest.php b/tests/integration/EmailMagicLink/EmailMagicLinkValidateTest.php similarity index 83% rename from tests/integration/EmailLink/EmailLinkValidateTest.php rename to tests/integration/EmailMagicLink/EmailMagicLinkValidateTest.php index 07a31bd..006bf94 100644 --- a/tests/integration/EmailLink/EmailLinkValidateTest.php +++ b/tests/integration/EmailMagicLink/EmailMagicLinkValidateTest.php @@ -1,6 +1,6 @@ Date: Wed, 20 Dec 2023 20:41:11 +0100 Subject: [PATCH 66/81] Wording fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 094e34f..0faeb18 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ A list of examples can be found in the integration tests [here](tests/integratio The Corbado PHP SDK provides the following services: -- `emailMagicLinks` for managing email links ([examples](tests/integration/EmailMagicLink)) +- `emailMagicLinks` for managing email magic links ([examples](tests/integration/EmailMagicLink)) - `emailOTPs` for managing email OTPs ([examples](tests/integration/EmailOTP)) - `smsOTPs` for managing SMS OTPs ([examples](tests/integration/SmsOTP)) - `sessions` for managing sessions From 42799b957ae218ba9527200869442057eabd12c2 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 20 Dec 2023 20:42:56 +0100 Subject: [PATCH 67/81] CS fixes --- src/Services/SessionInterface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Services/SessionInterface.php b/src/Services/SessionInterface.php index 3090189..b58b4d9 100644 --- a/src/Services/SessionInterface.php +++ b/src/Services/SessionInterface.php @@ -1,6 +1,7 @@ Date: Thu, 21 Dec 2023 08:53:47 +0100 Subject: [PATCH 68/81] Added more integration tests --- README.md | 2 +- .../AuthToken/AuthTokenValidateTest.php | 36 +++++++++++++++++++ .../EmailOTP/EmailOTPValidateTest.php | 21 +++++++++++ .../integration/SmsOTP/SmsOTPValidateTest.php | 21 +++++++++++ tests/integration/Utils.php | 2 +- 5 files changed, 80 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0faeb18..be63422 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ composer require corbado/php-sdk ### Usage -To create a Corbado PHP SDK instance you need to provide your `project ID` and `API secret` which can be found at the [Developer Panel](https://app.corbado.com). +To create a Corbado PHP SDK instance you need to provide your `Project ID` and `API secret` which can be found at the [Developer Panel](https://app.corbado.com). ```PHP $config = new Corbado\Configuration("", ""); diff --git a/tests/integration/AuthToken/AuthTokenValidateTest.php b/tests/integration/AuthToken/AuthTokenValidateTest.php index a13c203..48a584c 100644 --- a/tests/integration/AuthToken/AuthTokenValidateTest.php +++ b/tests/integration/AuthToken/AuthTokenValidateTest.php @@ -33,4 +33,40 @@ public function testAuthTokenValidateValidationErrorEmptyToken(): void $this->assertNotNull($exception); $this->assertEqualsCanonicalizing(['token: cannot be blank'], $exception->getValidationMessages()); } + + public function testAuthTokenValidateValidationErrorInvalidToken(): void + { + $exception = null; + + try { + $req = new AuthTokenValidateReq(); + $req->setToken('x'); + $req->setClientInfo(SDK::createClientInfo('124.0.0.1', 'IntegrationTest')); + + Utils::SDK()->authTokens()->validate($req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEqualsCanonicalizing(['token: the length must be exactly 64'], $exception->getValidationMessages()); + } + + public function testAuthTokenValidateValidationErrorNotExistingToken(): void + { + $exception = null; + + try { + $req = new AuthTokenValidateReq(); + $req->setToken(Utils::generateString(64)); + $req->setClientInfo(SDK::createClientInfo('124.0.0.1', 'IntegrationTest')); + + Utils::SDK()->authTokens()->validate($req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEquals(404, $exception->getHttpStatusCode()); + } } diff --git a/tests/integration/EmailOTP/EmailOTPValidateTest.php b/tests/integration/EmailOTP/EmailOTPValidateTest.php index 209571b..45e9272 100644 --- a/tests/integration/EmailOTP/EmailOTPValidateTest.php +++ b/tests/integration/EmailOTP/EmailOTPValidateTest.php @@ -32,6 +32,27 @@ public function testEmailOTPValidateValidationErrorEmptyCode(): void $this->assertEqualsCanonicalizing(['code: cannot be blank'], $exception->getValidationMessages()); } + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testEmailOTPValidateValidationErrorInvalidCode(): void + { + $exception = null; + + try { + $req = new EmailCodeValidateReq(); + $req->setCode('1'); + + Utils::SDK()->emailOTPs()->validate('emc-123456789', $req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEqualsCanonicalizing(['code: the length must be exactly 6'], $exception->getValidationMessages()); + } + /** * @throws AssertException * @throws ConfigurationException diff --git a/tests/integration/SmsOTP/SmsOTPValidateTest.php b/tests/integration/SmsOTP/SmsOTPValidateTest.php index 62a3e83..cc246e4 100644 --- a/tests/integration/SmsOTP/SmsOTPValidateTest.php +++ b/tests/integration/SmsOTP/SmsOTPValidateTest.php @@ -33,6 +33,27 @@ public function testSmsOTPValidateValidationErrorEmptyCode(): void $this->assertEqualsCanonicalizing(['smsCode: cannot be blank'], $exception->getValidationMessages()); } + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testSmsOTPValidateValidationErrorInvalidCode(): void + { + $exception = null; + + try { + $req = new SmsCodeValidateReq(); + $req->setSmsCode('1'); + + Utils::SDK()->smsOTPs()->validate('sms-123456789', $req); + } catch (ServerException $e) { + $exception = $e; + } + + $this->assertNotNull($exception); + $this->assertEqualsCanonicalizing(['smsCode: the length must be exactly 6'], $exception->getValidationMessages()); + } + /** * @throws AssertException * @throws ConfigurationException diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index 4a60102..bddbfc6 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -37,7 +37,7 @@ private static function getEnv(string $key): string return $value; } - private static function generateString(int $length): string + public static function generateString(int $length): string { // Removed I, 1, 0 and O because of risk of confusion $characters = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijklmnopwrstuvwxyz23456789'; From eaf1f513dab69646dc81d3ceee16a6df91bf2da3 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Thu, 21 Dec 2023 08:56:34 +0100 Subject: [PATCH 69/81] Github action testing --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f283ff..a50cab8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,8 +3,8 @@ name: Build workflow on: push: branches: '*' - pull_request: - branches: '*' + #pull_request: + # branches: '*' jobs: build: From 7089841eaf7e6c3ce7ebd023b7ac8ec29f982cf4 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:56:27 +0100 Subject: [PATCH 70/81] Workflow changes --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a50cab8..3a4bb6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,8 +3,6 @@ name: Build workflow on: push: branches: '*' - #pull_request: - # branches: '*' jobs: build: From 844d378b74f38665b2f0549685bc53408318627d Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 31 Dec 2023 08:10:36 +0100 Subject: [PATCH 71/81] Restructured GitHub action workflow! --- .github/workflows/ci.yml | 26 +++++++++++ .github/workflows/ci_analyze.yml | 44 +++++++++++++++++++ .github/workflows/ci_cs_check.yml | 44 +++++++++++++++++++ .../{build.yml => ci_integrationtests.yml} | 27 ++++-------- .github/workflows/ci_unittests.yml | 44 +++++++++++++++++++ tests/integration/Utils.php | 4 +- 6 files changed, 168 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/ci_analyze.yml create mode 100644 .github/workflows/ci_cs_check.yml rename .github/workflows/{build.yml => ci_integrationtests.yml} (73%) create mode 100644 .github/workflows/ci_unittests.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6c413ab --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: tests + +on: + push: + branches: '*' + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + unittests: + uses: "./.github/workflows/ci_unittests.yml" + secrets: inherit + + integrationtests: + uses: "./.github/workflows/ci_integrationtests.yml" + secrets: inherit + + analyze: + uses: "./.github/workflows/ci_analyze.yml" + secrets: inherit + + cs-check: + uses: "./.github/workflows/ci_cs_check.yml" + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/ci_analyze.yml b/.github/workflows/ci_analyze.yml new file mode 100644 index 0000000..8f86a4f --- /dev/null +++ b/.github/workflows/ci_analyze.yml @@ -0,0 +1,44 @@ +name: analyze + +on: + workflow_call: + +jobs: + analyze: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: + - '8.0' + - '8.1' + - '8.2' + - '8.3' + + steps: + - uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - name: Check PHP version + run: php -v + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run analyze + run: composer analyze \ No newline at end of file diff --git a/.github/workflows/ci_cs_check.yml b/.github/workflows/ci_cs_check.yml new file mode 100644 index 0000000..b39d65b --- /dev/null +++ b/.github/workflows/ci_cs_check.yml @@ -0,0 +1,44 @@ +name: cs-check + +on: + workflow_call: + +jobs: + cs-check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: + - '8.0' + - '8.1' + - '8.2' + - '8.3' + + steps: + - uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - name: Check PHP version + run: php -v + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run cs check + run: composer cs-check \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/ci_integrationtests.yml similarity index 73% rename from .github/workflows/build.yml rename to .github/workflows/ci_integrationtests.yml index 3a4bb6d..abab0e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci_integrationtests.yml @@ -1,32 +1,30 @@ -name: Build workflow +name: integrationtests on: - push: - branches: '*' + workflow_call: jobs: - build: - name: Build + integrationtests: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: php: - '8.0' - '8.1' - '8.2' + - '8.3' steps: - - name: Set up PHP - uses: shivammathur/setup-php@v2 + - uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - name: Check PHP version run: php -v - - name: Checkout code - uses: actions/checkout@v3 - - name: Validate composer.json and composer.lock run: composer validate --strict @@ -42,15 +40,6 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress - - name: Run analyze - run: composer analyze - - - name: Run cs check - run: composer cs-check - - - name: Run unit tests - run: composer unittests - - name: Run integration tests env: CORBADO_BACKEND_API: ${{ secrets.CORBADO_BACKEND_API }} diff --git a/.github/workflows/ci_unittests.yml b/.github/workflows/ci_unittests.yml new file mode 100644 index 0000000..8a2de69 --- /dev/null +++ b/.github/workflows/ci_unittests.yml @@ -0,0 +1,44 @@ +name: unittests + +on: + workflow_call: + +jobs: + unittests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: + - '8.0' + - '8.1' + - '8.2' + - '8.3' + + steps: + - uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - name: Check PHP version + run: php -v + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run unit tests + run: composer unittests \ No newline at end of file diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index bddbfc6..ebb214e 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -71,12 +71,12 @@ public static function createRandomTestName(): string public static function createRandomTestEmail(): string { - return self::generateString(10) . '@test.de'; + return 'integration-test-' . self::generateString(10) . '@corbado.com'; } public static function createRandomTestPhoneNumber(): string { - return '+49' . self::generateNumber(13); + return '+491509' . self::generateNumber(7); } /** From f3e9c90740842c36fc8552f4f316e8ff26828711 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 31 Dec 2023 08:13:53 +0100 Subject: [PATCH 72/81] Fixed (hopefully) test badge in README --- README.md | 2 +- tests/integration/EmailOTP/EmailOTPSendTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index be63422..0caa6e8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![License](https://poser.pugx.org/corbado/php-sdk/license.svg)](https://packagist.org/packages/corbado/php-sdk) [![Latest Stable Version](http://poser.pugx.org/corbado/php-sdk/v)](https://packagist.org/packages/corbado/php-sdk) -[![Test Status](https://github.com/corbado/corbado-php/actions/workflows/build.yml/badge.svg)](https://github.com/corbado/corbado-php/actions) +[![Test Status](https://github.com/corbado/corbado-php/workflows/tests/badge.svg)](https://github.com/corbado/corbado-php/actions?query=workflow%3Atests) [![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://api.corbado.com/docs/api/) [![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://join.slack.com/t/corbado/shared_invite/zt-1b7867yz8-V~Xr~ngmSGbt7IA~g16ZsQ) diff --git a/tests/integration/EmailOTP/EmailOTPSendTest.php b/tests/integration/EmailOTP/EmailOTPSendTest.php index 64bdaf8..2ea6871 100644 --- a/tests/integration/EmailOTP/EmailOTPSendTest.php +++ b/tests/integration/EmailOTP/EmailOTPSendTest.php @@ -28,7 +28,7 @@ public function testEmailOTPSendValidationError(): void $exception = $e; } - $this->assertNotNull($exception); + $this->assertNull($exception); $this->assertEqualsCanonicalizing(['email: cannot be blank'], $exception->getValidationMessages()); } From a43782d9928c0a645a1007c01ff5d39a16c732ca Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 31 Dec 2023 08:18:27 +0100 Subject: [PATCH 73/81] Fixed (hopefully) test badge in README --- tests/integration/EmailOTP/EmailOTPSendTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/EmailOTP/EmailOTPSendTest.php b/tests/integration/EmailOTP/EmailOTPSendTest.php index 2ea6871..64bdaf8 100644 --- a/tests/integration/EmailOTP/EmailOTPSendTest.php +++ b/tests/integration/EmailOTP/EmailOTPSendTest.php @@ -28,7 +28,7 @@ public function testEmailOTPSendValidationError(): void $exception = $e; } - $this->assertNull($exception); + $this->assertNotNull($exception); $this->assertEqualsCanonicalizing(['email: cannot be blank'], $exception->getValidationMessages()); } From 730a4b9a9e036b1a2c31ccd55024a334f33e2427 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 31 Dec 2023 08:27:41 +0100 Subject: [PATCH 74/81] Added integration tests for email OTP validate and sms OTP validate --- .../EmailOTP/EmailOTPValidateTest.php | 20 ++++++++++++++++++ .../integration/SmsOTP/SmsOTPValidateTest.php | 21 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/tests/integration/EmailOTP/EmailOTPValidateTest.php b/tests/integration/EmailOTP/EmailOTPValidateTest.php index 45e9272..ce57447 100644 --- a/tests/integration/EmailOTP/EmailOTPValidateTest.php +++ b/tests/integration/EmailOTP/EmailOTPValidateTest.php @@ -5,6 +5,7 @@ use Corbado\Exceptions\AssertException; use Corbado\Exceptions\ConfigurationException; use Corbado\Exceptions\ServerException; +use Corbado\Generated\Model\EmailCodeSendReq; use Corbado\Generated\Model\EmailCodeValidateReq; use integration\Utils; use PHPUnit\Framework\TestCase; @@ -73,4 +74,23 @@ public function testEmailOTPValidateValidationErrorInvalidID(): void $this->assertNotNull($exception); $this->assertEquals(404, $exception->getHttpStatusCode()); } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testEmailOTPValidateSuccess(): void + { + $req = new EmailCodeSendReq(); + $req->setEmail(Utils::createRandomTestEmail()); + $req->setCreate(true); + + $rsp = Utils::SDK()->emailOTPs()->send($req); + $this->assertEquals(200, $rsp->getHttpStatusCode()); + + $req = new EmailCodeValidateReq(); + $req->setCode('150919'); + + Utils::SDK()->emailOTPs()->validate($rsp->getData()->getEmailCodeId(), $req); + } } diff --git a/tests/integration/SmsOTP/SmsOTPValidateTest.php b/tests/integration/SmsOTP/SmsOTPValidateTest.php index cc246e4..4ab2271 100644 --- a/tests/integration/SmsOTP/SmsOTPValidateTest.php +++ b/tests/integration/SmsOTP/SmsOTPValidateTest.php @@ -5,7 +5,9 @@ use Corbado\Exceptions\AssertException; use Corbado\Exceptions\ConfigurationException; use Corbado\Exceptions\ServerException; +use Corbado\Generated\Model\EmailCodeSendReq; use Corbado\Generated\Model\EmailCodeValidateReq; +use Corbado\Generated\Model\SmsCodeSendReq; use Corbado\Generated\Model\SmsCodeValidateReq; use integration\Utils; use PHPUnit\Framework\TestCase; @@ -74,4 +76,23 @@ public function testSmsOTPValidateValidationErrorInvalidID(): void $this->assertNotNull($exception); $this->assertEquals(404, $exception->getHttpStatusCode()); } + + /** + * @throws AssertException + * @throws ConfigurationException + */ + public function testSmsOTPValidateSuccess(): void + { + $req = new SmsCodeSendReq(); + $req->setPhoneNumber(Utils::createRandomTestPhoneNumber()); + $req->setCreate(true); + + $rsp = Utils::SDK()->smsOTPs()->send($req); + $this->assertEquals(200, $rsp->getHttpStatusCode()); + + $req = new SmsCodeValidateReq(); + $req->setSmsCode('150919'); + + Utils::SDK()->smsOTPs()->validate($rsp->getData()->getSmsCodeId(), $req); + } } From 10c1f7ef22d175563525739573bca4248c42edcf Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Mon, 1 Jan 2024 08:35:33 +0100 Subject: [PATCH 75/81] Renamed Configuration to Config, sorted services alphabetically --- README.md | 8 +- src/{Configuration.php => Config.php} | 20 +-- src/Exceptions/ConfigException.php | 7 + src/Exceptions/ConfigurationException.php | 7 - src/SDK.php | 140 +++++++++--------- .../AuthToken/AuthTokenValidateTest.php | 4 +- .../EmailMagicLink/EmailMagicLinkSendTest.php | 6 +- .../EmailMagicLinkValidateTest.php | 6 +- .../integration/EmailOTP/EmailOTPSendTest.php | 6 +- .../EmailOTP/EmailOTPValidateTest.php | 10 +- tests/integration/SmsOTP/SmsOTPSendTest.php | 6 +- .../integration/SmsOTP/SmsOTPValidateTest.php | 10 +- tests/integration/User/UserCreateTest.php | 6 +- tests/integration/User/UserDeleteTest.php | 6 +- tests/integration/User/UserGetTest.php | 6 +- tests/integration/User/UserListTest.php | 6 +- tests/integration/Utils.php | 10 +- .../Validation/ValidateEmailTest.php | 6 +- .../Validation/ValidatePhoneNumberTest.php | 6 +- tests/unit/ConfigurationTest.php | 8 +- 20 files changed, 143 insertions(+), 141 deletions(-) rename src/{Configuration.php => Config.php} (87%) create mode 100644 src/Exceptions/ConfigException.php delete mode 100644 src/Exceptions/ConfigurationException.php diff --git a/README.md b/README.md index 0caa6e8..b2f0e1b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ composer require corbado/php-sdk To create a Corbado PHP SDK instance you need to provide your `Project ID` and `API secret` which can be found at the [Developer Panel](https://app.corbado.com). ```PHP -$config = new Corbado\Configuration("", ""); +$config = new Corbado\Config("", ""); $sdk = new Corbado\SDK($config); ``` @@ -44,12 +44,12 @@ A list of examples can be found in the integration tests [here](tests/integratio The Corbado PHP SDK provides the following services: +- `authTokens` for managing authentication tokens needed for own session management ([examples](tests/integration/AuthToken)) - `emailMagicLinks` for managing email magic links ([examples](tests/integration/EmailMagicLink)) - `emailOTPs` for managing email OTPs ([examples](tests/integration/EmailOTP)) -- `smsOTPs` for managing SMS OTPs ([examples](tests/integration/SmsOTP)) - `sessions` for managing sessions +- `smsOTPs` for managing SMS OTPs ([examples](tests/integration/SmsOTP)) - `users` for managing users ([examples](tests/integration/User)) -- `authTokens` for managing authentication tokens needed for own session management ([examples](tests/integration/AuthToken)) - `validations` for validating email addresses and phone numbers ([examples](tests/integration/Validation)) To use a specific service, such as `sessions`, invoke it as shown below: @@ -65,7 +65,7 @@ $user = $sdk->sessions()->getCurrentUser(); The Corbado PHP SDK throws exceptions for all errors. The following exceptions are thrown: - `AssertException` for failed assertions (client side) -- `ConfigurationException` for configuration errors (client side) +- `ConfigException` for configuration errors (client side) - `ServerException` for server errors (server side) - `StandardException` for everything else (client side) diff --git a/src/Configuration.php b/src/Config.php similarity index 87% rename from src/Configuration.php rename to src/Config.php index 0dc5342..01b2335 100644 --- a/src/Configuration.php +++ b/src/Config.php @@ -2,11 +2,13 @@ namespace Corbado; +use Corbado\Exceptions\AssertException; +use Corbado\Exceptions\ConfigException; use Corbado\Helper\Assert; use Psr\Cache\CacheItemPoolInterface; use Psr\Http\Client\ClientInterface; -class Configuration +class Config { private string $projectID = ''; private string $apiSecret = ''; @@ -23,19 +25,19 @@ class Configuration * passed via the constructor. All other options can be set via * setters. * - * @throws \Corbado\Exceptions\AssertException - * @throws \Corbado\Exceptions\ConfigurationException + * @throws AssertException + * @throws ConfigException */ public function __construct(string $projectID, string $apiSecret = '') { Assert::stringNotEmpty($projectID); if (!str_starts_with($projectID, 'pro-')) { - throw new Exceptions\ConfigurationException('Invalid project ID "' . $projectID . '" given, needs to start with "pro-"'); + throw new Exceptions\ConfigException('Invalid project ID "' . $projectID . '" given, needs to start with "pro-"'); } if ($apiSecret !== '' && !str_starts_with($apiSecret, 'corbado1_')) { - throw new Exceptions\ConfigurationException('Invalid API secret "' . $apiSecret . '" given, needs to start with "corbado1_"'); + throw new Exceptions\ConfigException('Invalid API secret "' . $apiSecret . '" given, needs to start with "corbado1_"'); } $this->projectID = $projectID; @@ -43,7 +45,7 @@ public function __construct(string $projectID, string $apiSecret = '') } /** - * @throws \Corbado\Exceptions\AssertException + * @throws AssertException */ public function setFrontendAPI(string $frontendAPI): self { @@ -55,7 +57,7 @@ public function setFrontendAPI(string $frontendAPI): self } /** - * @throws \Corbado\Exceptions\AssertException + * @throws AssertException */ public function setBackendAPI(string $backendAPI): self { @@ -67,7 +69,7 @@ public function setBackendAPI(string $backendAPI): self } /** - * @throws \Corbado\Exceptions\AssertException + * @throws AssertException */ public function setShortSessionCookieName(string $shortSessionCookieName): self { @@ -147,7 +149,7 @@ public function getJwksCachePool(): ?CacheItemPoolInterface } /** - * @throws \Corbado\Exceptions\AssertException + * @throws AssertException */ private function assertURL(string $url): void { diff --git a/src/Exceptions/ConfigException.php b/src/Exceptions/ConfigException.php new file mode 100644 index 0000000..7e59853 --- /dev/null +++ b/src/Exceptions/ConfigException.php @@ -0,0 +1,7 @@ +config = $config; @@ -68,86 +68,66 @@ public function __construct(Configuration $config) } /** - * Returns email magic link handling - * - * @return EmailMagicLinkInterface - * @throws AssertException - * @throws ConfigurationException - */ - public function emailMagicLinks(): EmailMagicLinkInterface - { - if ($this->emailMagicLinks === null) { - $this->emailMagicLinks = new EmailMagicLinkService( - // @phpstan-ignore-next-line - new EmailMagicLinksApi($this->client, $this->createGeneratedConfiguration()) - ); - } - - return $this->emailMagicLinks; - } - - /** - * Returns SMS OTP handling + * Returns auth token handling * - * @return SmsOTPInterface + * @return AuthTokenInterface + * @throws ConfigException * @throws AssertException - * @throws ConfigurationException */ - public function smsOTPs(): SmsOTPInterface + public function authTokens(): AuthTokenInterface { - if ($this->smsOTPs === null) { - $this->smsOTPs = new SmsOTPService( + if ($this->authTokens === null) { + $this->authTokens = new AuthTokenService( // @phpstan-ignore-next-line - new SMSOTPApi($this->client, $this->createGeneratedConfiguration()) + new AuthTokensApi($this->client, $this->createGeneratedConfiguration()) ); } - return $this->smsOTPs; + return $this->authTokens; } /** - * Returns validation handling + * Returns email magic link handling * - * @return ValidationInterface + * @return EmailMagicLinkInterface * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ - public function validations(): ValidationInterface + public function emailMagicLinks(): EmailMagicLinkInterface { - if ($this->validations === null) { - $this->validations = new ValidationService( + if ($this->emailMagicLinks === null) { + $this->emailMagicLinks = new EmailMagicLinkService( // @phpstan-ignore-next-line - new ValidationApi($this->client, $this->createGeneratedConfiguration()) + new EmailMagicLinksApi($this->client, $this->createGeneratedConfiguration()) ); } - return $this->validations; + return $this->emailMagicLinks; } /** - * Returns user handling + * Returns email OTP handling * - * @return UserInterface * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ - public function users(): UserInterface + public function emailOTPs(): EmailOTPInterface { - if ($this->users === null) { - $this->users = new UserService( + if ($this->emailOTPs === null) { + $this->emailOTPs = new EmailOTPService( // @phpstan-ignore-next-line - new UserApi($this->client, $this->createGeneratedConfiguration()) + new EmailOTPApi($this->client, $this->createGeneratedConfiguration()) ); } - return $this->users; + return $this->emailOTPs; } /** * Returns session handling * * @return SessionInterface - * @throws ConfigurationException + * @throws ConfigException * @throws AssertException * @link https://docs.corbado.com/sessions/overview */ @@ -155,7 +135,7 @@ public function sessions(): SessionInterface { if ($this->session === null) { if ($this->config->getJwksCachePool() === null) { - throw new ConfigurationException('No JWKS cache pool set, use Configuration::setJwksCachePool()'); + throw new ConfigException('No JWKS cache pool set, use Configuration::setJwksCachePool()'); } $this->session = new SessionService( @@ -171,50 +151,70 @@ public function sessions(): SessionInterface } /** - * Returns auth token handling + * Returns SMS OTP handling * - * @return AuthTokenInterface - * @throws ConfigurationException + * @return SmsOTPInterface * @throws AssertException + * @throws ConfigException */ - public function authTokens(): AuthTokenInterface + public function smsOTPs(): SmsOTPInterface { - if ($this->authTokens === null) { - $this->authTokens = new AuthTokenService( + if ($this->smsOTPs === null) { + $this->smsOTPs = new SmsOTPService( // @phpstan-ignore-next-line - new AuthTokensApi($this->client, $this->createGeneratedConfiguration()) + new SMSOTPApi($this->client, $this->createGeneratedConfiguration()) ); } - return $this->authTokens; + return $this->smsOTPs; } /** - * Returns email OTP handling + * Returns user handling + * + * @return UserInterface + * @throws AssertException + * @throws ConfigException + */ + public function users(): UserInterface + { + if ($this->users === null) { + $this->users = new UserService( + // @phpstan-ignore-next-line + new UserApi($this->client, $this->createGeneratedConfiguration()) + ); + } + + return $this->users; + } + + /** + * Returns validation handling * + * @return ValidationInterface * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ - public function emailOTPs(): EmailOTPInterface + public function validations(): ValidationInterface { - if ($this->emailOTPs === null) { - $this->emailOTPs = new EmailOTPService( + if ($this->validations === null) { + $this->validations = new ValidationService( // @phpstan-ignore-next-line - new EmailOTPApi($this->client, $this->createGeneratedConfiguration()) + new ValidationApi($this->client, $this->createGeneratedConfiguration()) ); } - return $this->emailOTPs; + return $this->validations; } /** * @return Generated\Configuration - * @throws ConfigurationException + * @throws ConfigException */ private function createGeneratedConfiguration(): Generated\Configuration { if ($this->config->getApiSecret() == '') { - throw new Exceptions\ConfigurationException('No API secret set, pass in constructor of configuration'); + throw new Exceptions\ConfigException('No API secret set, pass in constructor of configuration'); } $config = new Generated\Configuration(); diff --git a/tests/integration/AuthToken/AuthTokenValidateTest.php b/tests/integration/AuthToken/AuthTokenValidateTest.php index 48a584c..80beb1d 100644 --- a/tests/integration/AuthToken/AuthTokenValidateTest.php +++ b/tests/integration/AuthToken/AuthTokenValidateTest.php @@ -3,7 +3,7 @@ namespace integration\AuthToken; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\AuthTokenValidateReq; use Corbado\SDK; @@ -14,7 +14,7 @@ class AuthTokenValidateTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testAuthTokenValidateValidationErrorEmptyToken(): void { diff --git a/tests/integration/EmailMagicLink/EmailMagicLinkSendTest.php b/tests/integration/EmailMagicLink/EmailMagicLinkSendTest.php index bcabba8..04a763d 100644 --- a/tests/integration/EmailMagicLink/EmailMagicLinkSendTest.php +++ b/tests/integration/EmailMagicLink/EmailMagicLinkSendTest.php @@ -3,7 +3,7 @@ namespace integration\EmailMagicLink; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\EmailLinkSendReq; use integration\Utils; @@ -13,7 +13,7 @@ class EmailMagicLinkSendTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailMagicLinkSendValidationError(): void { @@ -35,7 +35,7 @@ public function testEmailMagicLinkSendValidationError(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailMagicLinkSendSuccess(): void { diff --git a/tests/integration/EmailMagicLink/EmailMagicLinkValidateTest.php b/tests/integration/EmailMagicLink/EmailMagicLinkValidateTest.php index 006bf94..392ab5a 100644 --- a/tests/integration/EmailMagicLink/EmailMagicLinkValidateTest.php +++ b/tests/integration/EmailMagicLink/EmailMagicLinkValidateTest.php @@ -3,7 +3,7 @@ namespace integration\EmailMagicLink; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\EmailLinksValidateReq; use integration\Utils; @@ -13,7 +13,7 @@ class EmailMagicLinkValidateTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailMagicLinkValidateValidationErrorEmptyToken(): void { @@ -34,7 +34,7 @@ public function testEmailMagicLinkValidateValidationErrorEmptyToken(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailMagicLinkValidateValidationErrorInvalidID(): void { diff --git a/tests/integration/EmailOTP/EmailOTPSendTest.php b/tests/integration/EmailOTP/EmailOTPSendTest.php index 64bdaf8..20b2772 100644 --- a/tests/integration/EmailOTP/EmailOTPSendTest.php +++ b/tests/integration/EmailOTP/EmailOTPSendTest.php @@ -3,7 +3,7 @@ namespace integration\EmailOTP; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\EmailCodeSendReq; use integration\Utils; @@ -13,7 +13,7 @@ class EmailOTPSendTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailOTPSendValidationError(): void { @@ -34,7 +34,7 @@ public function testEmailOTPSendValidationError(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailOTPSendSuccess(): void { diff --git a/tests/integration/EmailOTP/EmailOTPValidateTest.php b/tests/integration/EmailOTP/EmailOTPValidateTest.php index ce57447..a27a6e8 100644 --- a/tests/integration/EmailOTP/EmailOTPValidateTest.php +++ b/tests/integration/EmailOTP/EmailOTPValidateTest.php @@ -3,7 +3,7 @@ namespace integration\EmailOTP; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\EmailCodeSendReq; use Corbado\Generated\Model\EmailCodeValidateReq; @@ -14,7 +14,7 @@ class EmailOTPValidateTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailOTPValidateValidationErrorEmptyCode(): void { @@ -35,7 +35,7 @@ public function testEmailOTPValidateValidationErrorEmptyCode(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailOTPValidateValidationErrorInvalidCode(): void { @@ -56,7 +56,7 @@ public function testEmailOTPValidateValidationErrorInvalidCode(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailOTPValidateValidationErrorInvalidID(): void { @@ -77,7 +77,7 @@ public function testEmailOTPValidateValidationErrorInvalidID(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testEmailOTPValidateSuccess(): void { diff --git a/tests/integration/SmsOTP/SmsOTPSendTest.php b/tests/integration/SmsOTP/SmsOTPSendTest.php index ccd4b2c..6d2327c 100644 --- a/tests/integration/SmsOTP/SmsOTPSendTest.php +++ b/tests/integration/SmsOTP/SmsOTPSendTest.php @@ -3,7 +3,7 @@ namespace integration\SmsOTP; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\SmsCodeSendReq; use integration\Utils; @@ -13,7 +13,7 @@ class SmsOTPSendTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testSmsOTPSendValidationError(): void { @@ -34,7 +34,7 @@ public function testSmsOTPSendValidationError(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testSmsOTPSendSuccess(): void { diff --git a/tests/integration/SmsOTP/SmsOTPValidateTest.php b/tests/integration/SmsOTP/SmsOTPValidateTest.php index 4ab2271..23c09d8 100644 --- a/tests/integration/SmsOTP/SmsOTPValidateTest.php +++ b/tests/integration/SmsOTP/SmsOTPValidateTest.php @@ -3,7 +3,7 @@ namespace integration\SmsOTP; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\EmailCodeSendReq; use Corbado\Generated\Model\EmailCodeValidateReq; @@ -16,7 +16,7 @@ class SmsOTPValidateTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testSmsOTPValidateValidationErrorEmptyCode(): void { @@ -37,7 +37,7 @@ public function testSmsOTPValidateValidationErrorEmptyCode(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testSmsOTPValidateValidationErrorInvalidCode(): void { @@ -58,7 +58,7 @@ public function testSmsOTPValidateValidationErrorInvalidCode(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testSmsOTPValidateValidationErrorInvalidID(): void { @@ -79,7 +79,7 @@ public function testSmsOTPValidateValidationErrorInvalidID(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testSmsOTPValidateSuccess(): void { diff --git a/tests/integration/User/UserCreateTest.php b/tests/integration/User/UserCreateTest.php index 0c8eed5..aedf8c1 100644 --- a/tests/integration/User/UserCreateTest.php +++ b/tests/integration/User/UserCreateTest.php @@ -3,7 +3,7 @@ namespace integration\User; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\UserCreateReq; use integration\Utils; @@ -13,7 +13,7 @@ class UserCreateTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testUserCreateValidationError(): void { @@ -36,7 +36,7 @@ public function testUserCreateValidationError(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testUserCreateSuccess(): void { diff --git a/tests/integration/User/UserDeleteTest.php b/tests/integration/User/UserDeleteTest.php index a5efb94..a06a8cb 100644 --- a/tests/integration/User/UserDeleteTest.php +++ b/tests/integration/User/UserDeleteTest.php @@ -3,7 +3,7 @@ namespace integration\User; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\UserDeleteReq; use integration\Utils; @@ -13,7 +13,7 @@ class UserDeleteTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testUserDeleteNotFound(): void { @@ -32,7 +32,7 @@ public function testUserDeleteNotFound(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testUserDeleteSuccess(): void { diff --git a/tests/integration/User/UserGetTest.php b/tests/integration/User/UserGetTest.php index 89a38d3..19255eb 100644 --- a/tests/integration/User/UserGetTest.php +++ b/tests/integration/User/UserGetTest.php @@ -3,7 +3,7 @@ namespace integration\User; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use integration\Utils; use PHPUnit\Framework\TestCase; @@ -12,7 +12,7 @@ class UserGetTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testUserGetNotFound(): void { @@ -30,7 +30,7 @@ public function testUserGetNotFound(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testUserGetSuccess(): void { diff --git a/tests/integration/User/UserListTest.php b/tests/integration/User/UserListTest.php index 8d65c01..6884ca5 100644 --- a/tests/integration/User/UserListTest.php +++ b/tests/integration/User/UserListTest.php @@ -3,7 +3,7 @@ namespace integration\User; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use integration\Utils; use PHPUnit\Framework\TestCase; @@ -12,7 +12,7 @@ class UserListTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testUserListValidationError(): void { @@ -31,7 +31,7 @@ public function testUserListValidationError(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testUserListSuccess(): void { diff --git a/tests/integration/Utils.php b/tests/integration/Utils.php index ebb214e..02b11dd 100644 --- a/tests/integration/Utils.php +++ b/tests/integration/Utils.php @@ -2,9 +2,9 @@ namespace integration; -use Corbado\Configuration; +use Corbado\Config; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Generated\Model\UserCreateReq; use Corbado\SDK; use Exception; @@ -13,12 +13,12 @@ class Utils { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException * @throws Exception */ public static function SDK(): SDK { - $config = new Configuration(self::getEnv('CORBADO_PROJECT_ID'), self::getEnv('CORBADO_API_SECRET')); + $config = new Config(self::getEnv('CORBADO_PROJECT_ID'), self::getEnv('CORBADO_API_SECRET')); $config->setBackendAPI(self::getEnv('CORBADO_BACKEND_API')); return new SDK($config); @@ -81,7 +81,7 @@ public static function createRandomTestPhoneNumber(): string /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public static function createUser(): string { diff --git a/tests/integration/Validation/ValidateEmailTest.php b/tests/integration/Validation/ValidateEmailTest.php index 420aaee..57708f5 100644 --- a/tests/integration/Validation/ValidateEmailTest.php +++ b/tests/integration/Validation/ValidateEmailTest.php @@ -3,7 +3,7 @@ namespace integration\Validation; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\ValidateEmailReq; use integration\Utils; @@ -13,7 +13,7 @@ class ValidateEmailTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testValidateEmailValidationError(): void { @@ -35,7 +35,7 @@ public function testValidateEmailValidationError(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testValidateEmailSuccess(): void { diff --git a/tests/integration/Validation/ValidatePhoneNumberTest.php b/tests/integration/Validation/ValidatePhoneNumberTest.php index dea9c09..0ca5cbe 100644 --- a/tests/integration/Validation/ValidatePhoneNumberTest.php +++ b/tests/integration/Validation/ValidatePhoneNumberTest.php @@ -3,7 +3,7 @@ namespace integration\Validation; use Corbado\Exceptions\AssertException; -use Corbado\Exceptions\ConfigurationException; +use Corbado\Exceptions\ConfigException; use Corbado\Exceptions\ServerException; use Corbado\Generated\Model\ValidatePhoneNumberReq; use integration\Utils; @@ -13,7 +13,7 @@ class ValidatePhoneNumberTest extends TestCase { /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testValidatePhoneNumberValidationError(): void { @@ -35,7 +35,7 @@ public function testValidatePhoneNumberValidationError(): void /** * @throws AssertException - * @throws ConfigurationException + * @throws ConfigException */ public function testValidatePhoneNumberSuccess(): void { diff --git a/tests/unit/ConfigurationTest.php b/tests/unit/ConfigurationTest.php index 9fda2a5..2eaf427 100644 --- a/tests/unit/ConfigurationTest.php +++ b/tests/unit/ConfigurationTest.php @@ -2,7 +2,7 @@ namespace unit; -use Corbado\Configuration; +use Corbado\Config; use PHPUnit\Framework\TestCase; use Throwable; @@ -17,7 +17,7 @@ class ConfigurationTest extends TestCase public function testSetFrontendAPI(string $frontendAPI, bool $valid): void { try { - $config = new Configuration('pro-123', 'corbado1_123'); + $config = new Config('pro-123', 'corbado1_123'); $config->setFrontendAPI($frontendAPI); $error = false; } catch (Throwable) { @@ -36,7 +36,7 @@ public function testSetFrontendAPI(string $frontendAPI, bool $valid): void public function testSetBackendAPI(string $backendAPI, bool $valid): void { try { - $config = new Configuration('pro-123', 'corbado1_123'); + $config = new Config('pro-123', 'corbado1_123'); $config->setBackendAPI($backendAPI); $error = false; } catch (Throwable) { @@ -48,7 +48,7 @@ public function testSetBackendAPI(string $backendAPI, bool $valid): void public function testGetFrontendAPI(): void { - $config = new Configuration('pro-123', 'corbado1_123'); + $config = new Config('pro-123', 'corbado1_123'); $this->assertEquals('https://pro-123.frontendapi.corbado.io', $config->getFrontendAPI()); } From 25b563da7124e4dca3debfa9cd6135156ea990e7 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:31:52 +0100 Subject: [PATCH 76/81] Updated X-Corbado-SDK header --- src/SDK.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SDK.php b/src/SDK.php index 537861e..a421f20 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -58,11 +58,13 @@ public function __construct(Config $config) 'base_uri' => $this->config->getBackendAPI(), 'http_errors' => false, 'auth' => [$this->config->getProjectID(), $this->config->getApiSecret()], - 'headers' => ['X-Corbado-SDK-Version' => 'PHP SDK ' . self::VERSION], + 'headers' => ['X-Corbado-SDK' => json_encode( + ['name' => 'PHP SDK', 'sdkVersion' => self::VERSION, 'languageVersion' => PHP_VERSION] + )] ] ); } else { - // SDK version might be missing, okay for now (auth needs to be set) + // SDK information might be missing, okay for now (auth needs to be set) $this->client = $this->config->getHttpClient(); } } From 94bf2c0583af42819ce6710819dfd901dadd9972 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Wed, 3 Jan 2024 08:48:31 +0100 Subject: [PATCH 77/81] Update Config.php --- src/Config.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Config.php b/src/Config.php index 01b2335..a94c373 100644 --- a/src/Config.php +++ b/src/Config.php @@ -155,6 +155,8 @@ private function assertURL(string $url): void { Assert::stringNotEmpty($url); + // @todo Add url value to exceptions + $parts = parse_url($url); if ($parts === false) { throw new Exceptions\AssertException('Assert failed: parse_url() returned error'); From 5155e80e674c7151722bf08eb3dd199fbc82a4a8 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 7 Jan 2024 07:20:46 +0100 Subject: [PATCH 78/81] Updated composer.json --- composer.json | 6 +++--- tests/unit/{ConfigurationTest.php => ConfigTest.php} | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename tests/unit/{ConfigurationTest.php => ConfigTest.php} (97%) diff --git a/composer.json b/composer.json index 09a8f54..3d96e0e 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,11 @@ { "name": "corbado/php-sdk", "description": "Add passkeys to your PHP application with the Corbado PHP SDK.", - "homepage": "https://www.corbado.com", + "homepage": "https://www.corbado.com/passkeys/php", "authors": [ { - "name": "Tobias Albrecht", - "email": "tobias.albrecht@corbado.com" + "name": "Vincent Delitz", + "email": "vincent.delitz@corbado.com" } ], "license": "MIT", diff --git a/tests/unit/ConfigurationTest.php b/tests/unit/ConfigTest.php similarity index 97% rename from tests/unit/ConfigurationTest.php rename to tests/unit/ConfigTest.php index 2eaf427..e2cd51d 100644 --- a/tests/unit/ConfigurationTest.php +++ b/tests/unit/ConfigTest.php @@ -6,7 +6,7 @@ use PHPUnit\Framework\TestCase; use Throwable; -class ConfigurationTest extends TestCase +class ConfigTest extends TestCase { /** * @dataProvider provideURLs From 6c3f268e4b8edc9ac7330f369e173645c06ce281 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Thu, 11 Jan 2024 19:56:32 +0100 Subject: [PATCH 79/81] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b2f0e1b..823e653 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. +:warning: The PHP SDK is commonly referred to as a private client, specifically designed for usage within closed backend applications. This particular SDK should exclusively be utilized in such environments, as it is crucial to ensure that the API secret remains strictly confidential and is never shared. + :rocket: [Getting started](#rocket-getting-started) | :hammer_and_wrench: [Services](#hammer_and_wrench-services) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support & Feedback](#speech_balloon-support--feedback) ## :rocket: Getting started From 3836617cd4ff7279000545902aa8e60b27483647 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Fri, 12 Jan 2024 06:29:21 +0100 Subject: [PATCH 80/81] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 823e653..794e7f5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The [Corbado](https://www.corbado.com) PHP SDK provides convenient access to the [Corbado Backend API](https://api.corbado.com/docs/api/) from applications written in the PHP language. -:warning: The PHP SDK is commonly referred to as a private client, specifically designed for usage within closed backend applications. This particular SDK should exclusively be utilized in such environments, as it is crucial to ensure that the API secret remains strictly confidential and is never shared. +:warning: The Corbado PHP SDK is commonly referred to as a private client, specifically designed for usage within closed backend applications. This particular SDK should exclusively be utilized in such environments, as it is crucial to ensure that the API secret remains strictly confidential and is never shared. :rocket: [Getting started](#rocket-getting-started) | :hammer_and_wrench: [Services](#hammer_and_wrench-services) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support & Feedback](#speech_balloon-support--feedback) From 6a320ac802bc340506187d7d8590d69040a5b6d3 Mon Sep 17 00:00:00 2001 From: Corbadoman <100508310+corbadoman@users.noreply.github.com> Date: Sun, 14 Jan 2024 09:39:13 +0100 Subject: [PATCH 81/81] Set version --- src/SDK.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SDK.php b/src/SDK.php index a421f20..719028c 100644 --- a/src/SDK.php +++ b/src/SDK.php @@ -41,7 +41,7 @@ class SDK private ?UserInterface $users = null; private ?ValidationInterface $validations = null; - public const VERSION = '1.0.0'; + public const VERSION = '3.0.0'; /** * Constructor