Skip to content

Latest commit

 

History

History
184 lines (142 loc) · 7.47 KB

File metadata and controls

184 lines (142 loc) · 7.47 KB

Rust API for ceramic-api-server

This is the Ceramic API for working with streams and events

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.57.0
  • Build date: 2025-11-26T20:42:09.837612539Z[Etc/UTC]

This autogenerated project defines an API crate ceramic-api-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-api-server:

  • The example server starts up a web server using the ceramic-api-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-api-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 ConfigNetworkGet
cargo run --example client ConfigNetworkOptions
cargo run --example client DebugHeapGet
cargo run --example client DebugHeapOptions
cargo run --example client EventsEventIdGet
cargo run --example client EventsEventIdOptions
cargo run --example client EventsOptions
cargo run --example client ExperimentalEventsSepSepValueGet
cargo run --example client ExperimentalEventsSepSepValueOptions
cargo run --example client ExperimentalInterestsGet
cargo run --example client ExperimentalInterestsOptions
cargo run --example client FeedEventsGet
cargo run --example client FeedEventsOptions
cargo run --example client FeedResumeTokenGet
cargo run --example client FeedResumeTokenOptions
cargo run --example client InterestsOptions
cargo run --example client InterestsSortKeySortValueOptions
cargo run --example client InterestsSortKeySortValuePost
cargo run --example client LivenessGet
cargo run --example client LivenessOptions
cargo run --example client PeersGet
cargo run --example client PeersOptions
cargo run --example client PeersPost
cargo run --example client StreamsStreamIdGet
cargo run --example client StreamsStreamIdOptions
cargo run --example client VersionGet
cargo run --example client VersionOptions
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 /ceramic

Method HTTP request Description
**** GET /config/network Get info about the Ceramic network the node is connected to
**** OPTIONS /config/network cors
**** GET /debug/heap Get the heap statistics of the Ceramic node
**** OPTIONS /debug/heap cors
**** GET /events/{event_id} Get event data
**** OPTIONS /events/{event_id} cors
**** OPTIONS /events cors
**** POST /events Creates a new event
**** GET /experimental/events/{sep}/{sepValue} Get events matching the interest stored on the node
**** OPTIONS /experimental/events/{sep}/{sepValue} cors
**** GET /experimental/interests Get the interests stored on the node
**** OPTIONS /experimental/interests cors
**** GET /feed/events Get all new event keys since resume token
**** OPTIONS /feed/events cors
**** GET /feed/resumeToken Get the current (maximum) highwater mark/continuation token of the feed. Allows starting feed/events from 'now'.
**** OPTIONS /feed/resumeToken cors
**** OPTIONS /interests cors
**** POST /interests Register interest for a sort key
**** OPTIONS /interests/{sort_key}/{sort_value} cors
**** POST /interests/{sort_key}/{sort_value} Register interest for a sort key
**** GET /liveness Test the liveness of the Ceramic node
**** OPTIONS /liveness cors
**** GET /peers Get list of connected peers
**** OPTIONS /peers cors
**** POST /peers Connect to a peer
**** GET /streams/{stream_id} Get stream state
**** OPTIONS /streams/{stream_id} cors
**** GET /version Get the version of the Ceramic node
**** OPTIONS /version cors
**** POST /version Get the version of the Ceramic node

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author