Code Monkey home page Code Monkey logo

cpp-ipfs-http-client's Introduction

IPFS C++ HTTP API client library

Build Status codecov Documentation GitHub Issues GitHub pull requests CII Best Practices

Allows C++ applications to communicate with an IPFS node. It implements IPFS API bindings for C++. See the documentation and in partially the Client Class.

See also IPFS on GitHub.

Currently implemented methods:

  • block: get(), put(), stat()
  • config: get(), set(), replace()
  • dht: findpeer(), findprovs()
  • files: get(), add()
  • miscellaneous: id(), version()
  • object: new(), put(), get(), data(), links(), stat(), patch.addLink(), patch.rmLink(), patch.appendData(), patch.setData()
  • pin: add(), ls(), rm()
  • swarm: addrs(), connect(), disconnect(), peers()
  • key: gen(), list(), rm()

Not all methods are implemented.

TODO

  • Implement the missing methods
  • Contributors are welcome!

Install

cmake /path/to/cpp-ipfs-http-client
make -j 6
make install

See the documentation for details.

Dependencies

Build Test cases + Code Coverage

Test cases are build by default, but if you want to build with coverage:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON -DBUILD_SHARED_LIBS=ON ..
# Run tests & Build the HTML report
make ctest_coverage_html -j 6

# Or run tests & create a Cobertura XML file
make ctest_coverage_xml -j 6

Build Doxygen

Build Doxygen files locally. From the root directory of this project:

mkdir build
cd build
cmake -DDOC=ON ..
make doc

Usage

#include <iostream>
#include <sstream>

#include <ipfs/client.h>

int main(int, char**) {
  std::stringstream contents;

  ipfs::Client client("localhost", 5001);

  client.FilesGet("/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme", &contents);

  std::cout << contents.str() << std::endl;

  return 0;
}

Build via c++ compiler

c++ -std=c++11 -I/path/to/header -L/path/to/lib -lipfs-http-client myprog.cc -o myprog

Build via CMake

An example using the CPP-IPFS project within another CMake project. For example via git submodule (but just git clone also works):

git submodule add https://github.com/vasild/cpp-ipfs-http-client.git lib/ipfs-http-client

Edit your CMakeLists.txt file to include CPP-IPFS-HTTP-client in the build:

add_subdirectory (lib/ipfs-http-client)

Finally, add the CPP-IPFS static library to your target (in this example ${PROJECT_TARGET} variable is used):

target_include_directories(${PROJECT_TARGET} PRIVATE
    ${PROJECT_SOURCE_DIR}/lib/ipfs-http-client/include
)
target_link_libraries(${PROJECT_TARGET} PRIVATE ipfs-http-client)

Contribute

Feel free to open issues and pull requests. Report vulnerabilities publicly, similar to other non-security issues.

The project adheres to the Google C++ Style Guide. Use clang-format to properly format the code when you submit patches.

Write tests for new code. Changes should not cause the code coverage to go down (ideally up).

License

The code is distributed under the MIT License.

cpp-ipfs-http-client's People

Contributors

daviddias avatar geertiebear avatar kenkit avatar linas avatar melroy89 avatar vasild avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.