Categorygithub.com/crewlinker/go-sdk
repositorypackage
0.1.9
Repository: https://github.com/crewlinker/go-sdk.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Build Status Coverage Status

go-sdk

A Go SDK to make it easy to talk to the Transloadit REST API.

We also offer transloadify that bundles much of the technology inside this SDK as a commandline utility.

Example

// Create client
options := transloadit.DefaultConfig
options.AuthKey = "TRANSLOADIT_KEY"
options.AuthSecret = "TRANSLOADIT_SECRET"
client, err := transloadit.NewClient(options)
if err != nil {
    panic(err)
}

// Initialize new assembly
assembly := client.CreateAssembly()

// Add input file to upload
assembly.AddFile("myimage", "./lol_cat.jpg")

// Add instructions, e.g. resize image to 75x75px
assembly.AddStep("resize", map[string]interface{}{
    "robot":           "/image/resize",
    "width":           75,
    "height":          75,
    "resize_strategy": "pad",
    "background":      "#000000",
})

// Wait until transloadit is done processing all uploads
// and is ready to download the results
assembly.Blocking = true

// Start the upload
info, err := assembly.Upload()
if err != nil {
    panic(err)
}

fmt.Printf("You can view the result at: %s\n", info.Results["resize"][0].Url)

For examples on how to use templates, non-blocking processing and more, take a look at examples/.

Installation

go get github.com/transloadit/go-sdk

The Go SDK requires Go 1.1 or higher.

Documentation

See Godoc.

License

MIT Licensed