1
0
Fork 0
mirror of synced 2024-09-28 23:41:23 +12:00

Formatting

This commit is contained in:
Jake Barnby 2022-07-07 19:55:07 +12:00
parent b5e8273839
commit ae32d89a0f
3 changed files with 29 additions and 38 deletions

View file

@ -27,7 +27,7 @@ App::get('/v1/graphql')
->label('sdk.response.model', Response::MODEL_ANY)
->label('abuse-limit', 60)
->label('abuse-time', 60)
->param('query', '', new Text(1024), 'The query to execute. Max 1024 chars.')
->param('query', '', new Text(4096), 'The query to execute. Max 1024 chars.')
->param('operationName', null, new Text(256), 'Name of the operation to execute', true)
->param('variables', [], new JSON(), 'Variables to use in the operation', true)
->inject('request')
@ -52,10 +52,10 @@ App::post('/v1/graphql')
->label('sdk.response.model', Response::MODEL_ANY)
->label('abuse-limit', 60)
->label('abuse-time', 60)
->param('query', '', new Text(1024), 'The query to execute. Max 1024 chars.', true)
->param('query', '', new Text(4096), 'The query to execute. Max 1024 chars.', true)
->param('operationName', null, new Text(256), 'Name of the operation to execute', true)
->param('variables', [], new JSON(), 'Variables to use in the operation', true)
->param('operations', '', new Text(1024), 'Variables to use in the operation', true)
->param('operations', '', new Text(4096), 'Variables to use in the operation', true)
->param('map', '', new Text(1024), 'Variables to use in the operation', true)
->inject('request')
->inject('response')

View file

@ -715,18 +715,18 @@ class Builder
self::reassign($gqlResponse, $apiResponse);
$result = $apiResponse->getPayload();
$payload = $apiResponse->getPayload();
if ($result['$id']) {
$result['_id'] = $result['$id'];
if (\array_key_exists('$id', $payload)) {
$payload['_id'] = $payload['$id'];
}
if ($apiResponse->getStatusCode() < 200 || $apiResponse->getStatusCode() >= 400) {
$reject(new GQLException($result['message'], $apiResponse->getStatusCode()));
$reject(new GQLException($payload['message'], $apiResponse->getStatusCode()));
return;
}
$resolve($result);
$resolve($payload);
}
/**

View file

@ -47,27 +47,6 @@ trait GraphQLBase
public static string $UPDATE_CUSTOM_ENTITY = 'update_custom_entity';
public static string $DELETE_CUSTOM_ENTITY = 'delete_custom_entity';
// Localization
public static string $GET_LOCALE = 'get_locale';
public static string $LIST_COUNTRIES = 'list_countries';
public static string $LIST_EU_COUNTRIES = 'list_eu_countries';
public static string $LIST_COUNTRY_PHONE_CODES = 'list_country_phone_codes';
public static string $LIST_CONTINENTS = 'list_continents';
public static string $LIST_CURRENCIES = 'list_currencies';
public static string $LIST_LANGUAGES = 'list_languages';
// Avatars
public static string $GET_CREDIT_CARD_ICON = 'get_credit_card_icon';
public static string $GET_BROWSER_ICON = 'get_browser_icon';
public static string $GET_COUNTRY_FLAG = 'get_country_flag';
public static string $GET_IMAGE_FROM_URL = 'get_image_from_url';
public static string $GET_FAVICON = 'get_favicon';
public static string $GET_QRCODE = 'get_qrcode';
public static string $GET_USER_INITIALS = 'get_user_initials';
// Projects
public static string $CREATE_API_KEY = 'create_key';
// Account
public static string $CREATE_ACCOUNT = 'create_account';
public static string $CREATE_ACCOUNT_SESSION = 'create_account_session';
@ -94,6 +73,7 @@ trait GraphQLBase
public static string $UPDATE_PHONE_VERIFICATION = 'confirm_phone_verification';
public static string $DELETE_ACCOUNT_SESSION = 'delete_account_session';
public static string $DELETE_ACCOUNT_SESSIONS = 'delete_account_sessions';
// Users
public static string $CREATE_USER = 'create_user';
public static string $GET_USER = 'get_user';
@ -113,6 +93,7 @@ trait GraphQLBase
public static string $DELETE_USER_SESSIONS = 'delete_user_sessions';
public static string $DELETE_USER_SESSION = 'delete_user_session';
public static string $DELETE_USER = 'delete_user';
// Teams
public static string $GET_TEAM = 'get_team';
public static string $GET_TEAMS = 'list_teams';
@ -138,6 +119,7 @@ trait GraphQLBase
public static string $UPDATE_FUNCTION_DEPLOYMENT = 'update_function_deployment';
public static string $DELETE_FUNCTION = 'delete_function';
public static string $DELETE_DEPLOYMENT = 'delete_deployment';
// Executions
public static string $GET_EXECUTIONS = 'list_executions';
public static string $GET_EXECUTION = 'get_execution';
@ -151,6 +133,7 @@ trait GraphQLBase
public static string $GET_BUCKET = 'get_bucket';
public static string $UPDATE_BUCKET = 'update_bucket';
public static string $DELETE_BUCKET = 'delete_bucket';
// Files
public static string $CREATE_FILE = 'create_file';
public static string $GET_FILES = 'list_files';
@ -173,6 +156,23 @@ trait GraphQLBase
public static string $GET_LOCAL_STORAGE_HEALTH = 'get_local_storage_health';
public static string $GET_ANITVIRUS_HEALTH = 'get_antivirus_health';
// Localization
public static string $GET_LOCALE = 'get_locale';
public static string $LIST_COUNTRIES = 'list_countries';
public static string $LIST_EU_COUNTRIES = 'list_eu_countries';
public static string $LIST_COUNTRY_PHONE_CODES = 'list_country_phone_codes';
public static string $LIST_CONTINENTS = 'list_continents';
public static string $LIST_CURRENCIES = 'list_currencies';
public static string $LIST_LANGUAGES = 'list_languages';
// Avatars
public static string $GET_CREDIT_CARD_ICON = 'get_credit_card_icon';
public static string $GET_BROWSER_ICON = 'get_browser_icon';
public static string $GET_COUNTRY_FLAG = 'get_country_flag';
public static string $GET_IMAGE_FROM_URL = 'get_image_from_url';
public static string $GET_FAVICON = 'get_favicon';
public static string $GET_QRCODE = 'get_qrcode';
public static string $GET_USER_INITIALS = 'get_user_initials';
public function getQuery(string $name): string
{
@ -741,15 +741,6 @@ trait GraphQLBase
return 'query getUserInitials($name: String!) {
avatarsGetInitials(name: $name)
}';
case self::$CREATE_API_KEY:
return 'mutation createKey($projectId: String!, $name: String!, $scopes: [String!]!){
projectsCreateKey(projectId: $projectId, name: $name, scopes: $scopes) {
_id
name
scopes
secret
}
}';
case self::$GET_ACCOUNT:
return 'query getAccount {
accountGet {