#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Vertex {
#[prost(int32, tag = "1")]
pub x: i32,
#[prost(int32, tag = "2")]
pub y: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NormalizedVertex {
#[prost(float, tag = "1")]
pub x: f32,
#[prost(float, tag = "2")]
pub y: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BoundingPoly {
#[prost(message, repeated, tag = "1")]
pub vertices: ::prost::alloc::vec::Vec<Vertex>,
#[prost(message, repeated, tag = "2")]
pub normalized_vertices: ::prost::alloc::vec::Vec<NormalizedVertex>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Position {
#[prost(float, tag = "1")]
pub x: f32,
#[prost(float, tag = "2")]
pub y: f32,
#[prost(float, tag = "3")]
pub z: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Product {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub product_category: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "5")]
pub product_labels: ::prost::alloc::vec::Vec<product::KeyValue>,
}
pub mod product {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyValue {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub value: ::prost::alloc::string::String,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductSet {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub index_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "4")]
pub index_error: ::core::option::Option<super::super::super::rpc::Status>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReferenceImage {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub uri: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub bounding_polys: ::prost::alloc::vec::Vec<BoundingPoly>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateProductRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub product: ::core::option::Option<Product>,
#[prost(string, tag = "3")]
pub product_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProductsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProductsResponse {
#[prost(message, repeated, tag = "1")]
pub products: ::prost::alloc::vec::Vec<Product>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetProductRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateProductRequest {
#[prost(message, optional, tag = "1")]
pub product: ::core::option::Option<Product>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteProductRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateProductSetRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub product_set: ::core::option::Option<ProductSet>,
#[prost(string, tag = "3")]
pub product_set_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProductSetsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProductSetsResponse {
#[prost(message, repeated, tag = "1")]
pub product_sets: ::prost::alloc::vec::Vec<ProductSet>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetProductSetRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateProductSetRequest {
#[prost(message, optional, tag = "1")]
pub product_set: ::core::option::Option<ProductSet>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteProductSetRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateReferenceImageRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub reference_image: ::core::option::Option<ReferenceImage>,
#[prost(string, tag = "3")]
pub reference_image_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReferenceImagesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReferenceImagesResponse {
#[prost(message, repeated, tag = "1")]
pub reference_images: ::prost::alloc::vec::Vec<ReferenceImage>,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetReferenceImageRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteReferenceImageRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddProductToProductSetRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub product: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveProductFromProductSetRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub product: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProductsInProductSetRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProductsInProductSetResponse {
#[prost(message, repeated, tag = "1")]
pub products: ::prost::alloc::vec::Vec<Product>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportProductSetsGcsSource {
#[prost(string, tag = "1")]
pub csv_file_uri: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportProductSetsInputConfig {
#[prost(oneof = "import_product_sets_input_config::Source", tags = "1")]
pub source: ::core::option::Option<import_product_sets_input_config::Source>,
}
pub mod import_product_sets_input_config {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
#[prost(message, tag = "1")]
GcsSource(super::ImportProductSetsGcsSource),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportProductSetsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub input_config: ::core::option::Option<ImportProductSetsInputConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportProductSetsResponse {
#[prost(message, repeated, tag = "1")]
pub reference_images: ::prost::alloc::vec::Vec<ReferenceImage>,
#[prost(message, repeated, tag = "2")]
pub statuses: ::prost::alloc::vec::Vec<super::super::super::rpc::Status>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchOperationMetadata {
#[prost(enumeration = "batch_operation_metadata::State", tag = "1")]
pub state: i32,
#[prost(message, optional, tag = "2")]
pub submit_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
}
pub mod batch_operation_metadata {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Processing = 1,
Successful = 2,
Failed = 3,
Cancelled = 4,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductSetPurgeConfig {
#[prost(string, tag = "1")]
pub product_set_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PurgeProductsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(bool, tag = "4")]
pub force: bool,
#[prost(oneof = "purge_products_request::Target", tags = "2, 3")]
pub target: ::core::option::Option<purge_products_request::Target>,
}
pub mod purge_products_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Target {
#[prost(message, tag = "2")]
ProductSetPurgeConfig(super::ProductSetPurgeConfig),
#[prost(bool, tag = "3")]
DeleteOrphanProducts(bool),
}
}
#[doc = r" Generated client implementations."]
pub mod product_search_client {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
#[doc = " Manages Products and ProductSets of reference images for use in product"]
#[doc = " search. It uses the following resource model:"]
#[doc = ""]
#[doc = " - The API has a collection of [ProductSet][google.cloud.vision.v1.ProductSet] resources, named"]
#[doc = " `projects/*/locations/*/productSets/*`, which acts as a way to put different"]
#[doc = " products into groups to limit identification."]
#[doc = ""]
#[doc = " In parallel,"]
#[doc = ""]
#[doc = " - The API has a collection of [Product][google.cloud.vision.v1.Product] resources, named"]
#[doc = " `projects/*/locations/*/products/*`"]
#[doc = ""]
#[doc = " - Each [Product][google.cloud.vision.v1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, named"]
#[doc = " `projects/*/locations/*/products/*/referenceImages/*`"]
pub struct ProductSearchClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ProductSearchClient<tonic::transport::Channel> {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ProductSearchClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
let inner = tonic::client::Grpc::with_interceptor(inner, interceptor);
Self { inner }
}
#[doc = " Creates and returns a new ProductSet resource."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns INVALID_ARGUMENT if display_name is missing, or is longer than"]
#[doc = " 4096 characters."]
pub async fn create_product_set(
&mut self,
request: impl tonic::IntoRequest<super::CreateProductSetRequest>,
) -> Result<tonic::Response<super::ProductSet>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/CreateProductSet",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists ProductSets in an unspecified order."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns INVALID_ARGUMENT if page_size is greater than 100, or less"]
#[doc = " than 1."]
pub async fn list_product_sets(
&mut self,
request: impl tonic::IntoRequest<super::ListProductSetsRequest>,
) -> Result<tonic::Response<super::ListProductSetsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/ListProductSets",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets information associated with a ProductSet."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns NOT_FOUND if the ProductSet does not exist."]
pub async fn get_product_set(
&mut self,
request: impl tonic::IntoRequest<super::GetProductSetRequest>,
) -> Result<tonic::Response<super::ProductSet>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/GetProductSet",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Makes changes to a ProductSet resource."]
#[doc = " Only display_name can be updated currently."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns NOT_FOUND if the ProductSet does not exist."]
#[doc = " * Returns INVALID_ARGUMENT if display_name is present in update_mask but"]
#[doc = " missing from the request or longer than 4096 characters."]
pub async fn update_product_set(
&mut self,
request: impl tonic::IntoRequest<super::UpdateProductSetRequest>,
) -> Result<tonic::Response<super::ProductSet>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/UpdateProductSet",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Permanently deletes a ProductSet. Products and ReferenceImages in the"]
#[doc = " ProductSet are not deleted."]
#[doc = ""]
#[doc = " The actual image files are not deleted from Google Cloud Storage."]
pub async fn delete_product_set(
&mut self,
request: impl tonic::IntoRequest<super::DeleteProductSetRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/DeleteProductSet",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates and returns a new product resource."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096"]
#[doc = " characters."]
#[doc = " * Returns INVALID_ARGUMENT if description is longer than 4096 characters."]
#[doc = " * Returns INVALID_ARGUMENT if product_category is missing or invalid."]
pub async fn create_product(
&mut self,
request: impl tonic::IntoRequest<super::CreateProductRequest>,
) -> Result<tonic::Response<super::Product>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/CreateProduct",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists products in an unspecified order."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1."]
pub async fn list_products(
&mut self,
request: impl tonic::IntoRequest<super::ListProductsRequest>,
) -> Result<tonic::Response<super::ListProductsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/ListProducts",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets information associated with a Product."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns NOT_FOUND if the Product does not exist."]
pub async fn get_product(
&mut self,
request: impl tonic::IntoRequest<super::GetProductRequest>,
) -> Result<tonic::Response<super::Product>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/GetProduct",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Makes changes to a Product resource."]
#[doc = " Only the `display_name`, `description`, and `labels` fields can be updated"]
#[doc = " right now."]
#[doc = ""]
#[doc = " If labels are updated, the change will not be reflected in queries until"]
#[doc = " the next index time."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns NOT_FOUND if the Product does not exist."]
#[doc = " * Returns INVALID_ARGUMENT if display_name is present in update_mask but is"]
#[doc = " missing from the request or longer than 4096 characters."]
#[doc = " * Returns INVALID_ARGUMENT if description is present in update_mask but is"]
#[doc = " longer than 4096 characters."]
#[doc = " * Returns INVALID_ARGUMENT if product_category is present in update_mask."]
pub async fn update_product(
&mut self,
request: impl tonic::IntoRequest<super::UpdateProductRequest>,
) -> Result<tonic::Response<super::Product>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/UpdateProduct",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Permanently deletes a product and its reference images."]
#[doc = ""]
#[doc = " Metadata of the product and all its images will be deleted right away, but"]
#[doc = " search queries against ProductSets containing the product may still work"]
#[doc = " until all related caches are refreshed."]
pub async fn delete_product(
&mut self,
request: impl tonic::IntoRequest<super::DeleteProductRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/DeleteProduct",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates and returns a new ReferenceImage resource."]
#[doc = ""]
#[doc = " The `bounding_poly` field is optional. If `bounding_poly` is not specified,"]
#[doc = " the system will try to detect regions of interest in the image that are"]
#[doc = " compatible with the product_category on the parent product. If it is"]
#[doc = " specified, detection is ALWAYS skipped. The system converts polygons into"]
#[doc = " non-rotated rectangles."]
#[doc = ""]
#[doc = " Note that the pipeline will resize the image if the image resolution is too"]
#[doc = " large to process (above 50MP)."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096"]
#[doc = " characters."]
#[doc = " * Returns INVALID_ARGUMENT if the product does not exist."]
#[doc = " * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing"]
#[doc = " compatible with the parent product's product_category is detected."]
#[doc = " * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons."]
pub async fn create_reference_image(
&mut self,
request: impl tonic::IntoRequest<super::CreateReferenceImageRequest>,
) -> Result<tonic::Response<super::ReferenceImage>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/CreateReferenceImage",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Permanently deletes a reference image."]
#[doc = ""]
#[doc = " The image metadata will be deleted right away, but search queries"]
#[doc = " against ProductSets containing the image may still work until all related"]
#[doc = " caches are refreshed."]
#[doc = ""]
#[doc = " The actual image files are not deleted from Google Cloud Storage."]
pub async fn delete_reference_image(
&mut self,
request: impl tonic::IntoRequest<super::DeleteReferenceImageRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/DeleteReferenceImage",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists reference images."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns NOT_FOUND if the parent product does not exist."]
#[doc = " * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less"]
#[doc = " than 1."]
pub async fn list_reference_images(
&mut self,
request: impl tonic::IntoRequest<super::ListReferenceImagesRequest>,
) -> Result<tonic::Response<super::ListReferenceImagesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/ListReferenceImages",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets information associated with a ReferenceImage."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns NOT_FOUND if the specified image does not exist."]
pub async fn get_reference_image(
&mut self,
request: impl tonic::IntoRequest<super::GetReferenceImageRequest>,
) -> Result<tonic::Response<super::ReferenceImage>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/GetReferenceImage",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Adds a Product to the specified ProductSet. If the Product is already"]
#[doc = " present, no change is made."]
#[doc = ""]
#[doc = " One Product can be added to at most 100 ProductSets."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns NOT_FOUND if the Product or the ProductSet doesn't exist."]
pub async fn add_product_to_product_set(
&mut self,
request: impl tonic::IntoRequest<super::AddProductToProductSetRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/AddProductToProductSet",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Removes a Product from the specified ProductSet."]
pub async fn remove_product_from_product_set(
&mut self,
request: impl tonic::IntoRequest<super::RemoveProductFromProductSetRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/RemoveProductFromProductSet",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists the Products in a ProductSet, in an unspecified order. If the"]
#[doc = " ProductSet does not exist, the products field of the response will be"]
#[doc = " empty."]
#[doc = ""]
#[doc = " Possible errors:"]
#[doc = ""]
#[doc = " * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1."]
pub async fn list_products_in_product_set(
&mut self,
request: impl tonic::IntoRequest<super::ListProductsInProductSetRequest>,
) -> Result<tonic::Response<super::ListProductsInProductSetResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/ListProductsInProductSet",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Asynchronous API that imports a list of reference images to specified"]
#[doc = " product sets based on a list of image information."]
#[doc = ""]
#[doc = " The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the"]
#[doc = " progress and results of the request."]
#[doc = " `Operation.metadata` contains `BatchOperationMetadata`. (progress)"]
#[doc = " `Operation.response` contains `ImportProductSetsResponse`. (results)"]
#[doc = ""]
#[doc = " The input source of this method is a csv file on Google Cloud Storage."]
#[doc = " For the format of the csv file please see"]
#[doc = " [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]."]
pub async fn import_product_sets(
&mut self,
request: impl tonic::IntoRequest<super::ImportProductSetsRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/ImportProductSets",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Asynchronous API to delete all Products in a ProductSet or all Products"]
#[doc = " that are in no ProductSet."]
#[doc = ""]
#[doc = " If a Product is a member of the specified ProductSet in addition to other"]
#[doc = " ProductSets, the Product will still be deleted."]
#[doc = ""]
#[doc = " It is recommended to not delete the specified ProductSet until after this"]
#[doc = " operation has completed. It is also recommended to not add any of the"]
#[doc = " Products involved in the batch delete to a new ProductSet while this"]
#[doc = " operation is running because those Products may still end up deleted."]
#[doc = ""]
#[doc = " It's not possible to undo the PurgeProducts operation. Therefore, it is"]
#[doc = " recommended to keep the csv files used in ImportProductSets (if that was"]
#[doc = " how you originally built the Product Set) before starting PurgeProducts, in"]
#[doc = " case you need to re-import the data after deletion."]
#[doc = ""]
#[doc = " If the plan is to purge all of the Products from a ProductSet and then"]
#[doc = " re-use the empty ProductSet to re-import new Products into the empty"]
#[doc = " ProductSet, you must wait until the PurgeProducts operation has finished"]
#[doc = " for that ProductSet."]
#[doc = ""]
#[doc = " The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the"]
#[doc = " progress and results of the request."]
#[doc = " `Operation.metadata` contains `BatchOperationMetadata`. (progress)"]
pub async fn purge_products(
&mut self,
request: impl tonic::IntoRequest<super::PurgeProductsRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ProductSearch/PurgeProducts",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
impl<T: Clone> Clone for ProductSearchClient<T> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}
impl<T> std::fmt::Debug for ProductSearchClient<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ProductSearchClient {{ ... }}")
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductSearchParams {
#[prost(message, optional, tag = "9")]
pub bounding_poly: ::core::option::Option<BoundingPoly>,
#[prost(string, tag = "6")]
pub product_set: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "7")]
pub product_categories: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "8")]
pub filter: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductSearchResults {
#[prost(message, optional, tag = "2")]
pub index_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, repeated, tag = "5")]
pub results: ::prost::alloc::vec::Vec<product_search_results::Result>,
#[prost(message, repeated, tag = "6")]
pub product_grouped_results: ::prost::alloc::vec::Vec<product_search_results::GroupedResult>,
}
pub mod product_search_results {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Result {
#[prost(message, optional, tag = "1")]
pub product: ::core::option::Option<super::Product>,
#[prost(float, tag = "2")]
pub score: f32,
#[prost(string, tag = "3")]
pub image: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ObjectAnnotation {
#[prost(string, tag = "1")]
pub mid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub language_code: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub name: ::prost::alloc::string::String,
#[prost(float, tag = "4")]
pub score: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GroupedResult {
#[prost(message, optional, tag = "1")]
pub bounding_poly: ::core::option::Option<super::BoundingPoly>,
#[prost(message, repeated, tag = "2")]
pub results: ::prost::alloc::vec::Vec<Result>,
#[prost(message, repeated, tag = "3")]
pub object_annotations: ::prost::alloc::vec::Vec<ObjectAnnotation>,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextAnnotation {
#[prost(message, repeated, tag = "1")]
pub pages: ::prost::alloc::vec::Vec<Page>,
#[prost(string, tag = "2")]
pub text: ::prost::alloc::string::String,
}
pub mod text_annotation {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DetectedLanguage {
#[prost(string, tag = "1")]
pub language_code: ::prost::alloc::string::String,
#[prost(float, tag = "2")]
pub confidence: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DetectedBreak {
#[prost(enumeration = "detected_break::BreakType", tag = "1")]
pub r#type: i32,
#[prost(bool, tag = "2")]
pub is_prefix: bool,
}
pub mod detected_break {
#[derive(
Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration,
)]
#[repr(i32)]
pub enum BreakType {
Unknown = 0,
Space = 1,
SureSpace = 2,
EolSureSpace = 3,
Hyphen = 4,
LineBreak = 5,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextProperty {
#[prost(message, repeated, tag = "1")]
pub detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
#[prost(message, optional, tag = "2")]
pub detected_break: ::core::option::Option<DetectedBreak>,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Page {
#[prost(message, optional, tag = "1")]
pub property: ::core::option::Option<text_annotation::TextProperty>,
#[prost(int32, tag = "2")]
pub width: i32,
#[prost(int32, tag = "3")]
pub height: i32,
#[prost(message, repeated, tag = "4")]
pub blocks: ::prost::alloc::vec::Vec<Block>,
#[prost(float, tag = "5")]
pub confidence: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
#[prost(message, optional, tag = "1")]
pub property: ::core::option::Option<text_annotation::TextProperty>,
#[prost(message, optional, tag = "2")]
pub bounding_box: ::core::option::Option<BoundingPoly>,
#[prost(message, repeated, tag = "3")]
pub paragraphs: ::prost::alloc::vec::Vec<Paragraph>,
#[prost(enumeration = "block::BlockType", tag = "4")]
pub block_type: i32,
#[prost(float, tag = "5")]
pub confidence: f32,
}
pub mod block {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum BlockType {
Unknown = 0,
Text = 1,
Table = 2,
Picture = 3,
Ruler = 4,
Barcode = 5,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Paragraph {
#[prost(message, optional, tag = "1")]
pub property: ::core::option::Option<text_annotation::TextProperty>,
#[prost(message, optional, tag = "2")]
pub bounding_box: ::core::option::Option<BoundingPoly>,
#[prost(message, repeated, tag = "3")]
pub words: ::prost::alloc::vec::Vec<Word>,
#[prost(float, tag = "4")]
pub confidence: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Word {
#[prost(message, optional, tag = "1")]
pub property: ::core::option::Option<text_annotation::TextProperty>,
#[prost(message, optional, tag = "2")]
pub bounding_box: ::core::option::Option<BoundingPoly>,
#[prost(message, repeated, tag = "3")]
pub symbols: ::prost::alloc::vec::Vec<Symbol>,
#[prost(float, tag = "4")]
pub confidence: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Symbol {
#[prost(message, optional, tag = "1")]
pub property: ::core::option::Option<text_annotation::TextProperty>,
#[prost(message, optional, tag = "2")]
pub bounding_box: ::core::option::Option<BoundingPoly>,
#[prost(string, tag = "3")]
pub text: ::prost::alloc::string::String,
#[prost(float, tag = "4")]
pub confidence: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebDetection {
#[prost(message, repeated, tag = "1")]
pub web_entities: ::prost::alloc::vec::Vec<web_detection::WebEntity>,
#[prost(message, repeated, tag = "2")]
pub full_matching_images: ::prost::alloc::vec::Vec<web_detection::WebImage>,
#[prost(message, repeated, tag = "3")]
pub partial_matching_images: ::prost::alloc::vec::Vec<web_detection::WebImage>,
#[prost(message, repeated, tag = "4")]
pub pages_with_matching_images: ::prost::alloc::vec::Vec<web_detection::WebPage>,
#[prost(message, repeated, tag = "6")]
pub visually_similar_images: ::prost::alloc::vec::Vec<web_detection::WebImage>,
#[prost(message, repeated, tag = "8")]
pub best_guess_labels: ::prost::alloc::vec::Vec<web_detection::WebLabel>,
}
pub mod web_detection {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebEntity {
#[prost(string, tag = "1")]
pub entity_id: ::prost::alloc::string::String,
#[prost(float, tag = "2")]
pub score: f32,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebImage {
#[prost(string, tag = "1")]
pub url: ::prost::alloc::string::String,
#[prost(float, tag = "2")]
pub score: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebPage {
#[prost(string, tag = "1")]
pub url: ::prost::alloc::string::String,
#[prost(float, tag = "2")]
pub score: f32,
#[prost(string, tag = "3")]
pub page_title: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "4")]
pub full_matching_images: ::prost::alloc::vec::Vec<WebImage>,
#[prost(message, repeated, tag = "5")]
pub partial_matching_images: ::prost::alloc::vec::Vec<WebImage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebLabel {
#[prost(string, tag = "1")]
pub label: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub language_code: ::prost::alloc::string::String,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Feature {
#[prost(enumeration = "feature::Type", tag = "1")]
pub r#type: i32,
#[prost(int32, tag = "2")]
pub max_results: i32,
#[prost(string, tag = "3")]
pub model: ::prost::alloc::string::String,
}
pub mod feature {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Type {
Unspecified = 0,
FaceDetection = 1,
LandmarkDetection = 2,
LogoDetection = 3,
LabelDetection = 4,
TextDetection = 5,
DocumentTextDetection = 11,
SafeSearchDetection = 6,
ImageProperties = 7,
CropHints = 9,
WebDetection = 10,
ProductSearch = 12,
ObjectLocalization = 19,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImageSource {
#[prost(string, tag = "1")]
pub gcs_image_uri: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub image_uri: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Image {
#[prost(bytes = "vec", tag = "1")]
pub content: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "2")]
pub source: ::core::option::Option<ImageSource>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FaceAnnotation {
#[prost(message, optional, tag = "1")]
pub bounding_poly: ::core::option::Option<BoundingPoly>,
#[prost(message, optional, tag = "2")]
pub fd_bounding_poly: ::core::option::Option<BoundingPoly>,
#[prost(message, repeated, tag = "3")]
pub landmarks: ::prost::alloc::vec::Vec<face_annotation::Landmark>,
#[prost(float, tag = "4")]
pub roll_angle: f32,
#[prost(float, tag = "5")]
pub pan_angle: f32,
#[prost(float, tag = "6")]
pub tilt_angle: f32,
#[prost(float, tag = "7")]
pub detection_confidence: f32,
#[prost(float, tag = "8")]
pub landmarking_confidence: f32,
#[prost(enumeration = "Likelihood", tag = "9")]
pub joy_likelihood: i32,
#[prost(enumeration = "Likelihood", tag = "10")]
pub sorrow_likelihood: i32,
#[prost(enumeration = "Likelihood", tag = "11")]
pub anger_likelihood: i32,
#[prost(enumeration = "Likelihood", tag = "12")]
pub surprise_likelihood: i32,
#[prost(enumeration = "Likelihood", tag = "13")]
pub under_exposed_likelihood: i32,
#[prost(enumeration = "Likelihood", tag = "14")]
pub blurred_likelihood: i32,
#[prost(enumeration = "Likelihood", tag = "15")]
pub headwear_likelihood: i32,
}
pub mod face_annotation {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Landmark {
#[prost(enumeration = "landmark::Type", tag = "3")]
pub r#type: i32,
#[prost(message, optional, tag = "4")]
pub position: ::core::option::Option<super::Position>,
}
pub mod landmark {
#[derive(
Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration,
)]
#[repr(i32)]
pub enum Type {
UnknownLandmark = 0,
LeftEye = 1,
RightEye = 2,
LeftOfLeftEyebrow = 3,
RightOfLeftEyebrow = 4,
LeftOfRightEyebrow = 5,
RightOfRightEyebrow = 6,
MidpointBetweenEyes = 7,
NoseTip = 8,
UpperLip = 9,
LowerLip = 10,
MouthLeft = 11,
MouthRight = 12,
MouthCenter = 13,
NoseBottomRight = 14,
NoseBottomLeft = 15,
NoseBottomCenter = 16,
LeftEyeTopBoundary = 17,
LeftEyeRightCorner = 18,
LeftEyeBottomBoundary = 19,
LeftEyeLeftCorner = 20,
RightEyeTopBoundary = 21,
RightEyeRightCorner = 22,
RightEyeBottomBoundary = 23,
RightEyeLeftCorner = 24,
LeftEyebrowUpperMidpoint = 25,
RightEyebrowUpperMidpoint = 26,
LeftEarTragion = 27,
RightEarTragion = 28,
LeftEyePupil = 29,
RightEyePupil = 30,
ForeheadGlabella = 31,
ChinGnathion = 32,
ChinLeftGonion = 33,
ChinRightGonion = 34,
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocationInfo {
#[prost(message, optional, tag = "1")]
pub lat_lng: ::core::option::Option<super::super::super::r#type::LatLng>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Property {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub value: ::prost::alloc::string::String,
#[prost(uint64, tag = "3")]
pub uint64_value: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EntityAnnotation {
#[prost(string, tag = "1")]
pub mid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub locale: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(float, tag = "4")]
pub score: f32,
#[deprecated]
#[prost(float, tag = "5")]
pub confidence: f32,
#[prost(float, tag = "6")]
pub topicality: f32,
#[prost(message, optional, tag = "7")]
pub bounding_poly: ::core::option::Option<BoundingPoly>,
#[prost(message, repeated, tag = "8")]
pub locations: ::prost::alloc::vec::Vec<LocationInfo>,
#[prost(message, repeated, tag = "9")]
pub properties: ::prost::alloc::vec::Vec<Property>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocalizedObjectAnnotation {
#[prost(string, tag = "1")]
pub mid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub language_code: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub name: ::prost::alloc::string::String,
#[prost(float, tag = "4")]
pub score: f32,
#[prost(message, optional, tag = "5")]
pub bounding_poly: ::core::option::Option<BoundingPoly>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SafeSearchAnnotation {
#[prost(enumeration = "Likelihood", tag = "1")]
pub adult: i32,
#[prost(enumeration = "Likelihood", tag = "2")]
pub spoof: i32,
#[prost(enumeration = "Likelihood", tag = "3")]
pub medical: i32,
#[prost(enumeration = "Likelihood", tag = "4")]
pub violence: i32,
#[prost(enumeration = "Likelihood", tag = "9")]
pub racy: i32,
#[prost(float, tag = "16")]
pub adult_confidence: f32,
#[prost(float, tag = "18")]
pub spoof_confidence: f32,
#[prost(float, tag = "20")]
pub medical_confidence: f32,
#[prost(float, tag = "22")]
pub violence_confidence: f32,
#[prost(float, tag = "24")]
pub racy_confidence: f32,
#[prost(float, tag = "26")]
pub nsfw_confidence: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LatLongRect {
#[prost(message, optional, tag = "1")]
pub min_lat_lng: ::core::option::Option<super::super::super::r#type::LatLng>,
#[prost(message, optional, tag = "2")]
pub max_lat_lng: ::core::option::Option<super::super::super::r#type::LatLng>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ColorInfo {
#[prost(message, optional, tag = "1")]
pub color: ::core::option::Option<super::super::super::r#type::Color>,
#[prost(float, tag = "2")]
pub score: f32,
#[prost(float, tag = "3")]
pub pixel_fraction: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DominantColorsAnnotation {
#[prost(message, repeated, tag = "1")]
pub colors: ::prost::alloc::vec::Vec<ColorInfo>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImageProperties {
#[prost(message, optional, tag = "1")]
pub dominant_colors: ::core::option::Option<DominantColorsAnnotation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CropHint {
#[prost(message, optional, tag = "1")]
pub bounding_poly: ::core::option::Option<BoundingPoly>,
#[prost(float, tag = "2")]
pub confidence: f32,
#[prost(float, tag = "3")]
pub importance_fraction: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CropHintsAnnotation {
#[prost(message, repeated, tag = "1")]
pub crop_hints: ::prost::alloc::vec::Vec<CropHint>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CropHintsParams {
#[prost(float, repeated, tag = "1")]
pub aspect_ratios: ::prost::alloc::vec::Vec<f32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebDetectionParams {
#[prost(bool, tag = "2")]
pub include_geo_results: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImageContext {
#[prost(message, optional, tag = "1")]
pub lat_long_rect: ::core::option::Option<LatLongRect>,
#[prost(string, repeated, tag = "2")]
pub language_hints: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(message, optional, tag = "4")]
pub crop_hints_params: ::core::option::Option<CropHintsParams>,
#[prost(message, optional, tag = "5")]
pub product_search_params: ::core::option::Option<ProductSearchParams>,
#[prost(message, optional, tag = "6")]
pub web_detection_params: ::core::option::Option<WebDetectionParams>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateImageRequest {
#[prost(message, optional, tag = "1")]
pub image: ::core::option::Option<Image>,
#[prost(message, repeated, tag = "2")]
pub features: ::prost::alloc::vec::Vec<Feature>,
#[prost(message, optional, tag = "3")]
pub image_context: ::core::option::Option<ImageContext>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImageAnnotationContext {
#[prost(string, tag = "1")]
pub uri: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_number: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateImageResponse {
#[prost(message, repeated, tag = "1")]
pub face_annotations: ::prost::alloc::vec::Vec<FaceAnnotation>,
#[prost(message, repeated, tag = "2")]
pub landmark_annotations: ::prost::alloc::vec::Vec<EntityAnnotation>,
#[prost(message, repeated, tag = "3")]
pub logo_annotations: ::prost::alloc::vec::Vec<EntityAnnotation>,
#[prost(message, repeated, tag = "4")]
pub label_annotations: ::prost::alloc::vec::Vec<EntityAnnotation>,
#[prost(message, repeated, tag = "22")]
pub localized_object_annotations: ::prost::alloc::vec::Vec<LocalizedObjectAnnotation>,
#[prost(message, repeated, tag = "5")]
pub text_annotations: ::prost::alloc::vec::Vec<EntityAnnotation>,
#[prost(message, optional, tag = "12")]
pub full_text_annotation: ::core::option::Option<TextAnnotation>,
#[prost(message, optional, tag = "6")]
pub safe_search_annotation: ::core::option::Option<SafeSearchAnnotation>,
#[prost(message, optional, tag = "8")]
pub image_properties_annotation: ::core::option::Option<ImageProperties>,
#[prost(message, optional, tag = "11")]
pub crop_hints_annotation: ::core::option::Option<CropHintsAnnotation>,
#[prost(message, optional, tag = "13")]
pub web_detection: ::core::option::Option<WebDetection>,
#[prost(message, optional, tag = "14")]
pub product_search_results: ::core::option::Option<ProductSearchResults>,
#[prost(message, optional, tag = "9")]
pub error: ::core::option::Option<super::super::super::rpc::Status>,
#[prost(message, optional, tag = "21")]
pub context: ::core::option::Option<ImageAnnotationContext>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchAnnotateImagesRequest {
#[prost(message, repeated, tag = "1")]
pub requests: ::prost::alloc::vec::Vec<AnnotateImageRequest>,
#[prost(string, tag = "4")]
pub parent: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchAnnotateImagesResponse {
#[prost(message, repeated, tag = "1")]
pub responses: ::prost::alloc::vec::Vec<AnnotateImageResponse>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateFileRequest {
#[prost(message, optional, tag = "1")]
pub input_config: ::core::option::Option<InputConfig>,
#[prost(message, repeated, tag = "2")]
pub features: ::prost::alloc::vec::Vec<Feature>,
#[prost(message, optional, tag = "3")]
pub image_context: ::core::option::Option<ImageContext>,
#[prost(int32, repeated, tag = "4")]
pub pages: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateFileResponse {
#[prost(message, optional, tag = "1")]
pub input_config: ::core::option::Option<InputConfig>,
#[prost(message, repeated, tag = "2")]
pub responses: ::prost::alloc::vec::Vec<AnnotateImageResponse>,
#[prost(int32, tag = "3")]
pub total_pages: i32,
#[prost(message, optional, tag = "4")]
pub error: ::core::option::Option<super::super::super::rpc::Status>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchAnnotateFilesRequest {
#[prost(message, repeated, tag = "1")]
pub requests: ::prost::alloc::vec::Vec<AnnotateFileRequest>,
#[prost(string, tag = "3")]
pub parent: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchAnnotateFilesResponse {
#[prost(message, repeated, tag = "1")]
pub responses: ::prost::alloc::vec::Vec<AnnotateFileResponse>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncAnnotateFileRequest {
#[prost(message, optional, tag = "1")]
pub input_config: ::core::option::Option<InputConfig>,
#[prost(message, repeated, tag = "2")]
pub features: ::prost::alloc::vec::Vec<Feature>,
#[prost(message, optional, tag = "3")]
pub image_context: ::core::option::Option<ImageContext>,
#[prost(message, optional, tag = "4")]
pub output_config: ::core::option::Option<OutputConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncAnnotateFileResponse {
#[prost(message, optional, tag = "1")]
pub output_config: ::core::option::Option<OutputConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncBatchAnnotateImagesRequest {
#[prost(message, repeated, tag = "1")]
pub requests: ::prost::alloc::vec::Vec<AnnotateImageRequest>,
#[prost(message, optional, tag = "2")]
pub output_config: ::core::option::Option<OutputConfig>,
#[prost(string, tag = "4")]
pub parent: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncBatchAnnotateImagesResponse {
#[prost(message, optional, tag = "1")]
pub output_config: ::core::option::Option<OutputConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncBatchAnnotateFilesRequest {
#[prost(message, repeated, tag = "1")]
pub requests: ::prost::alloc::vec::Vec<AsyncAnnotateFileRequest>,
#[prost(string, tag = "4")]
pub parent: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncBatchAnnotateFilesResponse {
#[prost(message, repeated, tag = "1")]
pub responses: ::prost::alloc::vec::Vec<AsyncAnnotateFileResponse>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InputConfig {
#[prost(message, optional, tag = "1")]
pub gcs_source: ::core::option::Option<GcsSource>,
#[prost(bytes = "vec", tag = "3")]
pub content: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "2")]
pub mime_type: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OutputConfig {
#[prost(message, optional, tag = "1")]
pub gcs_destination: ::core::option::Option<GcsDestination>,
#[prost(int32, tag = "2")]
pub batch_size: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcsSource {
#[prost(string, tag = "1")]
pub uri: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcsDestination {
#[prost(string, tag = "1")]
pub uri: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationMetadata {
#[prost(enumeration = "operation_metadata::State", tag = "1")]
pub state: i32,
#[prost(message, optional, tag = "5")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "6")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
}
pub mod operation_metadata {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Created = 1,
Running = 2,
Done = 3,
Cancelled = 4,
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Likelihood {
Unknown = 0,
VeryUnlikely = 1,
Unlikely = 2,
Possible = 3,
Likely = 4,
VeryLikely = 5,
}
#[doc = r" Generated client implementations."]
pub mod image_annotator_client {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
#[doc = " Service that performs Google Cloud Vision API detection tasks over client"]
#[doc = " images, such as face, landmark, logo, label, and text detection. The"]
#[doc = " ImageAnnotator service returns detected entities from the images."]
pub struct ImageAnnotatorClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ImageAnnotatorClient<tonic::transport::Channel> {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ImageAnnotatorClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
let inner = tonic::client::Grpc::with_interceptor(inner, interceptor);
Self { inner }
}
#[doc = " Run image detection and annotation for a batch of images."]
pub async fn batch_annotate_images(
&mut self,
request: impl tonic::IntoRequest<super::BatchAnnotateImagesRequest>,
) -> Result<tonic::Response<super::BatchAnnotateImagesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateImages",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Service that performs image detection and annotation for a batch of files."]
#[doc = " Now only \"application/pdf\", \"image/tiff\" and \"image/gif\" are supported."]
#[doc = ""]
#[doc = " This service will extract at most 5 (customers can specify which 5 in"]
#[doc = " AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each"]
#[doc = " file provided and perform detection and annotation for each image"]
#[doc = " extracted."]
pub async fn batch_annotate_files(
&mut self,
request: impl tonic::IntoRequest<super::BatchAnnotateFilesRequest>,
) -> Result<tonic::Response<super::BatchAnnotateFilesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateFiles",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Run asynchronous image detection and annotation for a list of images."]
#[doc = ""]
#[doc = " Progress and results can be retrieved through the"]
#[doc = " `google.longrunning.Operations` interface."]
#[doc = " `Operation.metadata` contains `OperationMetadata` (metadata)."]
#[doc = " `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results)."]
#[doc = ""]
#[doc = " This service will write image annotation outputs to json files in customer"]
#[doc = " GCS bucket, each json file containing BatchAnnotateImagesResponse proto."]
pub async fn async_batch_annotate_images(
&mut self,
request: impl tonic::IntoRequest<super::AsyncBatchAnnotateImagesRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ImageAnnotator/AsyncBatchAnnotateImages",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Run asynchronous image detection and annotation for a list of generic"]
#[doc = " files, such as PDF files, which may contain multiple pages and multiple"]
#[doc = " images per page. Progress and results can be retrieved through the"]
#[doc = " `google.longrunning.Operations` interface."]
#[doc = " `Operation.metadata` contains `OperationMetadata` (metadata)."]
#[doc = " `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results)."]
pub async fn async_batch_annotate_files(
&mut self,
request: impl tonic::IntoRequest<super::AsyncBatchAnnotateFilesRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.vision.v1.ImageAnnotator/AsyncBatchAnnotateFiles",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
impl<T: Clone> Clone for ImageAnnotatorClient<T> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}
impl<T> std::fmt::Debug for ImageAnnotatorClient<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ImageAnnotatorClient {{ ... }}")
}
}
}