ipfs_api_prelude/request/
name.rs

1// Copyright 2017 rust-ipfs-api Developers
2//
3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7//
8
9use crate::request::ApiRequest;
10use serde::Serialize;
11
12#[derive(Serialize)]
13pub struct NamePublish<'a, 'b, 'c, 'd> {
14    #[serde(rename = "arg")]
15    pub path: &'a str,
16
17    pub resolve: bool,
18
19    pub lifetime: Option<&'b str>,
20
21    pub ttl: Option<&'c str>,
22
23    pub key: Option<&'d str>,
24}
25
26impl<'a, 'b, 'c, 'd> ApiRequest for NamePublish<'a, 'b, 'c, 'd> {
27    const PATH: &'static str = "/name/publish";
28}
29
30#[derive(Serialize)]
31pub struct NameResolve<'a> {
32    #[serde(rename = "arg")]
33    pub name: Option<&'a str>,
34
35    pub recursive: bool,
36
37    pub nocache: bool,
38}
39
40impl<'a> ApiRequest for NameResolve<'a> {
41    const PATH: &'static str = "/name/resolve";
42}