1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ResourceOpenedEvent {
4 #[prost(enumeration = "ResourceType", tag = "1")]
5 pub resource_type: i32,
6 #[prost(string, tag = "2")]
7 pub rid: ::prost::alloc::string::String,
8 #[prost(bool, tag = "3")]
9 pub is_creator: bool,
10}
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct TrackEventRequest {
13 #[prost(string, tag = "1")]
14 pub workspace_rid: ::prost::alloc::string::String,
15 #[prost(oneof = "track_event_request::Event", tags = "2")]
16 pub event: ::core::option::Option<track_event_request::Event>,
17}
18pub mod track_event_request {
20 #[derive(Clone, PartialEq, ::prost::Oneof)]
21 pub enum Event {
22 #[prost(message, tag = "2")]
23 ResourceOpened(super::ResourceOpenedEvent),
24 }
25}
26#[derive(Clone, Copy, PartialEq, ::prost::Message)]
27pub struct TrackEventResponse {}
28#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
29#[repr(i32)]
30pub enum ResourceType {
31 Unspecified = 0,
32 Workbook = 1,
33 Checklist = 2,
34 Procedure = 3,
35}
36impl ResourceType {
37 pub fn as_str_name(&self) -> &'static str {
42 match self {
43 Self::Unspecified => "RESOURCE_TYPE_UNSPECIFIED",
44 Self::Workbook => "RESOURCE_TYPE_WORKBOOK",
45 Self::Checklist => "RESOURCE_TYPE_CHECKLIST",
46 Self::Procedure => "RESOURCE_TYPE_PROCEDURE",
47 }
48 }
49 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
51 match value {
52 "RESOURCE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
53 "RESOURCE_TYPE_WORKBOOK" => Some(Self::Workbook),
54 "RESOURCE_TYPE_CHECKLIST" => Some(Self::Checklist),
55 "RESOURCE_TYPE_PROCEDURE" => Some(Self::Procedure),
56 _ => None,
57 }
58 }
59}
60pub mod usage_tracking_service_client {
62 #![allow(
63 unused_variables,
64 dead_code,
65 missing_docs,
66 clippy::wildcard_imports,
67 clippy::let_unit_value,
68 )]
69 use tonic::codegen::*;
70 use tonic::codegen::http::Uri;
71 #[derive(Debug, Clone)]
72 pub struct UsageTrackingServiceClient<T> {
73 inner: tonic::client::Grpc<T>,
74 }
75 impl UsageTrackingServiceClient<tonic::transport::Channel> {
76 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
78 where
79 D: TryInto<tonic::transport::Endpoint>,
80 D::Error: Into<StdError>,
81 {
82 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
83 Ok(Self::new(conn))
84 }
85 }
86 impl<T> UsageTrackingServiceClient<T>
87 where
88 T: tonic::client::GrpcService<tonic::body::Body>,
89 T::Error: Into<StdError>,
90 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
91 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
92 {
93 pub fn new(inner: T) -> Self {
94 let inner = tonic::client::Grpc::new(inner);
95 Self { inner }
96 }
97 pub fn with_origin(inner: T, origin: Uri) -> Self {
98 let inner = tonic::client::Grpc::with_origin(inner, origin);
99 Self { inner }
100 }
101 pub fn with_interceptor<F>(
102 inner: T,
103 interceptor: F,
104 ) -> UsageTrackingServiceClient<InterceptedService<T, F>>
105 where
106 F: tonic::service::Interceptor,
107 T::ResponseBody: Default,
108 T: tonic::codegen::Service<
109 http::Request<tonic::body::Body>,
110 Response = http::Response<
111 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
112 >,
113 >,
114 <T as tonic::codegen::Service<
115 http::Request<tonic::body::Body>,
116 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
117 {
118 UsageTrackingServiceClient::new(InterceptedService::new(inner, interceptor))
119 }
120 #[must_use]
125 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
126 self.inner = self.inner.send_compressed(encoding);
127 self
128 }
129 #[must_use]
131 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
132 self.inner = self.inner.accept_compressed(encoding);
133 self
134 }
135 #[must_use]
139 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
140 self.inner = self.inner.max_decoding_message_size(limit);
141 self
142 }
143 #[must_use]
147 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
148 self.inner = self.inner.max_encoding_message_size(limit);
149 self
150 }
151 pub async fn track_event(
152 &mut self,
153 request: impl tonic::IntoRequest<super::TrackEventRequest>,
154 ) -> std::result::Result<
155 tonic::Response<super::TrackEventResponse>,
156 tonic::Status,
157 > {
158 self.inner
159 .ready()
160 .await
161 .map_err(|e| {
162 tonic::Status::unknown(
163 format!("Service was not ready: {}", e.into()),
164 )
165 })?;
166 let codec = tonic::codec::ProstCodec::default();
167 let path = http::uri::PathAndQuery::from_static(
168 "/nominal.usage_tracking.v1.UsageTrackingService/TrackEvent",
169 );
170 let mut req = request.into_request();
171 req.extensions_mut()
172 .insert(
173 GrpcMethod::new(
174 "nominal.usage_tracking.v1.UsageTrackingService",
175 "TrackEvent",
176 ),
177 );
178 self.inner.unary(req, path, codec).await
179 }
180 }
181}