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