codemp-proto 0.8.0

protocol definitions for codemp -- code multiplexer
Documentation
syntax = "proto2";

package session;

import "common.proto";

// Manages user workspaces and refreshes tokens.
service Session {
	// Attach to a session and receive events.
	rpc Attach (common.Empty) returns (stream SessionEvent);
	// Handle a workspace access request and return a workspace token.
	rpc AccessWorkspace (WorkspaceRequest) returns (common.Token);
	// Create a workspace.
	rpc CreateWorkspace (OwnedWorkspaceRequest) returns (common.WorkspaceInfo);
	// Delete a workspace.
	rpc DeleteWorkspace (OwnedWorkspaceRequest) returns (common.Empty);
	// List all workspaces the user has been invited to.
	rpc FetchInvitedWorkspaces (common.Empty) returns (WorkspacesInvitedList);
	//List all workspaces the user owns.
	rpc FetchOwnedWorkspaces (common.Empty) returns (WorkspacesOwnedList);
	// Handle a workspace invite request.
	rpc InviteToWorkspace (InviteRequest) returns (common.Empty);
}

// A message representing a request for an owned workspace.
message OwnedWorkspaceRequest {
	// The workspace's name.
	required string name = 1;
}

// A message representing a request for a specific workspace.
message WorkspaceRequest {
	required common.Identifier id = 1;
}

// A message representing a list of workspaces.
message WorkspacesInvitedList {
	// A vector of workspaces the user is invited to.
	repeated common.WorkspaceInfo invited = 1;
}

// A message representing a list of workspaces.
message WorkspacesOwnedList {
	// A vector of workspaces owned by the user.
	repeated common.WorkspaceInfo owned = 1;
}

// A message representing an invitation to a workspace.
message InviteRequest {
	// The user the invitation is for.
	required string user = 1;
	// The workspace the invitation is for.
	required common.Identifier workspace = 2;
}

// A message representing a session event.
message SessionEvent {
	// Event that occurs when you get invited to a workspace.
	message InvitationEvent {
		// The user that invited you.
		required common.User user = 1;
		// The workspace the invitation is for.
		required common.WorkspaceInfo workspace = 2;
	}
	// Event that occurs when a user quits a workspace.
	message QuitEvent {
		// The user that quits.
		required common.User user = 1;
		// The workspace the user quit.
		required common.WorkspaceInfo workspace = 2;
	}
	// Event that occurs when an user accepts an invite to a workspace you are in.
	message AcceptEvent {
		// The user that accepted the invite.
		required common.User user = 1;
		// The workspace the user accepted the invite for.
		required common.WorkspaceInfo workspace = 2;
	}
	// Event that occurs when an user rejects an invite.
	message RejectEvent {
		// The user that rejected the invite.
		required common.User user = 1;
		// The workspace the invitation was for.
		required common.WorkspaceInfo workspace = 2;
	}
	oneof event {
		InvitationEvent invite = 1;
		QuitEvent leave = 2;
		AcceptEvent join = 3;
		RejectEvent reject = 4;
	}
}