Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
feat(sites): add first sites protobuf definition
Browse files Browse the repository at this point in the history
  • Loading branch information
horacioh committed Jan 18, 2023
1 parent 3ca9b97 commit efac2b8
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions proto/sites/sites.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
service Sites {
// Creates a new site registry based on a hostname provided
rpc AddSite(AddSiteRequest) returns (Site);

// Deletes a site by its ID.
rpc RemoveSite(RemoveSiteRequest) returns (google.protobuf.Empty);

// Gets a single site if exists.
rpc GetSite(GetSiteRequest) returns (Site);

// Updates a site using granular update operations.
rpc UpdateSite(UpdateSiteRequest) returns (Site);

// List currently stored sites a particular user have writes access
rpc ListSites(ListSitesRequest) returns (ListSitesResponse);
}

// the request receives both the hostname and the invite separate,
// but the UI can decide if we receive a full URL or separate (parse the url in JS)
message AddSiteRequest {

// the site host name
string site_hostname = 1;

// Optional. the invite code generated by the site owner
string site_invite = 2;
}

// possible errors:
// - the host name is invalid (no mintter server)
// - the invite code is invalid
// - you are a nobody (NONE role)

message Site {
// the site host name. it must be unique, so it's safe to use it as the Site ID
string hostname = 1;

// the role of the user in the current site
Role role = 2;

// the public title of a Site
string title = 3;

// the site's public description
string description = 4;

// the editor's account id list. I was thinking on adding a separate list and separate rpc method, but for now it does not really matter much!
repeated string editors = 5;
}

enum Role {
OWNER = 0,
EDITOR = 1,
NONE = 2
}

message RemoveSiteRequest {

// the side id you want to remove from the local node
string site_hostname = 1;
}

message GetSiteRequest {

// the side id you want to get from the local node
string site_hostname = 1;
}

message UpdateSiteRequest {

string site_hostname = 1;

// Optional. the title of a Site
string site_title = 2;

// Optional. the site's description
string site_description = 3;
}

// Response for listing sites.
message ListSitesResponse {
// Sites matching the list request.
// Editors is omitted.
repeated Site sites = 1;

}

0 comments on commit efac2b8

Please sign in to comment.