meocloudcli

package module
v0.0.0-...-17c9cf1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

MeoCloud API Client in GO

This module is intended to provide an implementation in GO to consume the API of the Meocloud Storage for the Meo customers in Portugal.

Note

For now, since this is my first contact with the language, I do not provide a way to fetch the access token to be used to try this module. You can take a look at the sister projects in PHP, php-meocloud-cli or meocloudrepl in Python, and following the directions, generate the access token and secret, this two more the consumer token and secret which can be obtained at https://meocloud.pt/my_apps. These four should be inscribed in a .env file with the following format:

CONSUMER_KEY=
CONSUMER_SECRET=
OAUTH_TOKEN=
OAUTH_TOKEN_SECRET=

I intend to write new functions to get the credentials later.

Source example

package main

import (
	"github.com/digfish/go-meocloud-cli"
	"fmt"
)

func main() {
	info,status := meocloudcli.Account_info()
	fmt.Println(status,info)
}

What is implemented

Method API
account_info() GET Account/Info
get_metadata() GET Metadata/meocloud/
get_file() GET Files/meocloud/:name
send_file() PUT Files/meocloud/:name
delete_file() POST Fileops/Delete
create_dir() POST Fileops/CreateFolder

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Account_info

func Account_info() (map[string]interface{}, int)

Get the account information of the current user (https://meocloud.pt/documentation#accountinfo)

func Create_dir

func Create_dir(folderpath string) int

creates a directory in the cloud (https://meocloud.pt/documentation#createfolder) returns the status code (200 if successful, 403 if the directory already exists)

func Delete_file

func Delete_file(filepath string) int

delete a file in the cloud (https://meocloud.pt/documentation#delete) returns the status code (200 on success, 404 if the file does not exist and 406 if many files are deleted)

func Get_file

func Get_file(filepath string) ([]byte, int)

Get the contents of a file given its path in the cloud (https://meocloud.pt/documentation#files)

func Get_metadata

func Get_metadata(path string) (map[string]interface{}, int)

get the metadata of a file or folder, used of directory listings (https://meocloud.pt/documentation#metadata)

func Send

func Send(newfilepath string, data []byte) int

Send byte array to the cloud (https://meocloud.pt/documentation#files) giving it a name specified in newfilepath returns the status code

func Send_file

func Send_file(filepath string) int

send a file to the cloud (https://meocloud.pt/documentation#files)

Types

This section is empty.

Jump to

Keyboard shortcuts

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