Skip to content

Instantly share code, notes, and snippets.

@spf2
Last active March 25, 2016 22:57
Show Gist options
  • Save spf2/f9dde77e3b42e52ddae0 to your computer and use it in GitHub Desktop.
Save spf2/f9dde77e3b42e52ddae0 to your computer and use it in GitHub Desktop.
syntax = "proto3";
option go_package = "pb";
// Abbreviated information about a user, useful for displaying their name
// or avatar.
message User {
string ident = 1;
string name = 2;
}
message Users {
repeated User users = 1;
}
// A user's detailed information.
// TODO formalize private vs. public fields?
message Profile {
int64 created = 1;
int64 updated = 2;
User user = 3;
string fullname = 4;
string phone = 5;
User invited_by = 6;
}
// Representation of a user to another user.
message Contact {
int64 created = 1;
int64 updated = 2;
User user = 3;
string last_thread_id = 4;
int32 num_threads = 5;
}
// Full information about a Bot.
message Descriptor {
int64 created = 1;
int64 updated = 2;
User bot = 3;
User owner = 4;
string handle = 5;
string description = 6;
string endpoint = 7;
bool forward_events = 8;
bool forward_messages = 9;
}
// A user within a Thread.
message Participant {
User user = 1;
User invited_by = 2;
int64 invited = 3;
int64 joined = 4;
int64 left = 5;
}
// A Topic with Participants which describes a particular chat.
message Thread {
string thread_id = 1;
string topic = 2;
int64 created = 3;
int64 updated = 4;
repeated Participant participants = 5;
User creator = 6;
}
message Message {
int64 created = 1;
User sender = 2;
string text = 3;
repeated MediaItem media_items = 4;
}
message MediaItem {
string url = 1;
}
message Event {
enum EventType {
UNKNOWN = 0;
CREATED = 1;
INVITED = 2;
ADDED = 3;
JOINED = 4;
LEFT = 5;
CHANGED_TOPIC = 6;
REMOVED = 7;
}
EventType type = 1;
int64 created = 2;
repeated User users = 3;
}
message Form {
string form_id = 1;
User agent = 2; // The agent to whom to return the form
string action = 3; // Interpreted by the agent on submit
string thread_id = 4;
string label = 5;
repeated FormItem items = 6;
int64 created = 7;
string submit_label = 8; // Label displayed after form is submitted.
}
message FormItem {
oneof element {
FormInput input = 1;
FormSelect select = 2;
}
bool skipped = 3; // Item was intentionally skipped.
}
message FormInput {
enum FormInputType {
UNKNOWN = 0;
NAME = 1; // A name which is expcted to be new
PHONE = 2; // A phone number
CONTACT = 3; // A contact. Value could be a name (if partial), or ident
DATE = 4; // A calendar day. Value is of form YYYY-MM-DD
}
FormInputType type = 1;
string name = 2;
string label = 3; // overrides name when displaying to user
string value = 4;
}
message FormSelect {
string name = 1;
bool multiple = 2; // whether multiple options can be selected
string label = 3; // overrides "choose from" when displaying to user
repeated FormOption options = 4;
}
message FormOption {
string name = 1;
string value = 2;
bool selected = 3;
}
message RequestHeader {
User user = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment