pub struct ShopifyPlugin { /* private fields */ }Expand description
Shopify as an Autumn plugin.
Implementations§
Source§impl ShopifyPlugin
impl ShopifyPlugin
Sourcepub fn configure(
self,
configure: impl Fn(&mut ShopifyConfig) + Send + Sync + 'static,
) -> Self
pub fn configure( self, configure: impl Fn(&mut ShopifyConfig) + Send + Sync + 'static, ) -> Self
Change config values in code. The closure runs after the file and the environment, so its values win. It cannot set secrets.
Sourcepub fn webhook(
self,
topic: impl Into<String>,
handler: impl IntoWebhookHandler,
) -> Self
pub fn webhook( self, topic: impl Into<String>, handler: impl IntoWebhookHandler, ) -> Self
Handle webhooks for topic, for example orders/create.
A malformed or repeated topic stops the startup.
Sourcepub fn token_store(self, store: Arc<dyn TokenStore>) -> Self
pub fn token_store(self, store: Arc<dyn TokenStore>) -> Self
Replace the in-memory token store.
Sourcepub fn delivery_store(self, store: Arc<dyn DeliveryStore>) -> Self
pub fn delivery_store(self, store: Arc<dyn DeliveryStore>) -> Self
Replace the in-memory duplicate-delivery store.
Sourcepub fn on_install<F, Fut>(self, handler: F) -> Selfwhere
F: Fn(InstallContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AutumnResult<()>> + Send + 'static,
pub fn on_install<F, Fut>(self, handler: F) -> Selfwhere
F: Fn(InstallContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = AutumnResult<()>> + Send + 'static,
Run handler after each install, when the token is stored. Use it
to save a shop record or to subscribe webhooks. An error gives 500.
The token stays in the store.
Sourcepub fn admin_base_url(self, base_url: impl Into<String>) -> Self
pub fn admin_base_url(self, base_url: impl Into<String>) -> Self
Send Admin API and OAuth calls to base_url instead of
https://{shop}. For tests only: the startup fails unless the host
is localhost, 127.0.0.1, or [::1], because the calls carry the
client secret and the tokens.
Sourcepub fn build_runtime(&self, config: ShopifyConfig) -> Result<ShopifyRuntime>
pub fn build_runtime(&self, config: ShopifyConfig) -> Result<ShopifyRuntime>
Build the runtime from a loaded config: apply the builder closures, validate, and register the webhook handlers.
The startup hook calls this with ShopifyConfig::load. Tests call
it with ShopifyConfig::from_sources.
§Errors
Returns Error::Config when the config is not valid or a webhook
topic is malformed or repeated.
Trait Implementations§
Source§impl Clone for ShopifyPlugin
impl Clone for ShopifyPlugin
Source§impl Debug for ShopifyPlugin
impl Debug for ShopifyPlugin
Source§impl Default for ShopifyPlugin
impl Default for ShopifyPlugin
Source§impl Plugin for ShopifyPlugin
impl Plugin for ShopifyPlugin
Source§fn contract(&self) -> Option<PluginContract>
fn contract(&self) -> Option<PluginContract>
Declare the supported autumn-web range. A mismatch fails at
registration with both versions named.
Source§fn name(&self) -> Cow<'static, str>
fn name(&self) -> Cow<'static, str>
Source§fn build(self, app: AppBuilder) -> AppBuilder
fn build(self, app: AppBuilder) -> AppBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for ShopifyPlugin
impl !UnwindSafe for ShopifyPlugin
impl Forget for ShopifyPlugin
impl Freeze for ShopifyPlugin
impl Send for ShopifyPlugin
impl Sync for ShopifyPlugin
impl Unpin for ShopifyPlugin
impl UnsafeUnpin for ShopifyPlugin
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<P> Plugins for Pwhere
P: Plugin,
impl<P> Plugins for Pwhere
P: Plugin,
Source§fn apply(self, app: AppBuilder) -> AppBuilder
fn apply(self, app: AppBuilder) -> AppBuilder
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>
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.