Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
refs committed Jun 19, 2019
1 parent f4de090 commit 48eccdd
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,61 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
- Package version: 0.1.0
- Build package: io.swagger.codegen.languages.GoClientCodegen

## Usage Example

```go
package main

import (
"fmt"

talon "github.com/talon-one/talon_go"
"golang.org/x/net/context"
)

func main() {
configuration := talon.NewConfiguration()
configuration.BasePath = "http://localhost:9000"

integrationClient := talon.NewAPIClient(configuration)
auth := context.WithValue(context.Background(), talon.ContextAPIKey, talon.APIKey{
Prefix: "ApiKey-v1",
Key: "0f6fb6a48399b248127bcd0a9c03db1d507b0088bf681c704ffe407b0188234b",
})

body := map[string]interface{}{
"body": talon.NewCustomerSession{
ProfileId: "DEADBEEF",
Coupon: "",
Referral: "",
State: "open",
CartItems: []talon.CartItem{},
Total: 42.0,
},
}

if integrationState, response, err := integrationClient.IntegrationApi.UpdateCustomerSession(auth, "deetdoot", body); err != nil {
fmt.Println(err)
} else {
fmt.Println(integrationState.Session)
fmt.Println(response)
}

managementClient := talon.NewAPIClient(configuration)
if session, _, err := managementClient.ManagementApi.CreateSession(context.Background(), map[string]interface{}{
"body": talon.LoginParams{
Email: "[email protected]",
Password: "Demo1234",
},
}); err != nil {
fmt.Println(err)
} else {
fmt.Println(session)
}
}

```

## Installation
Put the package under your project folder and add the following in import:
```
Expand Down

0 comments on commit 48eccdd

Please sign in to comment.