109 lines
2.2 KiB
Protocol Buffer
109 lines
2.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package redditreader;
|
|
|
|
option go_package = "somegit.dev/vikingowl/reddit-reader/proto/redditreader";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
message Post {
|
|
string id = 1;
|
|
string subreddit = 2;
|
|
string title = 3;
|
|
string author = 4;
|
|
string url = 5;
|
|
string self_text = 6;
|
|
int32 score = 7;
|
|
google.protobuf.Timestamp created_utc = 8;
|
|
google.protobuf.Timestamp fetched_at = 9;
|
|
optional double relevance = 10;
|
|
optional string summary = 11;
|
|
bool read = 12;
|
|
bool starred = 13;
|
|
bool dismissed = 14;
|
|
}
|
|
|
|
message StreamRequest {}
|
|
|
|
message ListRequest {
|
|
string subreddit = 1;
|
|
optional bool unread = 2;
|
|
optional bool starred = 3;
|
|
optional bool dismissed = 4;
|
|
int32 limit = 5;
|
|
}
|
|
|
|
message ListResponse {
|
|
repeated Post posts = 1;
|
|
}
|
|
|
|
message UpdateRequest {
|
|
string id = 1;
|
|
optional bool read = 2;
|
|
optional bool starred = 3;
|
|
optional bool dismissed = 4;
|
|
}
|
|
|
|
message FeedbackRequest {
|
|
string post_id = 1;
|
|
int32 vote = 2;
|
|
}
|
|
|
|
message FeedbackResponse {}
|
|
|
|
message SubredditMsg {
|
|
string name = 1;
|
|
bool enabled = 2;
|
|
string poll_sort = 3;
|
|
}
|
|
|
|
message SubredditList {
|
|
repeated SubredditMsg subreddits = 1;
|
|
}
|
|
|
|
message AddSubredditRequest {
|
|
string name = 1;
|
|
string poll_sort = 2;
|
|
}
|
|
|
|
message RemoveRequest {
|
|
string name = 1;
|
|
}
|
|
|
|
message FilterMsg {
|
|
int64 id = 1;
|
|
string subreddit = 2;
|
|
string pattern = 3;
|
|
bool is_regex = 4;
|
|
}
|
|
|
|
message FilterRequest {
|
|
string subreddit = 1;
|
|
repeated FilterMsg filters = 2;
|
|
}
|
|
|
|
message FilterResponse {
|
|
repeated FilterMsg filters = 1;
|
|
}
|
|
|
|
message Empty {}
|
|
|
|
message StatusResponse {
|
|
int64 uptime_seconds = 1;
|
|
string last_poll = 2;
|
|
int32 total_posts = 3;
|
|
int32 unread_posts = 4;
|
|
}
|
|
|
|
service RedditReader {
|
|
rpc StreamPosts(StreamRequest) returns (stream Post);
|
|
rpc ListPosts(ListRequest) returns (ListResponse);
|
|
rpc UpdatePost(UpdateRequest) returns (Post);
|
|
rpc SubmitFeedback(FeedbackRequest) returns (FeedbackResponse);
|
|
rpc ListSubreddits(Empty) returns (SubredditList);
|
|
rpc AddSubreddit(AddSubredditRequest) returns (SubredditMsg);
|
|
rpc RemoveSubreddit(RemoveRequest) returns (Empty);
|
|
rpc UpdateFilters(FilterRequest) returns (FilterResponse);
|
|
rpc Status(Empty) returns (StatusResponse);
|
|
}
|