| @@ 40-52 (lines=13) @@ | ||
| 37 | * @throws GuzzleException |
|
| 38 | * @throws ServerException |
|
| 39 | */ |
|
| 40 | public function registerTenant(string $email, string $password): TenantRegistrationResult |
|
| 41 | { |
|
| 42 | $response = $this->httpClient->request( |
|
| 43 | 'POST', '/tenant', [ |
|
| 44 | 'json' => [ |
|
| 45 | 'email' => $email, |
|
| 46 | 'password' => $password, |
|
| 47 | ], |
|
| 48 | ] |
|
| 49 | ); |
|
| 50 | ||
| 51 | return new TenantRegistrationResult(json_decode($response->getBody()->getContents(), true)); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @param string $email |
|
| @@ 141-155 (lines=15) @@ | ||
| 138 | * @throws GuzzleException |
|
| 139 | * @throws ServerException |
|
| 140 | */ |
|
| 141 | public function createUser(array $data, string $tenantToken): UserRegistrationResult |
|
| 142 | { |
|
| 143 | $response = $this->httpClient->request( |
|
| 144 | 'POST', |
|
| 145 | '/user', |
|
| 146 | [ |
|
| 147 | 'json' => $data, |
|
| 148 | 'headers' => [ |
|
| 149 | 'Authorization' => 'Bearer '.$tenantToken, |
|
| 150 | ], |
|
| 151 | ] |
|
| 152 | ); |
|
| 153 | ||
| 154 | return new UserRegistrationResult(json_decode($response->getBody()->getContents(), true)); |
|
| 155 | } |
|
| 156 | ||
| 157 | /** |
|
| 158 | * @param array $data containing the necessary params |
|