images: update proto
This commit is contained in:
parent
b472bb2ee8
commit
37ca5f54bc
|
@ -2,6 +2,9 @@ syntax = "proto3";
|
|||
|
||||
package images.v1;
|
||||
|
||||
import "buf/validate/validate.proto";
|
||||
import "images/v1/types.proto";
|
||||
|
||||
option go_package = "github.com/tigorlazuardi/bluemage/go/gen/proto/images/v1";
|
||||
|
||||
service ImageService {
|
||||
|
@ -9,29 +12,53 @@ service ImageService {
|
|||
}
|
||||
|
||||
message RecentlyAddedImagesRequest {
|
||||
int32 limit = 1;
|
||||
option (buf.validate.message).cel = {
|
||||
id: "RecentlyAddedImagesRequest.after_cannot_exist_with_before"
|
||||
message: "after and before cannot be set at the same time"
|
||||
expression: "this.after > 0 && this.before > 0"
|
||||
};
|
||||
// subreddits filter the images to be fetched belonging to the given subreddits.
|
||||
//
|
||||
// If empty, images from all subreddits will be fetched.
|
||||
repeated string subreddits = 1;
|
||||
// devices filter the images to be fetched belonging to the given devices.
|
||||
//
|
||||
// If empty, images from all devices will be fetched.
|
||||
repeated string devices = 2;
|
||||
// limit limits the number of images to be fetched.
|
||||
//
|
||||
// if 0 (or not set), the default limit is 100.
|
||||
//
|
||||
// if set, the maximum limit is clamped to 1000.
|
||||
int64 limit = 3;
|
||||
// after lists the image after the given timestamp.
|
||||
//
|
||||
// using after will return images that are created after the given timestamp.
|
||||
//
|
||||
// cannot be set (value > 0) with before (value > 0).
|
||||
int64 after = 4;
|
||||
// before lists the image before the given timestamp.
|
||||
//
|
||||
// using before will return images that are created before the given timestamp.
|
||||
//
|
||||
// cannot be set (value > 0) with after (value > 0).
|
||||
int64 before = 5;
|
||||
}
|
||||
|
||||
message RecentlyAddedImagesResponse {
|
||||
repeated GetImageResponse images = 1;
|
||||
repeated GroupedByDeviceImages groups = 1;
|
||||
// after is given to the client to be used as after in the next request.
|
||||
//
|
||||
// Given if the request has after value set.
|
||||
optional int64 after = 2;
|
||||
|
||||
// before is given to the client to be used as before in the next request.
|
||||
//
|
||||
// Given if the request has before value set.
|
||||
optional int64 before = 3;
|
||||
}
|
||||
|
||||
message GetImageRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetImageResponse {
|
||||
int32 id = 1;
|
||||
string subreddit = 2;
|
||||
string device = 3;
|
||||
string post_title = 4;
|
||||
string post_url = 5;
|
||||
int64 post_created = 6;
|
||||
string post_author = 7;
|
||||
string post_author_url = 8;
|
||||
string image_relative_path = 9;
|
||||
string image_original_url = 10;
|
||||
uint32 image_height = 11;
|
||||
uint32 image_width = 12;
|
||||
int64 image_size = 13;
|
||||
message GroupedByDeviceImages {
|
||||
string device = 1;
|
||||
repeated Image images = 2;
|
||||
}
|
||||
|
|
21
schemas/proto/images/v1/types.proto
Normal file
21
schemas/proto/images/v1/types.proto
Normal file
|
@ -0,0 +1,21 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package images.v1;
|
||||
|
||||
option go_package = "github.com/tigorlazuardi/bluemage/go/gen/proto/images/v1";
|
||||
|
||||
message Image {
|
||||
int32 id = 1;
|
||||
string subreddit = 2;
|
||||
string device = 3;
|
||||
string post_title = 4;
|
||||
string post_url = 5;
|
||||
int64 post_created = 6;
|
||||
string post_author = 7;
|
||||
string post_author_url = 8;
|
||||
string image_relative_path = 9;
|
||||
string image_original_url = 10;
|
||||
uint32 image_height = 11;
|
||||
uint32 image_width = 12;
|
||||
int64 image_size = 13;
|
||||
}
|
Loading…
Reference in a new issue