Documentation ¶
Index ¶
- type AssetUploadHandler
- type AssetUploadResponse
- type AuthResponse
- type DeviceRegisterHandler
- type DeviceReigsterResult
- type GetFileHandler
- type HomeHandler
- type LoginHandler
- type LogoutHandler
- type MeHandler
- type PasswordHandler
- type PubSubHandler
- type PushToDeviceHandler
- type PushToUserHandler
- type QueryParser
- type RecordDeleteHandler
- type RecordFetchHandler
- type RecordQueryHandler
- type RecordSaveHandler
- type RelationAddHandler
- type RelationQueryHandler
- type RelationRemoveHandler
- type RoleAdminHandler
- type RoleDefaultHandler
- type SchemaAccessHandler
- type SchemaCreateHandler
- type SchemaDeleteHandler
- type SchemaFetchHandler
- type SchemaRenameHandler
- type SignupHandler
- type SubscriptionDeleteHandler
- type SubscriptionFetchAllHandler
- type SubscriptionFetchHandler
- type SubscriptionSaveHandler
- type UploadFileHandler
- type UserLinkHandler
- type UserQueryHandler
- type UserUpdateHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetUploadHandler ¶
type AssetUploadHandler struct { AssetStore skyAsset.Store `inject:"AssetStore"` AccessKey router.Processor `preprocessor:"accesskey"` DBConn router.Processor `preprocessor:"dbconn"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
AssetUploadHandler models the handler for asset upload request
func (*AssetUploadHandler) GetPreprocessors ¶
func (h *AssetUploadHandler) GetPreprocessors() []router.Processor
GetPreprocessors returns all pre-processors for the handler
func (*AssetUploadHandler) Handle ¶
func (h *AssetUploadHandler) Handle( payload *router.Payload, response *router.Response, )
Handle is the handling method of the asset upload request
func (*AssetUploadHandler) Setup ¶
func (h *AssetUploadHandler) Setup()
Setup adds injected pre-processors to preprocessors array
type AssetUploadResponse ¶
type AssetUploadResponse struct { PostRequest *skyAsset.PostFileRequest `json:"post-request"` Asset *map[string]interface{} `json:"asset"` }
AssetUploadResponse models the response of asset upload request
type AuthResponse ¶
type AuthResponse struct { UserID string `json:"user_id,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` Roles []string `json:"roles,omitempty"` AccessToken string `json:"access_token,omitempty"` LastLoginAt *time.Time `json:"last_login_at,omitempty"` LastSeenAt *time.Time `json:"last_seen_at,omitempty"` }
AuthResponse is the unify way of returing a UserInfo to SDK
func NewAuthResponse ¶
func NewAuthResponse(info skydb.UserInfo, accessToken string) AuthResponse
type DeviceRegisterHandler ¶
type DeviceRegisterHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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", "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
func (*DeviceRegisterHandler) GetPreprocessors ¶
func (h *DeviceRegisterHandler) GetPreprocessors() []router.Processor
func (*DeviceRegisterHandler) Handle ¶
func (h *DeviceRegisterHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*DeviceRegisterHandler) Setup ¶
func (h *DeviceRegisterHandler) Setup()
type DeviceReigsterResult ¶
type DeviceReigsterResult struct {
ID string `json:"id"`
}
DeviceReigsterResult is the result put onto response.Result on successful call of DeviceRegisterHandler
type GetFileHandler ¶
type GetFileHandler struct { AssetStore skyAsset.Store `inject:"AssetStore"` DBConn router.Processor `preprocessor:"dbconn"` // contains filtered or unexported fields }
GetFileHandler models the handler for getting asset file
func (*GetFileHandler) GetPreprocessors ¶
func (h *GetFileHandler) GetPreprocessors() []router.Processor
GetPreprocessors returns all preprocessors
type HomeHandler ¶
type HomeHandler struct { }
HomeHandler temp landing. FIXME
func (*HomeHandler) GetPreprocessors ¶
func (h *HomeHandler) GetPreprocessors() []router.Processor
func (*HomeHandler) Handle ¶
func (h *HomeHandler) Handle(playload *router.Payload, response *router.Response)
func (*HomeHandler) Setup ¶
func (h *HomeHandler) Setup()
type LoginHandler ¶
type LoginHandler struct { TokenStore authtoken.Store `inject:"TokenStore"` ProviderRegistry *provider.Registry `inject:"ProviderRegistry"` HookRegistry *hook.Registry `inject:"HookRegistry"` AssetStore asset.Store `inject:"AssetStore"` AccessKey router.Processor `preprocessor:"accesskey"` DBConn router.Processor `preprocessor:"dbconn"` InjectPublicDB router.Processor `preprocessor:"inject_public_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
LoginHandler authenticate user with password
The user can be either identified by username or password.
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF
{ "action": "auth:login", "username": "rickmak", "email": "rick.mak@gmail.com", "password": "123456" }
EOF
func (*LoginHandler) GetPreprocessors ¶
func (h *LoginHandler) GetPreprocessors() []router.Processor
func (*LoginHandler) Handle ¶
func (h *LoginHandler) Handle(payload *router.Payload, response *router.Response)
func (*LoginHandler) Setup ¶
func (h *LoginHandler) Setup()
type LogoutHandler ¶
type LogoutHandler struct { TokenStore authtoken.Store `inject:"TokenStore"` Authenticator router.Processor `preprocessor:"authenticator"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
LogoutHandler receives an access token and invalidates it
func (*LogoutHandler) GetPreprocessors ¶
func (h *LogoutHandler) GetPreprocessors() []router.Processor
func (*LogoutHandler) Handle ¶
func (h *LogoutHandler) Handle(payload *router.Payload, response *router.Response)
func (*LogoutHandler) Setup ¶
func (h *LogoutHandler) Setup()
type MeHandler ¶
type MeHandler struct { TokenStore authtoken.Store `inject:"TokenStore"` Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
MeHandler handles the me request
func (*MeHandler) GetPreprocessors ¶
GetPreprocessors returns all pre-processors for the handler
func (*MeHandler) Handle ¶
Handle is the handling method of the me request
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "me" } EOF
{ "user_id": "3df4b52b-bd58-4fa2-8aee-3d44fd7f974d", "username": "user1", "last_login_at": "2016-09-08T06:42:59.871181Z", "last_seen_at": "2016-09-08T07:15:18.026567355Z", "roles": [] }
type PasswordHandler ¶
type PasswordHandler struct { TokenStore authtoken.Store `inject:"TokenStore"` Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
PasswordHandler change the current user password
PasswordHandler receives three parameters:
* old_password (string, required) * password (string, required)
If user is not logged in, an 404 not found will return.
Current implementation curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "auth:password", "old_password": "rick.mak@gmail.com", "password": "123456" } EOF
Response return existing access toektn if not invalidate
TODO: Input accept `user_id` and `invalidate`. If `user_id` is supplied, will check authorization policy and see if existing accept `invalidate` and invaldate all existing access token. Return userInfoID with new AccessToken if the invalidate is true
func (*PasswordHandler) GetPreprocessors ¶
func (h *PasswordHandler) GetPreprocessors() []router.Processor
func (*PasswordHandler) Handle ¶
func (h *PasswordHandler) Handle(payload *router.Payload, response *router.Response)
func (*PasswordHandler) Setup ¶
func (h *PasswordHandler) Setup()
type PubSubHandler ¶
type PubSubHandler struct { WebSocket *pubsub.WsPubSub AccessKey router.Processor `preprocessor:"accesskey"` // contains filtered or unexported fields }
func (*PubSubHandler) GetPreprocessors ¶
func (h *PubSubHandler) GetPreprocessors() []router.Processor
func (*PubSubHandler) Handle ¶
func (h *PubSubHandler) Handle(payload *router.Payload, response *router.Response)
func (*PubSubHandler) Setup ¶
func (h *PubSubHandler) Setup()
type PushToDeviceHandler ¶
type PushToDeviceHandler struct { NotificationSender push.Sender `inject:"PushSender"` AccessKey router.Processor `preprocessor:"accesskey"` DBConn router.Processor `preprocessor:"dbconn"` InjectDB router.Processor `preprocessor:"inject_db"` Notification router.Processor `preprocessor:"notification"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
func (*PushToDeviceHandler) GetPreprocessors ¶
func (h *PushToDeviceHandler) GetPreprocessors() []router.Processor
func (*PushToDeviceHandler) Handle ¶
func (h *PushToDeviceHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*PushToDeviceHandler) Setup ¶
func (h *PushToDeviceHandler) Setup()
type PushToUserHandler ¶
type PushToUserHandler struct { NotificationSender push.Sender `inject:"PushSender"` AccessKey router.Processor `preprocessor:"accesskey"` DBConn router.Processor `preprocessor:"dbconn"` InjectDB router.Processor `preprocessor:"inject_db"` Notification router.Processor `preprocessor:"notification"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
func (*PushToUserHandler) GetPreprocessors ¶
func (h *PushToUserHandler) GetPreprocessors() []router.Processor
func (*PushToUserHandler) Handle ¶
func (h *PushToUserHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*PushToUserHandler) Setup ¶
func (h *PushToUserHandler) Setup()
type QueryParser ¶
type QueryParser struct {
UserID string
}
QueryParser is a context for parsing raw query to skydb.Query
type RecordDeleteHandler ¶
type RecordDeleteHandler struct { HookRegistry *hook.Registry `inject:"HookRegistry"` AccessModel skydb.AccessModel `inject:"AccessModel"` Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*RecordDeleteHandler) GetPreprocessors ¶
func (h *RecordDeleteHandler) GetPreprocessors() []router.Processor
func (*RecordDeleteHandler) Handle ¶
func (h *RecordDeleteHandler) Handle(payload *router.Payload, response *router.Response)
func (*RecordDeleteHandler) Setup ¶
func (h *RecordDeleteHandler) Setup()
type RecordFetchHandler ¶
type RecordFetchHandler struct { AssetStore asset.Store `inject:"AssetStore"` AccessModel skydb.AccessModel `inject:"AccessModel"` Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*RecordFetchHandler) GetPreprocessors ¶
func (h *RecordFetchHandler) GetPreprocessors() []router.Processor
func (*RecordFetchHandler) Handle ¶
func (h *RecordFetchHandler) Handle(payload *router.Payload, response *router.Response)
func (*RecordFetchHandler) Setup ¶
func (h *RecordFetchHandler) Setup()
type RecordQueryHandler ¶
type RecordQueryHandler struct { AssetStore asset.Store `inject:"AssetStore"` AccessModel skydb.AccessModel `inject:"AccessModel"` Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*RecordQueryHandler) GetPreprocessors ¶
func (h *RecordQueryHandler) GetPreprocessors() []router.Processor
func (*RecordQueryHandler) Handle ¶
func (h *RecordQueryHandler) Handle(payload *router.Payload, response *router.Response)
func (*RecordQueryHandler) Setup ¶
func (h *RecordQueryHandler) Setup()
type RecordSaveHandler ¶
type RecordSaveHandler struct { HookRegistry *hook.Registry `inject:"HookRegistry"` AssetStore asset.Store `inject:"AssetStore"` AccessModel skydb.AccessModel `inject:"AccessModel"` EventSender pluginEvent.Sender `inject:"PluginEventSender"` Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*RecordSaveHandler) GetPreprocessors ¶
func (h *RecordSaveHandler) GetPreprocessors() []router.Processor
func (*RecordSaveHandler) Handle ¶
func (h *RecordSaveHandler) Handle(payload *router.Payload, response *router.Response)
func (*RecordSaveHandler) Setup ¶
func (h *RecordSaveHandler) Setup()
type RelationAddHandler ¶
type RelationAddHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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": { "_id": "1001", "username": "user1001", "email": "user1001@skygear.io" } }, { "id": "1002", "type": "error", "data": { "type": "ResourceFetchFailure", "code": 101, "message": "failed to fetch user id = 1002" } } ] }
func (*RelationAddHandler) GetPreprocessors ¶
func (h *RelationAddHandler) GetPreprocessors() []router.Processor
func (*RelationAddHandler) Handle ¶
func (h *RelationAddHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*RelationAddHandler) Setup ¶
func (h *RelationAddHandler) Setup()
type RelationQueryHandler ¶
type RelationQueryHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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": { "_id": "1001", "username": "user1001", "email": "user1001@skygear.io" } }, { "id": "1002", "type": "user", "data": { "_id": "1002", "username": "user1002", "email": "user1001@skygear.io" } } ], "info": { "count": 2 } }
func (*RelationQueryHandler) GetPreprocessors ¶
func (h *RelationQueryHandler) GetPreprocessors() []router.Processor
func (*RelationQueryHandler) Handle ¶
func (h *RelationQueryHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*RelationQueryHandler) Setup ¶
func (h *RelationQueryHandler) Setup()
type RelationRemoveHandler ¶
type RelationRemoveHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*RelationRemoveHandler) GetPreprocessors ¶
func (h *RelationRemoveHandler) GetPreprocessors() []router.Processor
func (*RelationRemoveHandler) Handle ¶
func (h *RelationRemoveHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*RelationRemoveHandler) Setup ¶
func (h *RelationRemoveHandler) Setup()
type RoleAdminHandler ¶
type RoleAdminHandler struct { AccessKey router.Processor `preprocessor:"accesskey"` DevOnly router.Processor `preprocessor:"dev_only"` DBConn router.Processor `preprocessor:"dbconn"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
RoleAdminHandler enable system administrator to set which roles can perform administrative action, like change others 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": [ "admin", "moderator" ] }
EOF
{ "result": [ "admin", "moderator" ] }
func (*RoleAdminHandler) GetPreprocessors ¶
func (h *RoleAdminHandler) GetPreprocessors() []router.Processor
func (*RoleAdminHandler) Handle ¶
func (h *RoleAdminHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*RoleAdminHandler) Setup ¶
func (h *RoleAdminHandler) Setup()
type RoleDefaultHandler ¶
type RoleDefaultHandler struct { AccessKey router.Processor `preprocessor:"accesskey"` DevOnly router.Processor `preprocessor:"dev_only"` DBConn router.Processor `preprocessor:"dbconn"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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" ] }
func (*RoleDefaultHandler) GetPreprocessors ¶
func (h *RoleDefaultHandler) GetPreprocessors() []router.Processor
func (*RoleDefaultHandler) Handle ¶
func (h *RoleDefaultHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*RoleDefaultHandler) Setup ¶
func (h *RoleDefaultHandler) Setup()
type SchemaAccessHandler ¶
type SchemaAccessHandler struct { AccessKey router.Processor `preprocessor:"accesskey"` DevOnly router.Processor `preprocessor:"dev_only"` DBConn router.Processor `preprocessor:"dbconn"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*SchemaAccessHandler) GetPreprocessors ¶
func (h *SchemaAccessHandler) GetPreprocessors() []router.Processor
func (*SchemaAccessHandler) Handle ¶
func (h *SchemaAccessHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SchemaAccessHandler) Setup ¶
func (h *SchemaAccessHandler) Setup()
type SchemaCreateHandler ¶
type SchemaCreateHandler struct { EventSender pluginEvent.Sender `inject:"PluginEventSender"` AccessKey router.Processor `preprocessor:"accesskey"` DevOnly router.Processor `preprocessor:"dev_only"` DBConn router.Processor `preprocessor:"dbconn"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*SchemaCreateHandler) GetPreprocessors ¶
func (h *SchemaCreateHandler) GetPreprocessors() []router.Processor
func (*SchemaCreateHandler) Handle ¶
func (h *SchemaCreateHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SchemaCreateHandler) Setup ¶
func (h *SchemaCreateHandler) Setup()
type SchemaDeleteHandler ¶
type SchemaDeleteHandler struct { EventSender pluginEvent.Sender `inject:"PluginEventSender"` AccessKey router.Processor `preprocessor:"accesskey"` DevOnly router.Processor `preprocessor:"dev_only"` DBConn router.Processor `preprocessor:"dbconn"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*SchemaDeleteHandler) GetPreprocessors ¶
func (h *SchemaDeleteHandler) GetPreprocessors() []router.Processor
func (*SchemaDeleteHandler) Handle ¶
func (h *SchemaDeleteHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SchemaDeleteHandler) Setup ¶
func (h *SchemaDeleteHandler) Setup()
type SchemaFetchHandler ¶
type SchemaFetchHandler struct { AccessKey router.Processor `preprocessor:"accesskey"` DevOnly router.Processor `preprocessor:"dev_only"` DBConn router.Processor `preprocessor:"dbconn"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*SchemaFetchHandler) GetPreprocessors ¶
func (h *SchemaFetchHandler) GetPreprocessors() []router.Processor
func (*SchemaFetchHandler) Handle ¶
func (h *SchemaFetchHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SchemaFetchHandler) Setup ¶
func (h *SchemaFetchHandler) Setup()
type SchemaRenameHandler ¶
type SchemaRenameHandler struct { EventSender pluginEvent.Sender `inject:"PluginEventSender"` AccessKey router.Processor `preprocessor:"accesskey"` DevOnly router.Processor `preprocessor:"dev_only"` DBConn router.Processor `preprocessor:"dbconn"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*SchemaRenameHandler) GetPreprocessors ¶
func (h *SchemaRenameHandler) GetPreprocessors() []router.Processor
func (*SchemaRenameHandler) Handle ¶
func (h *SchemaRenameHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SchemaRenameHandler) Setup ¶
func (h *SchemaRenameHandler) Setup()
type SignupHandler ¶
type SignupHandler struct { TokenStore authtoken.Store `inject:"TokenStore"` ProviderRegistry *provider.Registry `inject:"ProviderRegistry"` HookRegistry *hook.Registry `inject:"HookRegistry"` AssetStore asset.Store `inject:"AssetStore"` AccessModel skydb.AccessModel `inject:"AccessModel"` AccessKey router.Processor `preprocessor:"accesskey"` DBConn router.Processor `preprocessor:"dbconn"` InjectPublicDB router.Processor `preprocessor:"inject_public_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
SignupHandler creates an UserInfo with the supplied information.
SignupHandler receives three parameters:
* username (string, unique, optional) * email (string, unqiue, optional) * password (string, optional)
If both username and email is not supplied, an anonymous user is created and have user_id auto-generated. SignupHandler writes an error to response.Result if the supplied username or email collides with an existing username.
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "auth:signup", "username": "rickmak", "email": "rick.mak@gmail.com", "password": "123456" } EOF
func (*SignupHandler) GetPreprocessors ¶
func (h *SignupHandler) GetPreprocessors() []router.Processor
func (*SignupHandler) Handle ¶
func (h *SignupHandler) Handle(payload *router.Payload, response *router.Response)
func (*SignupHandler) Setup ¶
func (h *SignupHandler) Setup()
type SubscriptionDeleteHandler ¶
type SubscriptionDeleteHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
SubscriptionDeleteHandler deletes subscriptions from the specified Database.
Example curl:
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "subscription:delete", "access_token": "ACCESS_TOKEN", "database_id": "_private", "subscription_ids": ["SUBSCRIPTION_ID"] } EOF
func (*SubscriptionDeleteHandler) GetPreprocessors ¶
func (h *SubscriptionDeleteHandler) GetPreprocessors() []router.Processor
func (*SubscriptionDeleteHandler) Handle ¶
func (h *SubscriptionDeleteHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SubscriptionDeleteHandler) Setup ¶
func (h *SubscriptionDeleteHandler) Setup()
type SubscriptionFetchAllHandler ¶
type SubscriptionFetchAllHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
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
func (*SubscriptionFetchAllHandler) GetPreprocessors ¶
func (h *SubscriptionFetchAllHandler) GetPreprocessors() []router.Processor
func (*SubscriptionFetchAllHandler) Handle ¶
func (h *SubscriptionFetchAllHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SubscriptionFetchAllHandler) Setup ¶
func (h *SubscriptionFetchAllHandler) Setup()
type SubscriptionFetchHandler ¶
type SubscriptionFetchHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
SubscriptionFetchHandler fetches subscriptions from the specified Database.
Example curl:
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "subscription:fetch", "access_token": "ACCESS_TOKEN", "database_id": "_private", "device_id": "DEVICE_ID", "subscription_ids": ["SUBSCRIPTION_ID"] } EOF
func (*SubscriptionFetchHandler) GetPreprocessors ¶
func (h *SubscriptionFetchHandler) GetPreprocessors() []router.Processor
func (*SubscriptionFetchHandler) Handle ¶
func (h *SubscriptionFetchHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SubscriptionFetchHandler) Setup ¶
func (h *SubscriptionFetchHandler) Setup()
type SubscriptionSaveHandler ¶
type SubscriptionSaveHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
SubscriptionSaveHandler saves one or more subscriptions associate with a database.
Example curl:
curl -X POST -H "Content-Type: application/json" \ -d @- http://localhost:3000/ <<EOF { "action": "subscription:save", "access_token": "ACCESS_TOKEN", "database_id": "_private", "device_id": "DEVICE_ID", "subscriptions": [ { "id": "SUBSCRIPTION_ID", "notification_info": { "aps": { "alert": { "body": "BODY_TEXT", "action-loc-key": "ACTION_LOC_KEY", "loc-key": "LOC_KEY", "loc-args": ["LOC_ARGS"], "launch-image": "LAUNCH_IMAGE" }, "sound": "SOUND_NAME", "should-badge": true, "should-send-content-available": true } }, "type": "query", "query": { "record_type": "RECORD_TYPE", "predicate": {} } } ] } EOF
func (*SubscriptionSaveHandler) GetPreprocessors ¶
func (h *SubscriptionSaveHandler) GetPreprocessors() []router.Processor
func (*SubscriptionSaveHandler) Handle ¶
func (h *SubscriptionSaveHandler) Handle(rpayload *router.Payload, response *router.Response)
func (*SubscriptionSaveHandler) Setup ¶
func (h *SubscriptionSaveHandler) Setup()
type UploadFileHandler ¶
type UploadFileHandler struct { AssetStore skyAsset.Store `inject:"AssetStore"` AccessKey router.Processor `preprocessor:"accesskey"` DBConn router.Processor `preprocessor:"dbconn"` // contains filtered or unexported fields }
UploadFileHandler receives and persists a file to be associated by Record.
Example curl (PUT):
curl -XPUT \ -H 'X-Skygear-API-Key: apiKey' \ -H 'Content-Type: text/plain' \ --data-binary '@file.txt' \ http://localhost:3000/files/filename
Example curl (POST):
curl -XPOST \ -H "X-Skygear-API-Key: apiKey" \ -F 'file=@file.txt' \ http://localhost:3000/files/filename
func (*UploadFileHandler) GetPreprocessors ¶
func (h *UploadFileHandler) GetPreprocessors() []router.Processor
GetPreprocessors returns all preprocessors
func (*UploadFileHandler) Handle ¶
func (h *UploadFileHandler) Handle( payload *router.Payload, response *router.Response, )
Handle handles the upload asset request
func (*UploadFileHandler) Setup ¶
func (h *UploadFileHandler) Setup()
Setup sets preprocessors being used
type UserLinkHandler ¶
type UserLinkHandler struct { ProviderRegistry *provider.Registry `inject:"ProviderRegistry"` Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
UserLinkHandler lets user associate third-party accounts with the user, with third-party authentication handled by plugin.
func (*UserLinkHandler) GetPreprocessors ¶
func (h *UserLinkHandler) GetPreprocessors() []router.Processor
func (*UserLinkHandler) Handle ¶
func (h *UserLinkHandler) Handle(payload *router.Payload, response *router.Response)
func (*UserLinkHandler) Setup ¶
func (h *UserLinkHandler) Setup()
type UserQueryHandler ¶
type UserQueryHandler struct { Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
func (*UserQueryHandler) GetPreprocessors ¶
func (h *UserQueryHandler) GetPreprocessors() []router.Processor
func (*UserQueryHandler) Handle ¶
func (h *UserQueryHandler) Handle(payload *router.Payload, response *router.Response)
func (*UserQueryHandler) Setup ¶
func (h *UserQueryHandler) Setup()
type UserUpdateHandler ¶
type UserUpdateHandler struct { AccessModel skydb.AccessModel `inject:"AccessModel"` Authenticator router.Processor `preprocessor:"authenticator"` DBConn router.Processor `preprocessor:"dbconn"` InjectUser router.Processor `preprocessor:"inject_user"` InjectDB router.Processor `preprocessor:"inject_db"` RequireUser router.Processor `preprocessor:"require_user"` PluginReady router.Processor `preprocessor:"plugin_ready"` // contains filtered or unexported fields }
func (*UserUpdateHandler) GetPreprocessors ¶
func (h *UserUpdateHandler) GetPreprocessors() []router.Processor
func (*UserUpdateHandler) Handle ¶
func (h *UserUpdateHandler) Handle(payload *router.Payload, response *router.Response)
func (*UserUpdateHandler) Setup ¶
func (h *UserUpdateHandler) Setup()