pub struct ShareClient { /* private fields */ }Expand description
Registers and revokes the caller’s share links.
Implementations§
Sourcepub fn new(session: Session, api_base_url: &str) -> Result<Self, ShareError>
pub fn new(session: Session, api_base_url: &str) -> Result<Self, ShareError>
Build a share client against the API root (e.g. https://api.example.com), the
origin the generated operation paths hang off.
§Errors
ShareError::InvalidBaseUrl when api_base_url does not parse.
Sourcepub async fn issue(
&self,
link: &ShareLink,
publication: &SharePublication,
) -> Result<(), ShareError>
pub async fn issue( &self, link: &ShareLink, publication: &SharePublication, ) -> Result<(), ShareError>
Register link with the server, so its public path serves what publication names.
An opaque id registers once. The server refuses any id it already holds, the caller’s
own included, with the same 400 error.share.malformed it gives a malformed record
(#553), so re-sending a request whose first attempt landed surfaces as
ShareError::Malformed, not as success. That refusal is not read as success here: it
is also the answer for an id the caller revoked, and its English detail is not a stable
discriminator. A caller whose request timed out recovers by revoking the id (revoke
answers 204 whether or not the first attempt landed) and issuing a freshly minted
link.
§Errors
The refusals ShareError names, and ShareError::WrongEcho when the server
confirms a different link.
Sourcepub async fn revoke(&self, opaque_id: &str) -> Result<(), ShareError>
pub async fn revoke(&self, opaque_id: &str) -> Result<(), ShareError>
Revoke the caller’s link opaque_id (lowercase hex).
The server answers 204 whether the link was the caller’s, was already revoked, or never
existed, so success says the link is not live for this caller, not that one was revoked.
§Errors
The refusals ShareError names.
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more