pub struct Shopify { /* private fields */ }Expand description
The plugin handle for app routes.
use autumn_plugin_shopify::Shopify;
use autumn_web::prelude::*;
#[get("/shop-name")]
#[public]
async fn shop_name(shopify: Shopify) -> AutumnResult<String> {
let client = shopify.client().map_err(|e| e.to_autumn_error())?;
let info = client.shop_info().await.map_err(|e| e.to_autumn_error())?;
Ok(info.name)
}Extraction fails with 503 when the app does not use the plugin.
Implementations§
Source§impl Shopify
impl Shopify
Sourcepub fn from_state(state: &AppState) -> Result<Self>
pub fn from_state(state: &AppState) -> Result<Self>
Read the handle from the app state.
§Errors
Returns Error::MissingRuntime when the app does not use the
plugin.
Sourcepub const fn runtime(&self) -> &Arc<ShopifyRuntime> ⓘ
pub const fn runtime(&self) -> &Arc<ShopifyRuntime> ⓘ
The runtime.
Sourcepub fn client(&self) -> Result<ShopifyClient>
pub fn client(&self) -> Result<ShopifyClient>
Sourcepub async fn client_for(&self, shop: &ShopDomain) -> Result<ShopifyClient>
pub async fn client_for(&self, shop: &ShopDomain) -> Result<ShopifyClient>
Sourcepub fn install_url(shop: &ShopDomain) -> String
pub fn install_url(shop: &ShopDomain) -> String
The local URL that starts an install for shop. Send the browser
there on Error::NotInstalled or Error::Reauthorize.
Trait Implementations§
Source§impl FromRequestParts<AppState> for Shopify
impl FromRequestParts<AppState> for Shopify
Source§type Rejection = AutumnError
type Rejection = AutumnError
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Auto Trait Implementations§
impl !RefUnwindSafe for Shopify
impl !UnwindSafe for Shopify
impl Forget for Shopify
impl Freeze for Shopify
impl Send for Shopify
impl Sync for Shopify
impl Unpin for Shopify
impl UnsafeUnpin for Shopify
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
Source§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Source§fn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
Perform the extraction.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
Open a deferred
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.