proto: split and added list proto
This commit is contained in:
parent
fbb7f73142
commit
084f865680
84
schemas/proto/device/v1/create.proto
Normal file
84
schemas/proto/device/v1/create.proto
Normal file
|
@ -0,0 +1,84 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package device.v1;
|
||||
|
||||
import "buf/validate/validate.proto";
|
||||
|
||||
option go_package = "github.com/tigorlazuardi/bluemage/go/gen/proto/device/v1";
|
||||
|
||||
message CreateDeviceRequest {
|
||||
// The `slug` is a unique identifier for the device, used to identify the device within the system.
|
||||
// Each `slug` must be unique across all devices.
|
||||
string slug = 1 [(buf.validate.field).string.min_len = 1];
|
||||
|
||||
// `disabled` is a flag to set if a device is enabled upon creation. Default false.
|
||||
bool disabled = 2;
|
||||
|
||||
// The name of the device. This is used for display purposes.
|
||||
string name = 3;
|
||||
|
||||
// The display x resolution of the device.
|
||||
// The value must be greater than 0.
|
||||
double resolution_x = 4 [(buf.validate.field).double.gt = 0];
|
||||
|
||||
// The display y resolution of the device.
|
||||
// The value must be greater than 0.
|
||||
double resolution_y = 5 [(buf.validate.field).double.gt = 0];
|
||||
|
||||
// aspect_ratio_tolerance is a tolerance for aspect ratio images to be accepted.
|
||||
//
|
||||
// The bigger the aspect_ratio_tolerance, the more images will be fetched, but it also means more likely
|
||||
// for images that will look stretched if you set the device wallpaper view as stretched or
|
||||
// will overfill if you set the device wallpaper view as fill.
|
||||
//
|
||||
// if a device has resolution_x = 1920, resolution_y = 1080, it has an aspect ratio of 1.777~ (1920 divided by 1080).
|
||||
//
|
||||
// an aspect_ratio_tolerance of 0.2 means that the device will accept images with aspect ratio between 1.577~ and 1.977~.
|
||||
//
|
||||
// THIS IS NOT A FILTER FOR IMAGE SIZE. This filter will take images that are far bigger or smaller than the device resolution
|
||||
// as long as the aspect ratio is within the tolerance. Like example above, if an image has resolution of 3840x2160, it will be
|
||||
// accepted by the device even though it is 2 times bigger than the device resolution.
|
||||
//
|
||||
// If you want to filter image size, use min_x, min_y, max_x, max_y fields.
|
||||
double aspect_ratio_tolerance = 6;
|
||||
|
||||
// The minimum x resolution required for an image to be accepted by the device.
|
||||
//
|
||||
// A value of 0 indicates no minimum x resolution.
|
||||
//
|
||||
// The default value is 0.
|
||||
int32 min_x = 7 [(buf.validate.field).int32.gte = 0];
|
||||
|
||||
// The minimum y resolution required for an image to be accepted by the device.
|
||||
//
|
||||
// A value of 0 indicates no minimum y resolution.
|
||||
//
|
||||
// The default value is 0.
|
||||
int32 min_y = 8 [(buf.validate.field).int32.gte = 0];
|
||||
|
||||
// The maximum x resolution allowed for an image to be accepted by the device.
|
||||
//
|
||||
// A value of 0 indicates no maximum x resolution.
|
||||
//
|
||||
// The default value is 0.
|
||||
int32 max_x = 9 [(buf.validate.field).int32.gte = 0];
|
||||
|
||||
// The maximum y resolution allowed for an image to be accepted by the device.
|
||||
//
|
||||
// A value of 0 indicates no maximum y resolution.
|
||||
//
|
||||
// The default value is 0.
|
||||
int32 max_y = 10 [(buf.validate.field).int32.gte = 0];
|
||||
|
||||
// The `nsfw` parameter allows the device to accept NSFW (Not Safe For Work) images when set to true.
|
||||
bool nsfw = 11;
|
||||
|
||||
// `single_folder_mode` when set to true, downloaded images will be put on single folder location
|
||||
// instead of inside folders separated by subreddit names.
|
||||
bool single_folder_mode = 12;
|
||||
}
|
||||
|
||||
message CreateDeviceResponse {
|
||||
// `slug` is the slug of the created device.
|
||||
string slug = 1;
|
||||
}
|
|
@ -2,8 +2,9 @@ syntax = "proto3";
|
|||
|
||||
package device.v1;
|
||||
|
||||
import "buf/validate/validate.proto";
|
||||
import "device/v1/create.proto";
|
||||
import "device/v1/get.proto";
|
||||
import "device/v1/list.proto";
|
||||
|
||||
option go_package = "github.com/tigorlazuardi/bluemage/go/gen/proto/device/v1";
|
||||
|
||||
|
@ -23,148 +24,3 @@ service DeviceService {
|
|||
// CreateDevice creates a new device.
|
||||
rpc CreateDevice(CreateDeviceRequest) returns (CreateDeviceResponse) {}
|
||||
}
|
||||
|
||||
message ListDevicesRequest {
|
||||
// searches the name and slug of the devices.
|
||||
// case insensitive.
|
||||
//
|
||||
// If empty or not given, lists all devices.
|
||||
// (Limit, Offset, Order, Sort still applies).
|
||||
//
|
||||
// default: empty string.
|
||||
string search = 1;
|
||||
|
||||
// disabled limit the listing devides only
|
||||
// to disabled devices.
|
||||
//
|
||||
// default: false.
|
||||
bool disabled = 2;
|
||||
|
||||
// limits the number of results.
|
||||
//
|
||||
// if value is 0 or not given, limit is set to 25.
|
||||
//
|
||||
// if limit is higher than 100, it is clamped to 100.
|
||||
uint32 limit = 3;
|
||||
|
||||
// offset for the given data.
|
||||
//
|
||||
// If offset is 0 or not given, the query begins from start.
|
||||
uint32 offset = 4;
|
||||
|
||||
// order_by is the field to order the devices by.
|
||||
//
|
||||
// If not given, the default is `created_at`.
|
||||
OrderBy order_by = 5;
|
||||
|
||||
// sort is the direction of the order_by result.
|
||||
//
|
||||
// If not given, the default is `ascending`.
|
||||
Sort sort = 6;
|
||||
}
|
||||
|
||||
message ListDevicesResponse {
|
||||
uint32 count = 1;
|
||||
repeated GetDeviceResponse devices = 2;
|
||||
}
|
||||
|
||||
message CreateDeviceRequest {
|
||||
// The `slug` is a unique identifier for the device, used to identify the device within the system.
|
||||
// Each `slug` must be unique across all devices.
|
||||
string slug = 1 [(buf.validate.field).string.min_len = 1];
|
||||
|
||||
// `disabled` is a flag to set if a device is enabled upon creation. Default false.
|
||||
bool disabled = 2;
|
||||
|
||||
// The name of the device. This is used for display purposes.
|
||||
string name = 3;
|
||||
|
||||
// The display x resolution of the device.
|
||||
// The value must be greater than 0.
|
||||
double resolution_x = 4 [(buf.validate.field).double.gt = 0];
|
||||
|
||||
// The display y resolution of the device.
|
||||
// The value must be greater than 0.
|
||||
double resolution_y = 5 [(buf.validate.field).double.gt = 0];
|
||||
|
||||
// aspect_ratio_tolerance is a tolerance for aspect ratio images to be accepted.
|
||||
//
|
||||
// The bigger the aspect_ratio_tolerance, the more images will be fetched, but it also means more likely
|
||||
// for images that will look stretched if you set the device wallpaper view as stretched or
|
||||
// will overfill if you set the device wallpaper view as fill.
|
||||
//
|
||||
// if a device has resolution_x = 1920, resolution_y = 1080, it has an aspect ratio of 1.777~ (1920 divided by 1080).
|
||||
//
|
||||
// an aspect_ratio_tolerance of 0.2 means that the device will accept images with aspect ratio between 1.577~ and 1.977~.
|
||||
//
|
||||
// THIS IS NOT A FILTER FOR IMAGE SIZE. This filter will take images that are far bigger or smaller than the device resolution
|
||||
// as long as the aspect ratio is within the tolerance. Like example above, if an image has resolution of 3840x2160, it will be
|
||||
// accepted by the device even though it is 2 times bigger than the device resolution.
|
||||
//
|
||||
// If you want to filter image size, use min_x, min_y, max_x, max_y fields.
|
||||
double aspect_ratio_tolerance = 6;
|
||||
|
||||
// The minimum x resolution required for an image to be accepted by the device.
|
||||
//
|
||||
// A value of 0 indicates no minimum x resolution.
|
||||
//
|
||||
// The default value is 0.
|
||||
int32 min_x = 7 [(buf.validate.field).int32.gte = 0];
|
||||
|
||||
// The minimum y resolution required for an image to be accepted by the device.
|
||||
//
|
||||
// A value of 0 indicates no minimum y resolution.
|
||||
//
|
||||
// The default value is 0.
|
||||
int32 min_y = 8 [(buf.validate.field).int32.gte = 0];
|
||||
|
||||
// The maximum x resolution allowed for an image to be accepted by the device.
|
||||
//
|
||||
// A value of 0 indicates no maximum x resolution.
|
||||
//
|
||||
// The default value is 0.
|
||||
int32 max_x = 9 [(buf.validate.field).int32.gte = 0];
|
||||
|
||||
// The maximum y resolution allowed for an image to be accepted by the device.
|
||||
//
|
||||
// A value of 0 indicates no maximum y resolution.
|
||||
//
|
||||
// The default value is 0.
|
||||
int32 max_y = 10 [(buf.validate.field).int32.gte = 0];
|
||||
|
||||
// The `nsfw` parameter allows the device to accept NSFW (Not Safe For Work) images when set to true.
|
||||
bool nsfw = 11;
|
||||
|
||||
// `single_folder_mode` when set to true, downloaded images will be put on single folder location
|
||||
// instead of inside folders separated by subreddit names.
|
||||
bool single_folder_mode = 12;
|
||||
}
|
||||
|
||||
message CreateDeviceResponse {
|
||||
// `slug` is the slug of the created device.
|
||||
string slug = 1;
|
||||
}
|
||||
|
||||
enum OrderBy {
|
||||
ORDER_BY_UNSPECIFIED = 0;
|
||||
ORDER_BY_SLUG = 1;
|
||||
ORDER_BY_DISABLED = 2;
|
||||
ORDER_BY_NAME = 3;
|
||||
ORDER_BY_RESOLUTION_X = 4;
|
||||
ORDER_BY_RESOLUTION_Y = 5;
|
||||
ORDER_BY_ASPECT_RATIO_TOLERANCE = 6;
|
||||
ORDER_BY_MIN_X = 7;
|
||||
ORDER_BY_MIN_Y = 8;
|
||||
ORDER_BY_MAX_X = 9;
|
||||
ORDER_BY_MAX_Y = 10;
|
||||
ORDER_BY_NSFW = 11;
|
||||
ORDER_BY_SINGLE_FOLDER_MODE = 12;
|
||||
ORDER_BY_CREATED_AT = 13;
|
||||
ORDER_BY_UPDATED_AT = 14;
|
||||
}
|
||||
|
||||
enum Sort {
|
||||
SORT_UNSPECIFIED = 0;
|
||||
SORT_ASCENDING = 1;
|
||||
SORT_DESCENDING = 2;
|
||||
}
|
||||
|
|
76
schemas/proto/device/v1/list.proto
Normal file
76
schemas/proto/device/v1/list.proto
Normal file
|
@ -0,0 +1,76 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package device.v1;
|
||||
|
||||
// import "buf/validate/validate.proto";
|
||||
import "device/v1/get.proto";
|
||||
|
||||
option go_package = "github.com/tigorlazuardi/bluemage/go/gen/proto/device/v1";
|
||||
|
||||
message ListDevicesRequest {
|
||||
// searches the name and slug of the devices.
|
||||
// case insensitive.
|
||||
//
|
||||
// If empty or not given, lists all devices.
|
||||
// (Limit, Offset, Order, Sort still applies).
|
||||
//
|
||||
// default: empty string.
|
||||
string search = 1;
|
||||
|
||||
// disabled limit the listing devides only
|
||||
// to disabled devices.
|
||||
//
|
||||
// default: false.
|
||||
bool disabled = 2;
|
||||
|
||||
// limits the number of results.
|
||||
//
|
||||
// if value is 0 or not given, limit is set to 25.
|
||||
//
|
||||
// if limit is higher than 100, it is clamped to 100.
|
||||
uint32 limit = 3;
|
||||
|
||||
// offset for the given data.
|
||||
//
|
||||
// If offset is 0 or not given, the query begins from start.
|
||||
uint32 offset = 4;
|
||||
|
||||
// order_by is the field to order the devices by.
|
||||
//
|
||||
// If not given, the default is `created_at`.
|
||||
OrderBy order_by = 5;
|
||||
|
||||
// sort is the direction of the order_by result.
|
||||
//
|
||||
// If not given, the default is `ascending`.
|
||||
Sort sort = 6;
|
||||
}
|
||||
|
||||
message ListDevicesResponse {
|
||||
uint64 count = 1;
|
||||
repeated GetDeviceResponse devices = 2;
|
||||
}
|
||||
|
||||
enum OrderBy {
|
||||
ORDER_BY_UNSPECIFIED = 0;
|
||||
ORDER_BY_SLUG = 1;
|
||||
ORDER_BY_DISABLED = 2;
|
||||
ORDER_BY_NAME = 3;
|
||||
ORDER_BY_RESOLUTION_X = 4;
|
||||
ORDER_BY_RESOLUTION_Y = 5;
|
||||
ORDER_BY_ASPECT_RATIO_TOLERANCE = 6;
|
||||
ORDER_BY_MIN_X = 7;
|
||||
ORDER_BY_MIN_Y = 8;
|
||||
ORDER_BY_MAX_X = 9;
|
||||
ORDER_BY_MAX_Y = 10;
|
||||
ORDER_BY_NSFW = 11;
|
||||
ORDER_BY_SINGLE_FOLDER_MODE = 12;
|
||||
ORDER_BY_CREATED_AT = 13;
|
||||
ORDER_BY_UPDATED_AT = 14;
|
||||
}
|
||||
|
||||
enum Sort {
|
||||
SORT_UNSPECIFIED = 0;
|
||||
SORT_ASCENDING = 1;
|
||||
SORT_DESCENDING = 2;
|
||||
}
|
Loading…
Reference in a new issue