mohan3d / gopenload

Golang client of the openload.co service.

Repository from Github https://github.commohan3d/gopenloadRepository from Github https://github.commohan3d/gopenload

gopenload

Golang client of the openload.co service.

Build Status Go Report Card GoDoc

Installation

$ go get github.com/mohan3d/gopenload

Usage

implemented API features.

Retrieve account info

package main

import (
	"fmt"

	"github.com/mohan3d/gopenload/openload"
)

func main() {
	// Create a client.
	client := openload.New("<LOGIN>", "<KEY>", nil)

	// Get account info.
	info, err := client.AccountInfo()

	if err != nil {
		panic(err)
	}
	fmt.Println(info.Email)
	fmt.Println(info.SignupAt)
}

Upload file

package main

import (
	"fmt"

	"github.com/mohan3d/gopenload/openload"
)

func main() {
	client := openload.New("<LOGIN>", "<KEY>", nil)
	uploaded, err := client.Upload("/path/dummyfile.txt", "", "", false)

	if err != nil {
		panic(err)
	}
	fmt.Println(uploaded.URL)
	fmt.Println(uploaded.ID)
	fmt.Println(uploaded.Size)
}

Retrieve file info

package main

import (
	"fmt"

	"github.com/mohan3d/gopenload/openload"
)

func main() {
	client := openload.New("<LOGIN>", "<KEY>", nil)
	info, err := client.FileInfo("uxbligkQAiN")

	if err != nil {
		panic(err)
	}
	fmt.Println(info.Name)
	fmt.Println(info.Size)
	fmt.Println(info.Status)
}

About

Golang client of the openload.co service.

License:MIT License


Languages

Language:Go 100.0%