An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

# mkm
API Client to Magiccardmarket.eu

[![Build Status](https://travis-ci.org/ngmachado/mkm.svg?branch=master)](https://travis-ci.org/ngmachado/mkm)
[![Go Report Card](https://goreportcard.com/badge/github.com/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 main

import (
...
"github.com/ngmachado/mkm"
)
...
```

# Working with mkm (example)

```go
package main

import (
"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)

}

```