Skip to main content

nominal_api/conjure/endpoints/attachments/api/
attachment_service.rs

1use conjure_http::endpoint;
2/// The attachment service provides functionality for creating, updating, and archiving attachments uploaded to S3.
3#[conjure_http::conjure_endpoints(
4    name = "AttachmentService",
5    use_legacy_error_serialization
6)]
7pub trait AttachmentService<#[response_writer] O> {
8    ///The body type returned by the `get_content` method.
9    type GetContentBody: conjure_http::server::WriteBody<O> + 'static;
10    /// Create a new attachment. Assumes the file is already uploaded to S3 through the upload service.
11    #[endpoint(
12        method = POST,
13        path = "/attachments/v1/attachments",
14        name = "create",
15        produces = conjure_http::server::StdResponseSerializer
16    )]
17    fn create(
18        &self,
19        #[auth]
20        auth_: conjure_object::BearerToken,
21        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
22        request: super::super::super::super::objects::attachments::api::CreateAttachmentRequest,
23    ) -> Result<
24        super::super::super::super::objects::attachments::api::Attachment,
25        conjure_http::private::Error,
26    >;
27    /// Get an attachment by its RID.
28    #[endpoint(
29        method = GET,
30        path = "/attachments/v1/attachments/{rid}",
31        name = "get",
32        produces = conjure_http::server::StdResponseSerializer
33    )]
34    fn get(
35        &self,
36        #[auth]
37        auth_: conjure_object::BearerToken,
38        #[path(
39            name = "rid",
40            decoder = conjure_http::server::conjure::FromPlainDecoder,
41            safe
42        )]
43        rid: super::super::super::super::objects::api::rids::AttachmentRid,
44    ) -> Result<
45        super::super::super::super::objects::attachments::api::Attachment,
46        conjure_http::private::Error,
47    >;
48    /// Get a set of attachments by their RIDs.
49    #[endpoint(
50        method = POST,
51        path = "/attachments/v1/attachments/batch",
52        name = "getBatch",
53        produces = conjure_http::server::StdResponseSerializer
54    )]
55    fn get_batch(
56        &self,
57        #[auth]
58        auth_: conjure_object::BearerToken,
59        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
60        request: super::super::super::super::objects::attachments::api::GetAttachmentsRequest,
61    ) -> Result<
62        super::super::super::super::objects::attachments::api::GetAttachmentsResponse,
63        conjure_http::private::Error,
64    >;
65    /// Get the binary content of an attachment.
66    #[endpoint(
67        method = GET,
68        path = "/attachments/v1/attachments/{rid}/content",
69        name = "getContent",
70        produces = conjure_http::server::conjure::BinaryResponseSerializer
71    )]
72    fn get_content(
73        &self,
74        #[auth]
75        auth_: conjure_object::BearerToken,
76        #[path(
77            name = "rid",
78            decoder = conjure_http::server::conjure::FromPlainDecoder,
79            safe
80        )]
81        rid: super::super::super::super::objects::api::rids::AttachmentRid,
82    ) -> Result<Self::GetContentBody, conjure_http::private::Error>;
83    /// Get a pre-signed URI to download an attachment. The link expires in 1 minute.
84    #[endpoint(
85        method = GET,
86        path = "/attachments/v1/attachments/{rid}/uri",
87        name = "getUri",
88        produces = conjure_http::server::StdResponseSerializer
89    )]
90    fn get_uri(
91        &self,
92        #[auth]
93        auth_: conjure_object::BearerToken,
94        #[path(
95            name = "rid",
96            decoder = conjure_http::server::conjure::FromPlainDecoder,
97            safe
98        )]
99        rid: super::super::super::super::objects::api::rids::AttachmentRid,
100    ) -> Result<
101        super::super::super::super::objects::attachments::api::AttachmentUri,
102        conjure_http::private::Error,
103    >;
104    /// Update an attachment. Only the fields that are set in the request will be updated.
105    #[endpoint(
106        method = PUT,
107        path = "/attachments/v1/attachments/{rid}",
108        name = "update",
109        produces = conjure_http::server::StdResponseSerializer
110    )]
111    fn update(
112        &self,
113        #[auth]
114        auth_: conjure_object::BearerToken,
115        #[path(
116            name = "rid",
117            decoder = conjure_http::server::conjure::FromPlainDecoder,
118            safe
119        )]
120        rid: super::super::super::super::objects::api::rids::AttachmentRid,
121        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
122        request: super::super::super::super::objects::attachments::api::UpdateAttachmentRequest,
123    ) -> Result<
124        super::super::super::super::objects::attachments::api::Attachment,
125        conjure_http::private::Error,
126    >;
127    /// Archive an attachment.
128    #[endpoint(
129        method = PUT,
130        path = "/attachments/v1/attachments/{rid}/archive",
131        name = "archive"
132    )]
133    fn archive(
134        &self,
135        #[auth]
136        auth_: conjure_object::BearerToken,
137        #[path(
138            name = "rid",
139            decoder = conjure_http::server::conjure::FromPlainDecoder,
140            safe
141        )]
142        rid: super::super::super::super::objects::api::rids::AttachmentRid,
143    ) -> Result<(), conjure_http::private::Error>;
144    /// Unarchive an attachment.
145    #[endpoint(
146        method = PUT,
147        path = "/attachments/v1/attachments/{rid}/unarchive",
148        name = "unarchive"
149    )]
150    fn unarchive(
151        &self,
152        #[auth]
153        auth_: conjure_object::BearerToken,
154        #[path(
155            name = "rid",
156            decoder = conjure_http::server::conjure::FromPlainDecoder,
157            safe
158        )]
159        rid: super::super::super::super::objects::api::rids::AttachmentRid,
160    ) -> Result<(), conjure_http::private::Error>;
161}
162/// The attachment service provides functionality for creating, updating, and archiving attachments uploaded to S3.
163#[conjure_http::conjure_endpoints(
164    name = "AttachmentService",
165    use_legacy_error_serialization
166)]
167pub trait AsyncAttachmentService<#[response_writer] O> {
168    ///The body type returned by the `get_content` method.
169    type GetContentBody: conjure_http::server::AsyncWriteBody<O> + 'static + Send;
170    /// Create a new attachment. Assumes the file is already uploaded to S3 through the upload service.
171    #[endpoint(
172        method = POST,
173        path = "/attachments/v1/attachments",
174        name = "create",
175        produces = conjure_http::server::StdResponseSerializer
176    )]
177    async fn create(
178        &self,
179        #[auth]
180        auth_: conjure_object::BearerToken,
181        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
182        request: super::super::super::super::objects::attachments::api::CreateAttachmentRequest,
183    ) -> Result<
184        super::super::super::super::objects::attachments::api::Attachment,
185        conjure_http::private::Error,
186    >;
187    /// Get an attachment by its RID.
188    #[endpoint(
189        method = GET,
190        path = "/attachments/v1/attachments/{rid}",
191        name = "get",
192        produces = conjure_http::server::StdResponseSerializer
193    )]
194    async fn get(
195        &self,
196        #[auth]
197        auth_: conjure_object::BearerToken,
198        #[path(
199            name = "rid",
200            decoder = conjure_http::server::conjure::FromPlainDecoder,
201            safe
202        )]
203        rid: super::super::super::super::objects::api::rids::AttachmentRid,
204    ) -> Result<
205        super::super::super::super::objects::attachments::api::Attachment,
206        conjure_http::private::Error,
207    >;
208    /// Get a set of attachments by their RIDs.
209    #[endpoint(
210        method = POST,
211        path = "/attachments/v1/attachments/batch",
212        name = "getBatch",
213        produces = conjure_http::server::StdResponseSerializer
214    )]
215    async fn get_batch(
216        &self,
217        #[auth]
218        auth_: conjure_object::BearerToken,
219        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
220        request: super::super::super::super::objects::attachments::api::GetAttachmentsRequest,
221    ) -> Result<
222        super::super::super::super::objects::attachments::api::GetAttachmentsResponse,
223        conjure_http::private::Error,
224    >;
225    /// Get the binary content of an attachment.
226    #[endpoint(
227        method = GET,
228        path = "/attachments/v1/attachments/{rid}/content",
229        name = "getContent",
230        produces = conjure_http::server::conjure::BinaryResponseSerializer
231    )]
232    async fn get_content(
233        &self,
234        #[auth]
235        auth_: conjure_object::BearerToken,
236        #[path(
237            name = "rid",
238            decoder = conjure_http::server::conjure::FromPlainDecoder,
239            safe
240        )]
241        rid: super::super::super::super::objects::api::rids::AttachmentRid,
242    ) -> Result<Self::GetContentBody, conjure_http::private::Error>;
243    /// Get a pre-signed URI to download an attachment. The link expires in 1 minute.
244    #[endpoint(
245        method = GET,
246        path = "/attachments/v1/attachments/{rid}/uri",
247        name = "getUri",
248        produces = conjure_http::server::StdResponseSerializer
249    )]
250    async fn get_uri(
251        &self,
252        #[auth]
253        auth_: conjure_object::BearerToken,
254        #[path(
255            name = "rid",
256            decoder = conjure_http::server::conjure::FromPlainDecoder,
257            safe
258        )]
259        rid: super::super::super::super::objects::api::rids::AttachmentRid,
260    ) -> Result<
261        super::super::super::super::objects::attachments::api::AttachmentUri,
262        conjure_http::private::Error,
263    >;
264    /// Update an attachment. Only the fields that are set in the request will be updated.
265    #[endpoint(
266        method = PUT,
267        path = "/attachments/v1/attachments/{rid}",
268        name = "update",
269        produces = conjure_http::server::StdResponseSerializer
270    )]
271    async fn update(
272        &self,
273        #[auth]
274        auth_: conjure_object::BearerToken,
275        #[path(
276            name = "rid",
277            decoder = conjure_http::server::conjure::FromPlainDecoder,
278            safe
279        )]
280        rid: super::super::super::super::objects::api::rids::AttachmentRid,
281        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
282        request: super::super::super::super::objects::attachments::api::UpdateAttachmentRequest,
283    ) -> Result<
284        super::super::super::super::objects::attachments::api::Attachment,
285        conjure_http::private::Error,
286    >;
287    /// Archive an attachment.
288    #[endpoint(
289        method = PUT,
290        path = "/attachments/v1/attachments/{rid}/archive",
291        name = "archive"
292    )]
293    async fn archive(
294        &self,
295        #[auth]
296        auth_: conjure_object::BearerToken,
297        #[path(
298            name = "rid",
299            decoder = conjure_http::server::conjure::FromPlainDecoder,
300            safe
301        )]
302        rid: super::super::super::super::objects::api::rids::AttachmentRid,
303    ) -> Result<(), conjure_http::private::Error>;
304    /// Unarchive an attachment.
305    #[endpoint(
306        method = PUT,
307        path = "/attachments/v1/attachments/{rid}/unarchive",
308        name = "unarchive"
309    )]
310    async fn unarchive(
311        &self,
312        #[auth]
313        auth_: conjure_object::BearerToken,
314        #[path(
315            name = "rid",
316            decoder = conjure_http::server::conjure::FromPlainDecoder,
317            safe
318        )]
319        rid: super::super::super::super::objects::api::rids::AttachmentRid,
320    ) -> Result<(), conjure_http::private::Error>;
321}
322/// The attachment service provides functionality for creating, updating, and archiving attachments uploaded to S3.
323#[conjure_http::conjure_endpoints(
324    name = "AttachmentService",
325    use_legacy_error_serialization,
326    local
327)]
328pub trait LocalAsyncAttachmentService<#[response_writer] O> {
329    ///The body type returned by the `get_content` method.
330    type GetContentBody: conjure_http::server::LocalAsyncWriteBody<O> + 'static;
331    /// Create a new attachment. Assumes the file is already uploaded to S3 through the upload service.
332    #[endpoint(
333        method = POST,
334        path = "/attachments/v1/attachments",
335        name = "create",
336        produces = conjure_http::server::StdResponseSerializer
337    )]
338    async fn create(
339        &self,
340        #[auth]
341        auth_: conjure_object::BearerToken,
342        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
343        request: super::super::super::super::objects::attachments::api::CreateAttachmentRequest,
344    ) -> Result<
345        super::super::super::super::objects::attachments::api::Attachment,
346        conjure_http::private::Error,
347    >;
348    /// Get an attachment by its RID.
349    #[endpoint(
350        method = GET,
351        path = "/attachments/v1/attachments/{rid}",
352        name = "get",
353        produces = conjure_http::server::StdResponseSerializer
354    )]
355    async fn get(
356        &self,
357        #[auth]
358        auth_: conjure_object::BearerToken,
359        #[path(
360            name = "rid",
361            decoder = conjure_http::server::conjure::FromPlainDecoder,
362            safe
363        )]
364        rid: super::super::super::super::objects::api::rids::AttachmentRid,
365    ) -> Result<
366        super::super::super::super::objects::attachments::api::Attachment,
367        conjure_http::private::Error,
368    >;
369    /// Get a set of attachments by their RIDs.
370    #[endpoint(
371        method = POST,
372        path = "/attachments/v1/attachments/batch",
373        name = "getBatch",
374        produces = conjure_http::server::StdResponseSerializer
375    )]
376    async fn get_batch(
377        &self,
378        #[auth]
379        auth_: conjure_object::BearerToken,
380        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
381        request: super::super::super::super::objects::attachments::api::GetAttachmentsRequest,
382    ) -> Result<
383        super::super::super::super::objects::attachments::api::GetAttachmentsResponse,
384        conjure_http::private::Error,
385    >;
386    /// Get the binary content of an attachment.
387    #[endpoint(
388        method = GET,
389        path = "/attachments/v1/attachments/{rid}/content",
390        name = "getContent",
391        produces = conjure_http::server::conjure::BinaryResponseSerializer
392    )]
393    async fn get_content(
394        &self,
395        #[auth]
396        auth_: conjure_object::BearerToken,
397        #[path(
398            name = "rid",
399            decoder = conjure_http::server::conjure::FromPlainDecoder,
400            safe
401        )]
402        rid: super::super::super::super::objects::api::rids::AttachmentRid,
403    ) -> Result<Self::GetContentBody, conjure_http::private::Error>;
404    /// Get a pre-signed URI to download an attachment. The link expires in 1 minute.
405    #[endpoint(
406        method = GET,
407        path = "/attachments/v1/attachments/{rid}/uri",
408        name = "getUri",
409        produces = conjure_http::server::StdResponseSerializer
410    )]
411    async fn get_uri(
412        &self,
413        #[auth]
414        auth_: conjure_object::BearerToken,
415        #[path(
416            name = "rid",
417            decoder = conjure_http::server::conjure::FromPlainDecoder,
418            safe
419        )]
420        rid: super::super::super::super::objects::api::rids::AttachmentRid,
421    ) -> Result<
422        super::super::super::super::objects::attachments::api::AttachmentUri,
423        conjure_http::private::Error,
424    >;
425    /// Update an attachment. Only the fields that are set in the request will be updated.
426    #[endpoint(
427        method = PUT,
428        path = "/attachments/v1/attachments/{rid}",
429        name = "update",
430        produces = conjure_http::server::StdResponseSerializer
431    )]
432    async fn update(
433        &self,
434        #[auth]
435        auth_: conjure_object::BearerToken,
436        #[path(
437            name = "rid",
438            decoder = conjure_http::server::conjure::FromPlainDecoder,
439            safe
440        )]
441        rid: super::super::super::super::objects::api::rids::AttachmentRid,
442        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
443        request: super::super::super::super::objects::attachments::api::UpdateAttachmentRequest,
444    ) -> Result<
445        super::super::super::super::objects::attachments::api::Attachment,
446        conjure_http::private::Error,
447    >;
448    /// Archive an attachment.
449    #[endpoint(
450        method = PUT,
451        path = "/attachments/v1/attachments/{rid}/archive",
452        name = "archive"
453    )]
454    async fn archive(
455        &self,
456        #[auth]
457        auth_: conjure_object::BearerToken,
458        #[path(
459            name = "rid",
460            decoder = conjure_http::server::conjure::FromPlainDecoder,
461            safe
462        )]
463        rid: super::super::super::super::objects::api::rids::AttachmentRid,
464    ) -> Result<(), conjure_http::private::Error>;
465    /// Unarchive an attachment.
466    #[endpoint(
467        method = PUT,
468        path = "/attachments/v1/attachments/{rid}/unarchive",
469        name = "unarchive"
470    )]
471    async fn unarchive(
472        &self,
473        #[auth]
474        auth_: conjure_object::BearerToken,
475        #[path(
476            name = "rid",
477            decoder = conjure_http::server::conjure::FromPlainDecoder,
478            safe
479        )]
480        rid: super::super::super::super::objects::api::rids::AttachmentRid,
481    ) -> Result<(), conjure_http::private::Error>;
482}