This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sites): add first sites protobuf definition
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
} |