syntax = "proto3";

package rss;

option go_package = "./proto;rss";

service Rss {
	rpc Add(AddRequest) returns (AddResponse) {}
	rpc Remove(RemoveRequest) returns (RemoveResponse) {}
	rpc Feed(FeedRequest) returns (FeedResponse) {}
	rpc List(ListRequest) returns (ListResponse) {}
}

message Feed {
	// unique id
	string id = 1;
	// rss feed name
	// eg. a16z
	string name = 2;
	// rss feed url
	// eg. http://a16z.com/feed/
	string url = 3;
	// category of the feed e.g news
	string category = 4;
}

message Entry {
	// unique id of the entry
	string id = 1;
	// the rss feed where it came from
	string feed = 2;
	// rss feed url of the entry
	string link = 3;
	// title of the entry
	string title = 4;
	// article summary
	string summary = 5;
	// article content
	string content = 6;
	// data of the entry
	string date = 7;
}

// Add a new RSS feed with a name, url, and category
message AddRequest {
	// rss feed name
	// eg. a16z
	string name = 1;
	// rss feed url
	// eg. http://a16z.com/feed/
	string url = 2;
	// category to add e.g news
	string category = 3;
}

message AddResponse {
}

// Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
message FeedRequest {
	// rss feed name
	string name = 1;
	// limit entries returned
	int64 limit = 2;
	// offset entries
	int64 offset = 3;
}

message FeedResponse {
	repeated Entry entries = 1;
}

// List the saved RSS fields
message ListRequest {}

message ListResponse {
	repeated Feed feeds = 1;
}

// Remove an RSS feed by name
message RemoveRequest {
	// rss feed name
	// eg. a16z
	string name = 1;
}

message RemoveResponse {
}

