pub struct Operation { /* private fields */ }Expand description
A request the client has not sent yet. Generated service methods build one from a
Route; crate::Client::request builds one for anything the model does not cover.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn retry_policy(&self) -> Option<&RetryPolicy>
pub fn retry_policy(&self) -> Option<&RetryPolicy>
The retry policy the operation will be sent under, once one has been settled.
Sourcepub fn query(&mut self, name: &str, value: impl Display) -> &mut Operation
pub fn query(&mut self, name: &str, value: impl Display) -> &mut Operation
Adds a query parameter.
Sourcepub fn query_optional<T: Display>(
&mut self,
name: &str,
value: Option<&T>,
) -> &mut Operation
pub fn query_optional<T: Display>( &mut self, name: &str, value: Option<&T>, ) -> &mut Operation
Adds a query parameter when there is a value for it.
Sourcepub fn query_all<T: Display>(
&mut self,
name: &str,
values: &[T],
) -> &mut Operation
pub fn query_all<T: Display>( &mut self, name: &str, values: &[T], ) -> &mut Operation
Adds a query parameter once per value, the way Rails reads ids[]=1&ids[]=2.
Sourcepub fn query_all_optional<T: Display>(
&mut self,
name: &str,
values: Option<&[T]>,
) -> &mut Operation
pub fn query_all_optional<T: Display>( &mut self, name: &str, values: Option<&[T]>, ) -> &mut Operation
Adds a repeated query parameter when there are values for it.
Sourcepub fn header(&mut self, name: HeaderName, value: HeaderValue) -> &mut Operation
pub fn header(&mut self, name: HeaderName, value: HeaderValue) -> &mut Operation
Adds a header of the caller’s own. Credentials go on through the client’s
crate::AuthStrategy, not here.
Sourcepub fn json<T: Serialize + ?Sized>(
&mut self,
body: &T,
) -> Result<&mut Operation, Error>
pub fn json<T: Serialize + ?Sized>( &mut self, body: &T, ) -> Result<&mut Operation, Error>
Sends a JSON body.
Sourcepub fn body_bytes(
&mut self,
content_type: impl Into<String>,
bytes: Bytes,
) -> &mut Operation
pub fn body_bytes( &mut self, content_type: impl Into<String>, bytes: Bytes, ) -> &mut Operation
A body the caller encoded, for the representations the model does not describe.
Sourcepub fn info(&mut self, info: OperationInfo) -> &mut Operation
pub fn info(&mut self, info: OperationInfo) -> &mut Operation
Replaces the whole of what the operation announces itself as to the client’s
crate::observability::Hooks.
Sourcepub fn operation_name(
&mut self,
name: impl Into<Cow<'static, str>>,
) -> &mut Operation
pub fn operation_name( &mut self, name: impl Into<Cow<'static, str>>, ) -> &mut Operation
Announces the operation as something other than the route it sends.
Sourcepub fn resource_type(
&mut self,
resource_type: impl Into<Cow<'static, str>>,
) -> &mut Operation
pub fn resource_type( &mut self, resource_type: impl Into<Cow<'static, str>>, ) -> &mut Operation
Names the kind of record the operation acts on.
Sourcepub fn resource_id(&mut self, resource_id: impl Display) -> &mut Operation
pub fn resource_id(&mut self, resource_id: impl Display) -> &mut Operation
Names the record the operation acts on. Generated methods set this from the path parameter that names it.
Sourcepub fn idempotent(&mut self, idempotent: bool) -> &mut Operation
pub fn idempotent(&mut self, idempotent: bool) -> &mut Operation
Marks the operation as safe to resend, or not, regardless of its HTTP method. A POST marked idempotent is retried like a GET.
Sourcepub fn no_retry(&mut self) -> &mut Operation
pub fn no_retry(&mut self) -> &mut Operation
Sends the operation once, whatever the route or the client would have allowed.
Sourcepub fn retry(&mut self, policy: RetryPolicy) -> &mut Operation
pub fn retry(&mut self, policy: RetryPolicy) -> &mut Operation
Sends the operation under a policy of the caller’s own. The client’s ceilings still apply.