1
0
Fork 0
mirror of synced 2024-09-30 01:08:13 +13:00

feat: Matej renaming plan

This commit is contained in:
loks0n 2023-11-30 11:35:52 +00:00
parent 88aa4d726c
commit 8ea9706174
13 changed files with 29 additions and 30 deletions

View file

@ -897,8 +897,9 @@ App::delete('/v1/account/identities/:identityId')
return $response->noContent(); return $response->noContent();
}); });
App::post('/v1/account/sessions/magic-url') App::post('/v1/account/tokens/magic-url')
->desc('Create magic URL session') ->alias('/v1/account/sessions/magic-url')
->desc('Create magic URL token')
->groups(['api', 'account']) ->groups(['api', 'account'])
->label('scope', 'sessions') ->label('scope', 'sessions')
->label('auth.type', 'magic-url') ->label('auth.type', 'magic-url')
@ -907,8 +908,8 @@ App::post('/v1/account/sessions/magic-url')
->label('audits.userId', '{response.userId}') ->label('audits.userId', '{response.userId}')
->label('sdk.auth', []) ->label('sdk.auth', [])
->label('sdk.namespace', 'account') ->label('sdk.namespace', 'account')
->label('sdk.method', 'createMagicURLSession') ->label('sdk.method', 'createMagicURLToken')
->label('sdk.description', '/docs/references/account/create-magic-url-session.md') ->label('sdk.description', '/docs/references/account/create-magic-url-token.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TOKEN) ->label('sdk.response.model', Response::MODEL_TOKEN)
@ -1111,10 +1112,11 @@ App::post('/v1/account/sessions/magic-url')
; ;
}); });
App::put('/v1/account/sessions/custom') App::put('/v1/account/sessions/token')
->alias('/v1/account/sessions/magic-url') ->alias('/v1/account/sessions/magic-url')
->alias('/v1/account/sessions/phone') ->alias('/v1/account/sessions/phone')
->desc('Update custom session') ->desc('Exchange token for session')
->label('event', 'users.[userId].sessions.[sessionId].create')
->groups(['api', 'account']) ->groups(['api', 'account'])
->label('scope', 'sessions') ->label('scope', 'sessions')
->label('auth.type', 'token') ->label('auth.type', 'token')
@ -1124,8 +1126,8 @@ App::put('/v1/account/sessions/custom')
->label('usage.metric', 'sessions.{scope}.requests.create') ->label('usage.metric', 'sessions.{scope}.requests.create')
->label('sdk.auth', []) ->label('sdk.auth', [])
->label('sdk.namespace', 'account') ->label('sdk.namespace', 'account')
->label('sdk.method', 'updateSessionToken') ->label('sdk.method', 'exchangeTokenForSession')
->label('sdk.description', '/docs/references/account/update-custom-session.md') ->label('sdk.description', '/docs/references/account/exchange-token-for-session.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_SESSION) ->label('sdk.response.model', Response::MODEL_SESSION)
@ -1237,8 +1239,9 @@ App::put('/v1/account/sessions/custom')
$response->dynamic($session, Response::MODEL_SESSION); $response->dynamic($session, Response::MODEL_SESSION);
}); });
App::post('/v1/account/sessions/phone') App::post('/v1/account/tokens/phone')
->desc('Create phone session') ->alias('/v1/account/sessions/phone')
->desc('Create phone token')
->groups(['api', 'account']) ->groups(['api', 'account'])
->label('scope', 'sessions') ->label('scope', 'sessions')
->label('auth.type', 'phone') ->label('auth.type', 'phone')
@ -1247,8 +1250,8 @@ App::post('/v1/account/sessions/phone')
->label('audits.userId', '{response.userId}') ->label('audits.userId', '{response.userId}')
->label('sdk.auth', []) ->label('sdk.auth', [])
->label('sdk.namespace', 'account') ->label('sdk.namespace', 'account')
->label('sdk.method', 'createPhoneSession') ->label('sdk.method', 'createPhoneToken')
->label('sdk.description', '/docs/references/account/create-phone-session.md') ->label('sdk.description', '/docs/references/account/create-phone-token.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TOKEN) ->label('sdk.response.model', Response::MODEL_TOKEN)

View file

@ -1081,8 +1081,8 @@ App::patch('/v1/users/:userId/prefs')
$response->dynamic(new Document($prefs), Response::MODEL_PREFERENCES); $response->dynamic(new Document($prefs), Response::MODEL_PREFERENCES);
}); });
App::post('/v1/users/:userId/sessions') App::post('/v1/users/:userId/tokens')
->desc('Create custom session') ->desc('Create token')
->groups(['api', 'users']) ->groups(['api', 'users'])
->label('event', 'users.[userId].tokens.create') ->label('event', 'users.[userId].tokens.create')
->label('scope', 'users.write') ->label('scope', 'users.write')
@ -1091,8 +1091,8 @@ App::post('/v1/users/:userId/sessions')
->label('usage.metric', 'tokens.requests.create') ->label('usage.metric', 'tokens.requests.create')
->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'createCustomSession') ->label('sdk.method', 'createToken')
->label('sdk.description', '/docs/references/users/create-custom-session.md') ->label('sdk.description', '/docs/references/users/create-token.md')
->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TOKEN) ->label('sdk.response.model', Response::MODEL_TOKEN)

