Skip to content

Latest commit

 

History

History
293 lines (158 loc) · 4.88 KB

File metadata and controls

293 lines (158 loc) · 4.88 KB

Packets

Connection

Client:connect

Sent upon connection to the server.

  • string? user — the username of the user who last logged into the client, if that user chose to persist the login
  • string? token — the last authentication token the client received from the server, or null if one is not present

Server:connect

Re: Client:connect.

  • UserInfo? user — the client’s current user or null if the client is not logged in
  • string? token — a new login token, if the client is logged in

Server:error

Sent when an internal error occurs on the server.

  • string name — the error name (for example, TypeError)
  • string message — the error message
  • string? stack — the error stack; may not be present

Authentication

Client:auth.signIn

Initiates a sign-in attempt; AuthResult.

  • string user — the username
  • string password — the password

Client:auth.signOut

Initiates a sign-out attempt.

  • string request

Projects

Client:project

Watcher for projects; Project.

  • string request
  • objectId project

Client:project.view

Add a view to the given project.

  • string request
  • objectId project

Client:project.love

Sets whether the current user loves the given project.

  • string request
  • objectId project
  • bool isLoved

Client:project.create

Creates a new empty project and returns the ID; objectId(Project).

  • string request

Client:project.addTag

Adds a tag to a project.

  • string request
  • objectId project
  • string tag

Client:project.removeTag

Removes a tag from a project.

  • string request
  • objectId project
  • string tag

Users

Client:user

Watcher for a user’s profile; User.

  • string request
  • string user

Client:user.info

Basic information about a user; UserInfo.

  • string request
  • string user

Client:user.follow

Sets whether the current user is following the given user.

  • string request
  • string user
  • bool isFollowing

Collections

Client:collection

Watcher for a collection page; Collection.

  • string request
  • objectId collection

Client:collection.projects

Queries the list of projects in a collection; ProjectStub[].

  • string request
  • objectId collection
  • unsigned offset
  • unsigned length

Forums

Client:forumCategories

Queries the categories and forums in the Amber forums; ForumCategory[].

  • string request

Client:forum

Watcher for a forum; Forum.

  • string request
  • objectId forum

Client:forum.topics

Queries the list of topics in a forum; Topic[].

  • string request
  • objectId forum
  • unsigned offset
  • unsigned length

Topics

Client:topic

Watcher for a topic; Topic.

  • string request
  • objectId topicId

Client:topic.create

Creates a new topic; objectId(Topic).

  • string request
  • objectId forum
  • string name — the topic name
  • string body — the post body

Client:topic.posts

Queries the list of posts in a topic; Post[].

  • string request
  • objectId topicId
  • unsigned offset — the index at which to start returning results
  • unsigned length — the number of results to return

Posts

Client:post.create

Posts a message in a topic; objectId(Post).

  • string request
  • objectId result
  • string body

Client:post.edit

Edits a post.

  • string request
  • objectId post
  • string body
  • string? name

Client:post.delete

Deletes a post.

  • string request
  • objectId post

Tags

Client:tag

Watcher for tag pages; Tag.

  • string request
  • string tag$name

Watchers

All arrays are returned as the first 20 items, unless an offset is given, in which case 20 items are returned starting at offset (0-based). Each watch packet returns a unique watch ID which can be used to unwatch the object.

Client:unwatch

  • unsigned watch — the request ID of the initial watch packet

Client:projectCount

Watcher for project count.

  • string request

Constants

Constants are looked up as properties in an object conforming to the Constant interface.

Client:constant

Query a constant value from the server.

  • string request
  • string name

Requests and Updates

Server:result

Re: any client request.

  • string request — the request ID
    • result — the resultant data

Server:requestError

Re: any client request. Sent when an error occurs.

  • string request — the request ID
  • RequestError reason — the error code

Server:watch.update

  • string watch — the request ID for the initial watch packet
  • object data — the data; includes arbitrary values and arrays of ListUpdate tuples

Client:watch.list

  • string watch
  • string request
  • string key
  • unsigned offset
  • unsigned length