Go API client for talon

Use the Integration API to push data to and retrieve data from Talon.One in real time. For more background information about this API, see Integration API overview

For example, use this API to share shopping cart information as a session with Talon.One and evaluate promotion rules. You can also create custom events to track specific actions that do not fit into the session data model.

Ensure you authenticate to make requests to the API.

Are you looking for a different API?

If you need the API to:

Authentication

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import talon "github.com/GIT_USER_ID/GIT_REPO_ID"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), talon.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), talon.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), talon.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), talon.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://goflink.europe-west1.talon.one

Class Method HTTP request Description
AudiencesApi CreateAudienceV2 Post /v2/audiences Create audience
AudiencesApi DeleteAudienceMembershipsV2 Delete /v2/audiences/{audienceId}/memberships Delete audience memberships
AudiencesApi DeleteAudienceV2 Delete /v2/audiences/{audienceId} Delete audience
AudiencesApi UpdateAudienceCustomersAttributes Put /v2/audience_customers/{audienceId}/attributes Update profile attributes for all customers in audience
AudiencesApi UpdateAudienceV2 Put /v2/audiences/{audienceId} Update audience name
AudiencesApi UpdateCustomerProfileAudiences Post /v2/customer_audiences Update multiple customer profiles' audiences
CatalogsApi SyncCatalog Put /v1/catalogs/{catalogId}/sync Sync cart item catalog
CouponsApi CreateCouponReservation Post /v1/coupon_reservations/{couponValue} Create coupon reservation
CouponsApi DeleteCouponReservation Delete /v1/coupon_reservations/{couponValue} Delete coupon reservations
CouponsApi GetReservedCustomers Get /v1/coupon_reservations/customerprofiles/{couponValue} List customers that have this coupon reserved
CustomerProfilesApi DeleteCustomerData Delete /v1/customer_data/{integrationId} Delete customer's personal data
CustomerProfilesApi GetCustomerInventory Get /v1/customer_profiles/{integrationId}/inventory List customer data
CustomerProfilesApi UpdateCustomerProfileV2 Put /v2/customer_profiles/{integrationId} Update customer profile
CustomerProfilesApi UpdateCustomerProfilesV2 Put /v2/customer_profiles Update multiple customer profiles
CustomerSessionsApi GetCustomerSession Get /v2/customer_sessions/{customerSessionId} Get customer session
CustomerSessionsApi ReturnCartItems Post /v2/customer_sessions/{customerSessionId}/returns Return cart items
CustomerSessionsApi UpdateCustomerSessionV2 Put /v2/customer_sessions/{customerSessionId} Update customer session
EventsApi TrackEvent Post /v1/events Track event
EventsApi TrackEventV2 Post /v2/events Track event V2
ReferralsApi CreateReferral Post /v1/referrals Create referral code for an advocate
ReferralsApi CreateReferralsForMultipleAdvocates Post /v1/referrals_for_multiple_advocates Create referral codes for multiple advocates

Documentation For Models

Documentation For Authorization

api_key_v1

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: Authorization and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author