Categorygithub.com/Burmuley/go-hidrive
modulepackage
0.3.3
Repository: https://github.com/burmuley/go-hidrive.git
Documentation: pkg.go.dev

# README

go-hidrive

Package go_hidrive is a simple client SDK library for HiDrive cloud storage (mainly provided by Strato provider) aimed to be used with Go (Golang).

Currently, the following implementation are available: DirApi, FileApi and ShareApi.

All methods accept url.Values as a set of request parameters. You can also use Parameters objects to simplify parameters gathering required for request.

Example reading file from HiDrive:

package main

import (
	"log"
	"context"
	"io"
	"fmt"

	"golang.org/x/oauth2"
	hidrive "github.com/Burmuley/go-hidrive"
)

func main() {
    oauth2config := oauth2.Config{
        ClientID:     "hi_drive_client_id",
        ClientSecret: "hi_drive_client_secret",
        Endpoint: oauth2.Endpoint{
            AuthURL:   hidrive.StratoHiDriveAuthURL,
            TokenURL:  hidrive.StratoHiDriveTokenURL,
            AuthStyle: 0,
        },
        Scopes: []string{"user", "rw"},
    }

    token := &oauth2.Token{
        RefreshToken: "hi_drive_oauth2_refresh_token",
    }

    client := oauth2config.Client(context.Background(), token)
    fileApi := hidrive.NewFile(client, hidrive.StratoHiDriveAPIV21)

    rdr, err := fileApi.Get(context.Background(), hidrive.NewParameters().SetPath("/public/test_file.txt").Values)

    if err != nil {
        log.Fatal(err)
    }

    contents, err := io.ReadAll(rdr)
    if err != nil {
        log.Fatal(err)
    }
	
    fmt.Println(contents)
}

# Functions

No description provided by the author
NewDir - create new instance of [Dir].
NewFile - create new instance of File.
NewMeta - create new instance of Meta.
No description provided by the author
NewShare - create new instance of Share.
NewSharelink - create new instance of Sharelink.

# Constants

Default HiDrive API endpoint.
Default HiDrive authentication URL.
Default HiDrive token operations URL.

# Variables

No description provided by the author

# Structs

Api - basic structure defining common logic for API interaction.
Dir - structure represents a set of methods for interacting with HiDrive `/dir` API endpoint.
Error - represents HiDrive JSON-encoded errors.
File - structure represents a set of methods for interacting with HiDrive `/file` API endpoint.
Meta - structure represents a set of methods for interacting with HiDrive `/meta` API endpoint.
Object represents HiDrive object - directory or file.
No description provided by the author
Share - structure represents a set of methods for interacting with HiDrive `/share` API endpoint.
No description provided by the author
No description provided by the author
Sharelink - structure represents a set of methods for interacting with HiDrive `/sharelink` API endpoint.
ShareObject represents HiDrive Share object.

# Type aliases

Time represents date and time information for the API.