Skip to content

Files

Latest commit

smrz2001Github Automation
and
Github Automation
Feb 24, 2025
172abb0 · Feb 24, 2025

History

History

kubo-rpc-server

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Aug 25, 2023
Jan 29, 2024
Feb 24, 2025
Jan 29, 2024
Jan 29, 2024
Feb 24, 2025
Aug 25, 2023
Aug 25, 2023
Feb 24, 2025
Feb 24, 2025

Rust API for ceramic-kubo-rpc-server

This is the Kubo RPC API for working with IPLD data on IPFS This API only defines a small subset of the official API.

Overview

This client/server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • API version: 0.52.0
  • Build date: 2025-02-24T18:07:20.918982326Z[Etc/UTC]

This autogenerated project defines an API crate ceramic-kubo-rpc-server which contains:

  • An Api trait defining the API in Rust.
  • Data types representing the underlying data model.
  • A Client type which implements Api and issues HTTP requests for each operation.
  • A router which accepts HTTP requests and invokes the appropriate Api method for each operation.

It also contains an example server and client which make use of ceramic-kubo-rpc-server:

  • The example server starts up a web server using the ceramic-kubo-rpc-server router, and supplies a trivial implementation of Api which returns failure for every operation.
  • The example client provides a CLI which lets you invoke any single operation on the ceramic-kubo-rpc-server client by passing appropriate arguments on the command line.

You can use the example server and client as a basis for your own code. See below for more detail on implementing a server.

Examples

Run examples with:

cargo run --example <example-name>

To pass in arguments to the examples, put them after --, for example:

cargo run --example client -- --help

Running the example server

To run the server, follow these simple steps:

cargo run --example server

Running the example client

To run a client, follow one of the following simple steps:

cargo run --example client BlockGetPost
cargo run --example client BlockStatPost
cargo run --example client DagGetPost
cargo run --example client DagResolvePost
cargo run --example client IdPost
cargo run --example client PinAddPost
cargo run --example client PinRmPost
cargo run --example client SwarmConnectPost
cargo run --example client SwarmPeersPost
cargo run --example client VersionPost

HTTPS

The examples can be run in HTTPS mode by passing in the flag --https, for example:

cargo run --example server -- --https

This will use the keys/certificates from the examples directory. Note that the server chain is signed with CN=localhost.

Using the generated library

The generated library has a few optional features that can be activated through Cargo.

  • server
    • This defaults to enabled and creates the basic skeleton of a server implementation based on hyper
    • To create the server stack you'll need to provide an implementation of the API trait to provide the server function.
  • client
    • This defaults to enabled and creates the basic skeleton of a client implementation based on hyper
    • The constructed client implements the API trait by making remote API call.
  • conversions
    • This defaults to disabled and creates extra derives on models to allow "transmogrification" between objects of structurally similar types.

See https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section for how to use features in your Cargo.toml.

Documentation for API Endpoints

All URIs are relative to /api/v0

Method HTTP request Description
**** POST /block/get Get a single IPFS block
**** POST /block/stat Report statistics about a block
**** POST /dag/get Get an IPLD node from IPFS
**** POST /dag/resolve Resolve an IPFS path to a DAG node
**** POST /id Report identifying information about a node
**** POST /pin/add Add a block to the pin store
**** POST /pin/rm Remove a block from the pin store
**** POST /swarm/connect Connect to peers
**** POST /swarm/peers Report connected peers
**** POST /version Report server version

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author