[][src]Struct pinata_sdk::PinByJson

pub struct PinByJson<S: Serialize> { /* fields omitted */ }

Request object to pin json

Example

let api = PinataApi::new("api_key", "secret_api_key").unwrap();
 
let mut json_data = HashMap::new();
json_data.insert("name", "user");
 
let result = api.pin_json(PinByJson::new(json_data)).await;
 
if let Ok(pinned_object) = result {
  let hash = pinned_object.ipfs_hash;
}

Methods

impl<S> PinByJson<S> where
    S: Serialize
[src]

pub fn new(json_data: S) -> PinByJson<S>[src]

Create a new default PinByHash object with only the hash to pin set.

To set the pinata metadata and pinata options use the set_metadata() and set_options() chainable function to set those values.

pub fn set_metadata(self, keyvalues: MetadataKeyValues) -> PinByJson<S>[src]

Consumes the current PinByJson and returns a new PinByJson with keyvalues metadata set

pub fn set_metadata_with_name<IntoStr>(
    self,
    name: IntoStr,
    keyvalues: MetadataKeyValues
) -> PinByJson<S> where
    IntoStr: Into<String>, 
[src]

Consumes the current PinByJson and returns a new PinByJson with keyvalues metadata set

pub fn set_options(self, options: PinOptions) -> PinByJson<S>[src]

Consumes the PinByHash and returns a new PinByHash with pinata options set.

Trait Implementations

impl<S: Serialize> Serialize for PinByJson<S> where
    S: Serialize
[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for PinByJson<S> where
    S: RefUnwindSafe

impl<S> Send for PinByJson<S> where
    S: Send

impl<S> Sync for PinByJson<S> where
    S: Sync

impl<S> Unpin for PinByJson<S> where
    S: Unpin

impl<S> UnwindSafe for PinByJson<S> where
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.