rusty_cat/presigned/
upload_part.rs1use reqwest::header::HeaderMap;
2use reqwest::Method;
3
4#[derive(Debug, Clone)]
6pub struct PresignedUploadPart {
7 pub part_number: u64,
10 pub offset: u64,
12 pub size: u64,
14 pub method: Method,
16 pub url: String,
18 pub provider_part_id: Option<String>,
20 pub expires_at_unix_secs: Option<u64>,
22 pub headers: HeaderMap,
24}
25
26impl PresignedUploadPart {
27 pub fn put(part_number: u64, offset: u64, size: u64, url: impl Into<String>) -> Self {
29 Self {
30 part_number,
31 offset,
32 size,
33 method: Method::PUT,
34 url: url.into(),
35 provider_part_id: None,
36 expires_at_unix_secs: None,
37 headers: HeaderMap::new(),
38 }
39 }
40
41 pub fn with_provider_part_id(mut self, id: impl Into<String>) -> Self {
43 self.provider_part_id = Some(id.into());
44 self
45 }
46
47 pub fn with_expires_at_unix_secs(mut self, expires_at_unix_secs: u64) -> Self {
49 self.expires_at_unix_secs = Some(expires_at_unix_secs);
50 self
51 }
52
53 pub fn with_headers(mut self, headers: HeaderMap) -> Self {
55 self.headers = headers;
56 self
57 }
58}