# Packages
No description provided by the author
# Constants
UserRecordLastLoginAtKey is the key for the time when the user last logged in.
# Structs
AssetUploadHandler models the handler for asset upload request.
AssetUploadResponse models the response of asset upload request.
AuthResponse is the unify way of returing a AuthInfo with AuthData to SDK.
No description provided by the author
ChangePasswordHandler change the current user password
ChangePasswordHandler receives three parameters:
* old_password (string, required) * password (string, required)
If user is not logged in, an 404 not found will return.
DeviceRegisterHandler creates or updates a device and associates it to a user
Example to create a new device:
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "device:register", "access_token": "some-access-token", "type": "ios", "topic": "io.skygear.sample.topic", "device_token": "some-device-token" } EOF
Example to update an existing device:
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "device:register", "access_token": "some-access-token", "id": "existing-device-id", "type": "ios", "device_token": "new-device-token" } EOF
.
DeviceReigsterResult is the result put onto response.Result on successful call of DeviceRegisterHandler.
DeviceUnregisterHandler removes user id from a device
Example to unregister a device:
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "device:unregister", "access_token": "some-access-token", "type": "ios", "device_token": "some-device-token" } EOF
.
No description provided by the author
GetFileHandler models the handler for getting asset file.
No description provided by the author
HomeHandler temp landing.
LinkProviderHandler connect user with provider information
LinkProviderHandler receives parameters:
* provider (string, required) * principal_id (string, required) * user_id (string, required) * token_response (json object, optional) * provider_profile (json object, optional)
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "sso:oauth:link", "provider": "facebook", "principal_id": "104174434987489953648", "user_id": "c0959b6b-15ea-4e21-8afb-9c8308ad79db", "token_response": { "access_token": "access_token" }, "provider_profile": { "id": "104174434987489953648", "email": "[email protected]" } } EOF Response { "result": "OK" }.
LoginHandler authenticate user with password
The user can be either identified by username or password.
No description provided by the author
LogoutHandler receives an access token and invalidates it.
MeHandler handles the me request.
No description provided by the author
No description provided by the author
No description provided by the author
QueryParser is a context for parsing raw query to skydb.Query.
RecordDeleteHandler is dummy implementation on delete Records
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/ <<EOF
{
"action": "record:delete",
"access_token": "validToken",
"database_id": "_private",
"ids": ["note/EA6A3E68-90F3-49B5-B470-5FFDB7A0D4E8"]
}
EOF
*/.
RecordFetchHandler is dummy implementation on fetching Records
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/ <<EOF
{
"action": "record:fetch",
"access_token": "validToken",
"database_id": "_private",
"ids": ["note/1004", "note/1005"]
}
EOF
*/.
RecordQueryHandler is dummy implementation on fetching Records
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/ <<EOF
{
"action": "record:query",
"access_token": "validToken",
"database_id": "_private",
"record_type": "note",
"sort": [
[{"$val": "noteOrder", "$type": "desc"}, "asc"]
]
}
EOF
*/.
RecordSaveHandler is dummy implementation on save/modify Records
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/ <<EOF
{
"action": "record:save",
"access_token": "validToken",
"database_id": "_public",
"records": [{
"_id": "note/EA6A3E68-90F3-49B5-B470-5FFDB7A0D4E8",
"content": "ewdsa",
"_access": [{
"role": "admin",
"level": "write"
}]
}]
}
EOF
Save with reference
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/ <<EOF
{
"action": "record:save",
"database_id": "_public",
"access_token": "986bee3b-8dd9-45c2-b40c-8b6ef274cf12",
"records": [
{
"collection": {
"$type": "ref",
"$id": "collection/10"
},
"noteOrder": 1,
"content": "hi",
"_id": "note/71BAE736-E9C5-43CB-ADD1-D8633B80CAFA",
"_type": "record",
"_access": [{
"role": "admin",
"level": "write"
}]
}
]
}
EOF
*/.
RelationAddHandler add current user relation curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "relation:add", "access_token": "ACCESS_TOKEN", "name": "follow", "targets": [ "1001", "1002" ] } EOF
{ "request_id": "REQUEST_ID", "result": [ { "id": "1001", "type": "user", "data": { "_type": "record", "_id": "1001", "_access": null, "username": "user1001", "email": "[email protected]" } }, { "id": "1002", "type": "error", "data": { "type": "ResourceFetchFailure", "code": 101, "message": "failed to fetch user id = 1002" } } ] }.
RelationQueryHandler query user from current users' relation curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "relation:query", "access_token": "ACCESS_TOKEN", "name": "follow", "direction": "outward" "limit": 2 "offset": 0 } EOF
{ "request_id": "REQUEST_ID", "result": [ { "id": "1001", "type": "user", "data": { "_type": "record", "_id": "user/1001", "_access": null, "username": "user1001", "email": "[email protected]" } }, { "id": "1002", "type": "user", "data": { "_type": "record", "_id": "1002", "_access": null, "username": "user1002", "email": "[email protected]" } } ], "info": { "count": 2 } }.
RelationRemoveHandler remove a users' relation to other users curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "relation:remove", "access_token": "ACCESS_TOKEN", "name": "follow", "targets": [ "1001", "1002" ] } EOF.
ResetPasswordHandler resets the current user password
ResetPasswordHandler receives two parameter:
* auth_id (string, required) * password (string, required)
If user is not logged in, an 404 not found will return.
RoleAdminHandler enable system administrator to set which roles can perform administrative action, like change others user role.
RoleAssignHandler allow system administractor to batch assign roles to users
RoleAssignHandler required user with admin role.
RoleDefaultHandler enable system administrator to set default user role curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "role:default", "master_key": "MASTER_KEY", "access_token": "ACCESS_TOKEN", "roles": [ "writer", "user" ] } EOF
{ "result": [ "writer", "user" ] }.
RoleGetHandler returns roles of users specified by user IDs.
RoleRevokeHandler allow system administractor to batch revoke roles from users
RoleRevokeHandler required user with admin role.
SchemaAccessHandler handles the update of creation access of record
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/schema/access <<EOF
{
"master_key": "MASTER_KEY",
"action": "schema:access",
"type": "note",
"create_roles": [
"admin",
"writer"
]
}
EOF
*/.
SchemaCreateHandler handles the action of creating new columns
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/schema/create <<EOF
{
"master_key": "MASTER_KEY",
"action": "schema:create",
"record_types":{
"student": {
"fields":[
{"name": "age", "type": "number"},
{"name": "nickname" "type": "string"}
]
}
}
}
EOF
*/.
SchemaDefaultAccessHandler handles the update of creation access of record
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/schema/default_access <<EOF
{
"master_key": "MASTER_KEY",
"action": "schema:default_access",
"type": "note",
"default_access": [
{"public": true, "level": "write"}
]
}
EOF
*/.
SchemaDeleteHandler handles the action of deleting column
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/schema/delete <<EOF
{
"master_key": "MASTER_KEY",
"action": "schema:delete",
"record_type": "student",
"item_name": "score"
}
EOF
*/.
SchemaFetchHandler handles the action of returing information of record schema
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/schema/fetch <<EOF
{
"master_key": "MASTER_KEY",
"action": "schema:fetch"
}
EOF
*/.
SchemaFieldAccessGetHandler fetches the entire Field ACL settings.
SchemaFieldAccessUpdateHandler fetches the entire Field ACL settings.
SchemaRenameHandler handles the action of renaming column
curl -X POST -H "Content-Type: application/json" \
-d @- http://localhost:3000/schema/rename <<EOF
{
"master_key": "MASTER_KEY",
"action": "schema:rename",
"record_type": "student",
"item_type": "field",
"item_name": "score",
"new_name": "exam_score"
}
EOF
*/.
SetDisableUserHandler set disabled flag for the specified user
SetDisableUserHandler receives these parameters:
* auth_id (string, required) * disabled (boolean, required) * message (string, optional) * expiry (date/time, optional)
Current implementation:
``` curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "auth:disable:set", "auth_id": "77FA8BCF-CD6C-4A22-A170-CECC2667654F" } EOF ```
Response: * success response.
SignupHandler creates an AuthInfo with the supplied information.
No description provided by the author
SSOCustomTokenLoginHandler authenticates the user with a custom token
An external server is responsible for generating the custom token which
contains a Principal ID and a signature.
SubscriptionDeleteHandler deletes subscriptions from the specified Database.
SubscriptionFetchAllHandler fetches all subscriptions of a device
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "subscription:fetch_all", "access_token": "ACCESS_TOKEN", "database_id": "_private", "device_id": "DEVICE_ID" } EOF.
SubscriptionFetchHandler fetches subscriptions from the specified Database.
SubscriptionSaveHandler saves one or more subscriptions associate with a database.
UnlinkProviderHandler disconnect user with specific provider
UnlinkProviderHandler receives parameters:
* provider (string, required) * user_id (string, required)
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "sso:oauth:unlink", "provider": "facebook", "user_id": "c0959b6b-15ea-4e21-8afb-9c8308ad79db" } EOF Response { "result": "OK" }.
UploadFileHandler receives and persists a file to be associated by Record.
UserAuthFetcher provides helper functions to fetch AuthInfo and user Record with AuthData in a single structs.