https://github.com/ngmachado/mkm
API Client to Magiccardmarket.eu
https://github.com/ngmachado/mkm
api-client api-wrapper go golang magic-the-gathering magiccardmarket trading-card-game
Last synced: about 1 month ago
JSON representation
API Client to Magiccardmarket.eu
- Host: GitHub
- URL: https://github.com/ngmachado/mkm
- Owner: ngmachado
- License: mit
- Created: 2016-11-27T11:32:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-19T11:56:57.000Z (over 8 years ago)
- Last Synced: 2025-04-12T23:54:40.722Z (about 1 month ago)
- Topics: api-client, api-wrapper, go, golang, magic-the-gathering, magiccardmarket, trading-card-game
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mkm
API Client to Magiccardmarket.eu[](https://travis-ci.org/ngmachado/mkm)
[](https://goreportcard.com/report/github.com/ngmachado/mkm)### How to Use
- Getting the code :```go
go get github.com/ngmachado/mkm
```- import into your project
```go
package mainimport (
...
"github.com/ngmachado/mkm"
)
...
```# Working with mkm (example)
```go
package mainimport (
"fmt"
"log""github.com/ngmachado/mkm"
)func main() {
//set your keys
keys := &mkm.Keys{
ConsumerKey: "key1",
ConsumerSecret: "Key2",
AccessToken: "Key3",
AccessTokenSecret: "Key4",
}
//create a client with some configuration. Client will timeout after 10 seconds
//mkm.NewClient(keys, endpoint, version, output)
//keys : your magiccardmarket keys
//endpoint : (environment) Sandbox or Production
//version : which version of the API to use. v1 or v2
//output : response format. JSON or XML
cli := mkm.NewClient(keys, mkm.Sandbox, mkm.V2, mkm.JSON)//make a request to magiccardmarket
//cli.Request(method, resource, data)
//method : HTTP method Get,Post,Put,Delete
//resource : resource you want to work
//data : if you want to send data to resource
resp, err := cli.Request(mkm.Get, "/games", nil)if err != nil {
//log.Fatal(err)
log.Fatal("Request Error")
}fmt.Printf("%+v", resp)
}
```