casper is a small Go library for interacting with the Casper API and the Snapchat API.
go get github.com/hako/casper
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.
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.
- More tests.
- Code cleanup.
- DRY cleanup.
This library requires you to have a Snapchat account.
By using this library you also agree to the Casper Terms of Use.
- liamcottle - For providing the Casper API service.
- Snapchat - For just being Snapchat.
Wesley Hill - (@hako/@hakobyte)
MIT
Before using this library, take a look at the Casper Terms of Use
Use at your own risk.