https://github.com/hako/casper
A Go library for interacting with the Casper & Snapchat API
https://github.com/hako/casper
casper go golang snapchat snapchat-api
Last synced: about 1 month ago
JSON representation
A Go library for interacting with the Casper & Snapchat API
- Host: GitHub
- URL: https://github.com/hako/casper
- Owner: hako
- License: mit
- Created: 2015-10-09T20:59:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-02T16:30:58.000Z (over 9 years ago)
- Last Synced: 2025-01-20T16:53:46.397Z (9 months ago)
- Topics: casper, go, golang, snapchat, snapchat-api
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# casper
[](https://travis-ci.org/hako/casper)
[](https://travis-ci.org/hako/casper)
[](https://godoc.org/github.com/hako/casper)
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](http://developers.casper.io/register.php) 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
```go
package mainimport (
"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...
```go
package mainimport (
"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](https://godoc.org/github.com/hako/casper) 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](http://clients.casper.io/terms.php).
## Kudos
+ [liamcottle](http://github.com/liamcottle) - For providing the Casper API service.
+ [Snapchat](http://snapchat.com) - For just being Snapchat.## Author
Wesley Hill - ([@hako]("github.com/hako")/[@hakobyte]("twitter.com/hakobyte"))## License
MIT## Legal
Before using this library, take a look at the [Casper Terms of Use](http://clients.casper.io/terms.php)Use at your own risk.