pub struct Ipfs {
pub read_uri: Option<String>,
pub write_uri: Option<String>,
pub pinata_api_key: Option<String>,
pub pinata_api_secret: Option<String>,
}Expand description
IPFS connection parameters for upload/fetch operations.
Configure read/write gateway URIs and optional Pinata API credentials.
Pass an instance to MetadataApi::with_ipfs or directly to
upload_app_data_to_pinata.
§Example
use cow_app_data::Ipfs;
let ipfs = Ipfs::default()
.with_read_uri("https://my-gateway.io/ipfs")
.with_pinata("my-api-key", "my-api-secret");
assert_eq!(ipfs.read_uri.as_deref(), Some("https://my-gateway.io/ipfs"));Fields§
§read_uri: Option<String>IPFS read gateway URI (defaults to DEFAULT_IPFS_READ_URI).
write_uri: Option<String>IPFS write gateway URI (defaults to DEFAULT_IPFS_WRITE_URI).
pinata_api_key: Option<String>Pinata API key for authenticated uploads.
pinata_api_secret: Option<String>Pinata API secret for authenticated uploads.
Implementations§
Source§impl Ipfs
impl Ipfs
Sourcepub fn with_read_uri(self, uri: impl Into<String>) -> Self
pub fn with_read_uri(self, uri: impl Into<String>) -> Self
Set the IPFS read gateway URI.
Overrides the default DEFAULT_IPFS_READ_URI (cloudflare-ipfs.com)
for all fetch operations.
§Parameters
uri— the base URL of the IPFS read gateway (e.g."https://my-gateway.io/ipfs").
§Returns
self with read_uri set.
Sourcepub fn with_write_uri(self, uri: impl Into<String>) -> Self
pub fn with_write_uri(self, uri: impl Into<String>) -> Self
Set the IPFS write gateway URI.
Overrides the default DEFAULT_IPFS_WRITE_URI (api.pinata.cloud)
for all upload operations.
§Parameters
uri— the base URL of the IPFS write gateway.
§Returns
self with write_uri set.
Sourcepub fn with_pinata(
self,
api_key: impl Into<String>,
api_secret: impl Into<String>,
) -> Self
pub fn with_pinata( self, api_key: impl Into<String>, api_secret: impl Into<String>, ) -> Self
Set Pinata API credentials for authenticated uploads.
Both the API key and secret are required for
upload_app_data_to_pinata to succeed. Obtain them from the Pinata
dashboard.
§Parameters
api_key— your Pinata API key.api_secret— your Pinata API secret.
§Returns
self with both pinata_api_key and pinata_api_secret set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ipfs
impl RefUnwindSafe for Ipfs
impl Send for Ipfs
impl Sync for Ipfs
impl Unpin for Ipfs
impl UnsafeUnpin for Ipfs
impl UnwindSafe for Ipfs
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
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<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.