Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Use go-ipfs-http-client for request handling #182

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gx/lastpubver

This file was deleted.

1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ env:
- GOTFLAGS="-race"
- IPFS_PATH=/tmp/ipfs
matrix:
- BUILD_DEPTYPE=gx
- BUILD_DEPTYPE=gomod

before_install:
Expand Down
8 changes: 0 additions & 8 deletions Makefile

This file was deleted.

12 changes: 7 additions & 5 deletions add.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,39 @@ import (
"path/filepath"

"github.com/ipfs/go-ipfs-files"

httpapi "github.com/ipfs/go-ipfs-http-client"
)

type object struct {
Hash string
}

type AddOpts = func(*RequestBuilder) error
type AddOpts = func(httpapi.RequestBuilder) error

func OnlyHash(enabled bool) AddOpts {
return func(rb *RequestBuilder) error {
return func(rb httpapi.RequestBuilder) error {
rb.Option("only-hash", enabled)
return nil
}
}

func Pin(enabled bool) AddOpts {
return func(rb *RequestBuilder) error {
return func(rb httpapi.RequestBuilder) error {
rb.Option("pin", enabled)
return nil
}
}

func Progress(enabled bool) AddOpts {
return func(rb *RequestBuilder) error {
return func(rb httpapi.RequestBuilder) error {
rb.Option("progress", enabled)
return nil
}
}

func RawLeaves(enabled bool) AddOpts {
return func(rb *RequestBuilder) error {
return func(rb httpapi.RequestBuilder) error {
rb.Option("raw-leaves", enabled)
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ module github.com/ipfs/go-ipfs-api

require (
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927
github.com/ipfs/go-ipfs-files v0.0.1
github.com/ipfs/go-ipfs-files v0.0.2
github.com/ipfs/go-ipfs-http-client v0.0.3-0.20190510133820-0534b7ca8319
github.com/ipfs/go-ipfs-util v0.0.1
github.com/ipfs/interface-go-ipfs-core v0.0.7
github.com/libp2p/go-libp2p-metrics v0.0.1
github.com/libp2p/go-libp2p-peer v0.0.1
github.com/mitchellh/go-homedir v1.1.0
Expand Down
218 changes: 218 additions & 0 deletions go.sum

Large diffs are not rendered by default.

66 changes: 0 additions & 66 deletions package.json

This file was deleted.

6 changes: 4 additions & 2 deletions pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"

"github.com/libp2p/go-libp2p-peer"

httpapi "github.com/ipfs/go-ipfs-http-client"
)

// Message is a pubsub message.
Expand All @@ -16,10 +18,10 @@ type Message struct {

// PubSubSubscription allow you to receive pubsub records that where published on the network.
type PubSubSubscription struct {
resp *Response
resp *httpapi.Response
}

func newPubSubSubscription(resp *Response) *PubSubSubscription {
func newPubSubSubscription(resp *httpapi.Response) *PubSubSubscription {
sub := &PubSubSubscription{
resp: resp,
}
Expand Down
Loading