View file

@ -1,3 +0,0 @@
Use this endpoint to complete creating the session with the Magic URL. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#createMagicURLSession) endpoint.
Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.

View file

@ -1 +0,0 @@
Use this endpoint to complete creating a session with SMS. Use the **userId** from the [createPhoneSession](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneSession) endpoint and the **secret** received via SMS to successfully update and confirm the phone session.

View file

@ -1936,7 +1936,7 @@ class AccountCustomClientTest extends Scope
/** /**
* Test for SUCCESS * Test for SUCCESS
*/ */
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/phone', array_merge([ $response = $this->client->call(Client::METHOD_POST, '/account/tokens/phone', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -1955,7 +1955,7 @@ class AccountCustomClientTest extends Scope
/** /**
* Test for FAILURE * Test for FAILURE
*/ */
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/phone', array_merge([ $response = $this->client->call(Client::METHOD_POST, '/account/tokens/phone', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -2325,7 +2325,7 @@ class AccountCustomClientTest extends Scope
/** /**
* Test for SUCCESS * Test for SUCCESS
*/ */
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', array_merge([ $response = $this->client->call(Client::METHOD_POST, '/account/tokens/magic-url', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -2363,7 +2363,7 @@ class AccountCustomClientTest extends Scope
/** /**
* Test for FAILURE * Test for FAILURE
*/ */
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', array_merge([ $response = $this->client->call(Client::METHOD_POST, '/account/tokens/magic-url', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -2375,7 +2375,7 @@ class AccountCustomClientTest extends Scope
$this->assertEquals(400, $response['headers']['status-code']); $this->assertEquals(400, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', array_merge([ $response = $this->client->call(Client::METHOD_POST, '/account/tokens/magic-url', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -2387,7 +2387,7 @@ class AccountCustomClientTest extends Scope
$this->assertEquals(400, $response['headers']['status-code']); $this->assertEquals(400, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', array_merge([ $response = $this->client->call(Client::METHOD_POST, '/account/tokens/magic-url', array_merge([
'origin' => 'http://localhost', 'origin' => 'http://localhost',
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],

View file

@ -58,7 +58,7 @@ class AccountCustomServerTest extends Scope
/** /**
* Test for SUCCESS * Test for SUCCESS
*/ */
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', array_merge( $response = $this->client->call(Client::METHOD_POST, '/account/tokens/magic-url', array_merge(
[ [
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'] 'x-appwrite-project' => $this->getProject()['$id']

View file

@ -232,12 +232,12 @@ trait UsersBase
/** /**
* @depends testCreateUser * @depends testCreateUser
*/ */
public function testCreateCustomSession(array $data): void public function testCreateToken(array $data): void
{ {
/** /**
* Test for SUCCESS * Test for SUCCESS
*/ */
$token = $this->client->call(Client::METHOD_POST, '/users/' . $data['userId'] . '/sessions', array_merge([ $token = $this->client->call(Client::METHOD_POST, '/users/' . $data['userId'] . '/tokens', array_merge([
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'expire' => 60, 'expire' => 60,
@ -251,7 +251,7 @@ trait UsersBase
/** /**
* Test for FAILURE * Test for FAILURE
*/ */
$token = $this->client->call(Client::METHOD_POST, '/users/invalid/sessions', array_merge([ $token = $this->client->call(Client::METHOD_POST, '/users/invalid/tokens', array_merge([
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders())); ], $this->getHeaders()));