Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/photon-storage/gw3-sdk-go
https://github.com/photon-storage/gw3-sdk-go
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/photon-storage/gw3-sdk-go
- Owner: photon-storage
- License: mit
- Created: 2023-07-12T14:05:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-03T00:27:07.000Z (over 1 year ago)
- Last Synced: 2024-11-10T04:37:21.588Z (2 months ago)
- Language: Go
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# gw3-sdk-go
This repository contains the Golang SDK for Gateway3, an IPFS decentralized gateway. The Gateway3 SDK provides a simple and easy-to-use interface to interact with IPFS, enabling developers to build scalable and distributed applications.
## Features
- Seamless integration with IPFS network
- Store and retrieve files on the decentralized web
- Simplified and intuitive API
- Built-in support for pinning
- Secure and private data handling
- Lightweight and highly performant## Getting Started
### Prerequisites
- Golang version 1.19 or higher
### Obtain Access Key and Access Secret
To use the Gateway3 SDK, you need to obtain an access key and access secret. You can get these by logging in to the Photon Storage website at https://www.gw3.io/.
### Installation
To install the Gateway3 SDK, use the following command:
```sh
go get -u github.com/photon-storage/gw3-sdk-go
```### Usage
Import the Gateway3 SDK in your Golang project:
```go
import "github.com/photon-storage/gw3-sdk-go"
```Here's a simple example demonstrating the usage of the Gateway3 IPFS Gateway SDK:
```go
package mainimport (
"fmt""github.com/photon-storage/gw3-sdk-go"
)func main() {
key := "YOUR-ACCESS-KEY"
secret := "YOUR-ACCESS-SECRET"
client, err := gw3.NewClient(key, secret)
if err != nil {
panic(err)
}data := "EThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks"
// Post the data to the IPFS network, receiving a CID as a result
cid, err := client.Post([]byte(data))
if err != nil {
panic(err)
}
fmt.Println("Data posted to IPFS network, CID is: ", cid)// Request the gateway to pin the CID data, ensuring its persistence
if err := client.Pin(cid); err != nil {
panic(err)
}
fmt.Println("CID data is pinned by the Gateway3")// Retrieve the data from the IPFS network using the CID
got, err := client.Get(cid)
if err != nil {
panic(err)
}
fmt.Println("Data retrieved from IPFS network: ", string(got))
}
```## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.