hako / casper

A Go library for interacting with the Casper & Snapchat API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

casper

Build Status License GoDoc CasperStatus

casper is a small Go library for interacting with the Casper API and the Snapchat API.

Installation

go get github.com/hako/casper

Usage

You would need to register an account on the Casper API portal in order to use this library. Register an account and comeback to the README.

Don't worry, I won't disappear in 10 seconds :P

Once you've registered an account and installed the library, to get started simply create a Casper{} struct and enter the following:

  • APIKey - your Casper API key.

  • APISecret - your Casper API secret.

  • Username - your Snapchat username.

  • Password - your Snapchat password.

Debug is optional and is set to false by default.

ProjectName is optional and is empty by default.

AuthToken is optional but is required for accessing authenticated endpoints.

Example

package main

import (
	"github.com/hako/casper"
	"fmt"
)

func main() {	
	casperClient := &casper.Casper{
        APIKey:    "yourapikey",
        APISecret: "yourapisecret",
	}
	data, err := casperClient.Login("yoursnapchatusername", "yoursnapchatpassword")
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(data) // JSON
}

Or if you already have an auth token...

package main

import (
	"github.com/hako/casper"
	"fmt"
)

func main() {	
	casperClient := &casper.Casper{
        APIKey:    "yourapikey",
        APISecret: "yourapisecret",
        Username:  "yoursnapchatusername",
        AuthToken: "yoursnapchatauthtoken",
	}
	data, err := casperClient.Updates()
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(data) // JSON
}

See the godoc for more functions for interacting with the API.

Todo

  • More tests.
  • Code cleanup.
    • DRY cleanup.

Security

This library requires you to have a Snapchat account.

By using this library you also agree to the Casper Terms of Use.

Kudos

Author

Wesley Hill - (@hako/@hakobyte)

License

MIT

Legal

Before using this library, take a look at the Casper Terms of Use

Use at your own risk.

About

A Go library for interacting with the Casper & Snapchat API

License:MIT License


Languages

Language:Go 100.0%