pub struct ResourcePath {
pub http_method: HttpMethod,
pub operation: ResourceOperation,
pub ids: &'static [&'static str],
pub template: &'static str,
}Expand description
A path configuration for a REST resource operation.
Each ResourcePath defines how to access a resource for a specific
operation, including the HTTP method, required IDs, and URL template.
§Path Templates
Templates use {id_name} placeholders for ID interpolation:
products/{id}- Single IDproducts/{product_id}/variants/{id}- Multiple IDs
§Example
use shopify_sdk::rest::{ResourcePath, ResourceOperation};
use shopify_sdk::HttpMethod;
const PRODUCT_FIND: ResourcePath = ResourcePath::new(
HttpMethod::Get,
ResourceOperation::Find,
&["id"],
"products/{id}",
);Fields§
§http_method: HttpMethodThe HTTP method for this path.
operation: ResourceOperationThe operation this path is used for.
ids: &'static [&'static str]Required ID parameters in order (e.g., ["product_id", "id"]).
template: &'static strThe URL template with {id} placeholders.
Implementations§
Source§impl ResourcePath
impl ResourcePath
Sourcepub const fn new(
http_method: HttpMethod,
operation: ResourceOperation,
ids: &'static [&'static str],
template: &'static str,
) -> Self
pub const fn new( http_method: HttpMethod, operation: ResourceOperation, ids: &'static [&'static str], template: &'static str, ) -> Self
Creates a new ResourcePath.
This is a const fn to allow paths to be defined as constants.
§Arguments
http_method- The HTTP method for this pathoperation- The operation this path handlesids- Required ID parameter names in ordertemplate- The URL template with{id}placeholders
Sourcepub fn matches_ids(&self, available_ids: &[&str]) -> bool
pub fn matches_ids(&self, available_ids: &[&str]) -> bool
Checks if all required IDs are available.
§Arguments
available_ids- Slice of available ID parameter names
Trait Implementations§
Source§impl Clone for ResourcePath
impl Clone for ResourcePath
Source§fn clone(&self) -> ResourcePath
fn clone(&self) -> ResourcePath
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResourcePath
impl Debug for ResourcePath
Source§impl PartialEq for ResourcePath
impl PartialEq for ResourcePath
impl Copy for ResourcePath
impl Eq for ResourcePath
impl StructuralPartialEq for ResourcePath
Auto Trait Implementations§
impl Freeze for ResourcePath
impl RefUnwindSafe for ResourcePath
impl Send for ResourcePath
impl Sync for ResourcePath
impl Unpin for ResourcePath
impl UnwindSafe for ResourcePath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.