gopenload

module
v0.0.0-...-7994615 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2019 License: MIT

README

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)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL