Giter Site home page Giter Site logo

onesky-go's Introduction

onesky-go Build Status GoDoc Issue Stats

Go utils for working with OneSky translation service.

Examples

Example 1 - Download file

package main

import (
	"fmt"
	"github.com/SebastianCzoch/onesky-go"
)

func main() {
	onesky := onesky.Client{APIKey: "abcdef", Secret: "abcdef", ProjectID: 1}
	fmt.Println(onesky.DownloadFile("filename", "locale"))
}

Example 2 - Upload file

package main

import (
	"fmt"
	"github.com/SebastianCzoch/onesky-go"
)

func main() {
	onesky := onesky.Client{APIKey: "abcdef", Secret: "abcdef", ProjectID: 1}
	err := onesky.UploadFile("messages.yml", "YAML", "en-US")
	if err != nil {
		fmt.Println("Can not upload file")
	}
}

Example 3 - Delete file

package main

import (
	"fmt"
	"github.com/SebastianCzoch/onesky-go"
)

func main() {
	onesky := onesky.Client{APIKey: "abcdef", Secret: "abcdef", ProjectID: 1}
	err := onesky.DeleteFile("messages.yml")
	if err != nil {
		fmt.Println("Can not delete file")
	}
}

Example 4 - Get informations about uploaded files

package main

import (
	"fmt"
	"github.com/SebastianCzoch/onesky-go"
)

func main() {
	onesky := onesky.Client{APIKey: "abcdef", Secret: "abcdef", ProjectID: 1}
	err := onesky.ListFiles(1, 100)
	if err != nil {
		fmt.Println("Can not download list of uploaded files")
	}
}

Install

$ go get github.com/SebastianCzoch/onesky-go

API

(c *Client) DownloadFile(fileName, locale string) (string, error)

Downloads translation file from OneSky.

Returns file content via string.

(c *Client) UploadFile(file, fileFormat, locale string) error

Upload translation file to OneSky.

  • file should be a full path to file

(c *Client) DeleteFile(fileName string) error

Permanently remove file from OneSky service (with translations)!

(c *Client) ListFiles(page, perPage int) ([]FileData, error)

Get informations about files uploaded to OneSky

Tests

$ go test

License

GNU v2

onesky-go's People

Contributors

sebastianczoch avatar efueger avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.