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

66 lines
2.4 KiB
Protocol Buffer
Raw Permalink Normal View History

2024-08-09 15:22:54 +07:00
syntax = "proto3";
package subreddits.v1;
import "subreddits/v1/count.proto";
2024-08-09 15:22:54 +07:00
import "subreddits/v1/create.proto";
import "subreddits/v1/delete.proto";
import "subreddits/v1/exist.proto";
2024-08-09 15:22:54 +07:00
import "subreddits/v1/get.proto";
import "subreddits/v1/list.proto";
import "subreddits/v1/resolve.proto";
import "subreddits/v1/update.proto";
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);
// SubredditExists checks if the subreddits already handled in database.
//
// THIS ENDPOINT DOES NOT CALL REDDIT API, ONLY DATABASE.
//
// Use ResolveSubredditName to check if subreddit actually exists in Reddit.
rpc SubredditExists(SubredditExistsRequest) returns (SubredditExistsResponse);
2024-08-09 15:22:54 +07:00
}