Bluemage/schemas/proto/subreddits/v1/subreddits.proto

60 lines
2.2 KiB
Protocol Buffer

syntax = "proto3";
package subreddits.v1;
import "subreddits/v1/count.proto";
import "subreddits/v1/create.proto";
import "subreddits/v1/delete.proto";
import "subreddits/v1/get.proto";
import "subreddits/v1/list.proto";
import "subreddits/v1/resolve.proto";
import "subreddits/v1/update.proto";
option go_package = "github.com/tigorlazuardi/bluemage/go/gen/proto/subreddits/v1";
service SubredditsService {
// CreateSubreddit creates a new subreddit
//
// Returns the subreddit name.
//
// Returns the following error codes:
// - connect.CodeAlreadyExists if subreddit with the same name already exists.
// - connect.CodeInvalidArgument if validation failed, e.g. Invalid schedule cron format.
// - connect.CodeNotFound if the subreddit does not exist.
rpc CreateSubreddit(CreateSubredditRequest) returns (CreateSubredditResponse);
// GetSubreddit returns a subreddit by its name.
//
// Returns error with connect.CodeNotFound if subreddit does not exist.
rpc GetSubreddit(GetSubredditRequest) returns (GetSubredditResponse);
// ListSubreddits returns a list of subreddits.
rpc ListSubreddits(ListSubredditsRequest) returns (ListSubredditsResponse);
// UpdateSubreddit updates a subreddit.
//
// Only the fields that are set in the request will be updated.
//
// Returns error with connect.CodeNotFound if subreddit does not exist.
rpc UpdateSubreddit(UpdateSubredditRequest) returns (UpdateSubredditResponse);
// DeleteSubreddit deletes a subreddit.
//
// Returns error with connect.CodeNotFound if subreddit does not exist.
rpc DeleteSubreddit(DeleteSubredditRequest) returns (DeleteSubredditResponse);
// ResolveSubredditName resolves the given subreddit name.
//
// The returned resolved_name is the name that is actually
// used in Reddit.
//
// Returns error with connect.CodeNotFound if subreddit does not exist.
// So this rpc endpoint also acts to check subreddit's existence.
rpc ResolveSubredditName(ResolveSubredditNameRequest) returns (ResolveSubredditNameResponse);
// Count the existing subreddits using given filter.
//
// Default values count all.
rpc CountSubreddits(CountSubredditsRequest) returns (CountSubredditsResponse);
}