swagger

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

README

Golang SendX API

NOTE: All API calls contain 2 parameters - 'api_key' and 'team_id'. These can be inferred from your settings page 'https://app.sendx.io/setting' under the sections 'Api Key' and 'Team Id' respectively.

SendX API has two methods:

Identify API Method

Identify API Method is used to attach data to a visitor. If a contact is not yet created then we will create the contact. In case contact already exists then we update it.

Example Request:

{
  email: "john.doe@gmail.com",  
  firstName: "John",
  lastName: "Doe",
  birthday: "1989-03-03",
  customFields: { "Designation": "Software Engineer", "Age": "27", "Experience": "5"},  
  tags: ["Developer", "API Team"],  
 }

Note that tags are an array of strings. In case they don't exist previously then API will create them and associate them with the contact.

Similarly if a custom field doesn't exist then it is first created and then associated with the contact along-with the corresponding value. In case custom field exists already then we simply update the value of it for the aforementioned contact.

We don't delete any of the properties based on identify call. What this means is that if for the same contact you did two API calls like:

API Call A

{
   email: "john.doe@gmail.com", 
   firstName: "John",
   birthday: "1989-03-03",
   customFields: { "Designation": "Software Engineer"},  
   tags: ["Developer"],  
}

API Call B

{  
  email: "john.doe@gmail.com",  
  customFields: { "Age": "29"},  
  tags: ["API Team"],  
}

The final contact will have firstName as John, birthday as 1989-03-03 present. Also both tags Developer and API Team shall be present alongwith custom fields Designation and Age.

Properties:

  • firstName: type string
  • lastName: type string
  • email: type string
  • newEmail: type string
  • company: type string
  • birthday: type string with format YYYY-MM-DD eg: 2016-11-21
  • customFields: type map[string]string
  • tags: type array of string

In case email of an already existing contact needs to be updated then specify current email under email property and updated email under newEmail property.

Response:

{ "status": "200", "message": "OK", "data": { "encryptedTeamId": "CLdh9Ig5GLIN1u8gTRvoja", "encryptedId": "c9QF63nrBenCaAXe660byz", "tags": [ "API Team", "Tech" ], "firstName": "John", "lastName": "Doe", "email": "john.doe@gmail.com", "company": "", "birthday": "1989-03-03", "customFields": { "Age": "29", "Designation": "Software Engineer" } } }

Track API Method

Track API Method is used to track a contact. In the track API object you can:

  • addTags:
  • removeTags:

You can have automation rules based on tag addition as well as tag removal and they will get executed. For eg:

  • On user registration tag start onboarding drip for him / her.
  • Account Upgrade tag start add user to paid user list and start account expansion drip.
  • On removal of trial user tag start upsell trial completed users drip.

Example Request:

{ "addTags": ["blogger", "female"] }

{ "addTags": ["paid user"], "removeTags": ["trial user"] }

Response:

{ "status": "200", "message": "OK", "data": "success" }

Overview

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

  • API version: v1
  • Package version: 1.0.0
  • Build package: class io.swagger.codegen.languages.GoClientCodegen

Installation

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

    "./swagger"

Documentation for API Endpoints

All URIs are relative to http://app.sendx.io/api/v1

Class Method HTTP request Description
ContactApi ContactIdentifyPost Post /contact/identify Identify a contact as user
ContactApi ContactTrackPost Post /contact/track Add tracking info using tags to a contact

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

func (*APIClient) CallAPI

func (c *APIClient) CallAPI(path string, method string,
	postBody interface{},
	headerParams map[string]string,
	queryParams url.Values,
	formParams map[string]string,
	fileName string,
	fileBytes []byte) (*resty.Response, error)

func (*APIClient) ParameterToString

func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string

func (*APIClient) SelectHeaderAccept

func (c *APIClient) SelectHeaderAccept(accepts []string) string

func (*APIClient) SelectHeaderContentType

func (c *APIClient) SelectHeaderContentType(contentTypes []string) string

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type Configuration

type Configuration struct {
	UserName      string            `json:"userName,omitempty"`
	Password      string            `json:"password,omitempty"`
	APIKeyPrefix  map[string]string `json:"APIKeyPrefix,omitempty"`
	APIKey        map[string]string `json:"APIKey,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	DebugFile     string            `json:"debugFile,omitempty"`
	OAuthToken    string            `json:"oAuthToken,omitempty"`
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	AccessToken   string            `json:"accessToken,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	APIClient     *APIClient
	Transport     *http.Transport
	Timeout       *time.Duration `json:"timeout,omitempty"`
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

func (*Configuration) GetAPIKeyWithPrefix

func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string

func (*Configuration) GetBasicAuthEncodedString

func (c *Configuration) GetBasicAuthEncodedString() string

type Contact

type Contact struct {
	EncryptedTeamId string `json:"encryptedTeamId,omitempty"`

	EncryptedId string `json:"encryptedId,omitempty"`

	FirstName string `json:"firstName,omitempty"`

	LastName string `json:"lastName,omitempty"`

	Email string `json:"email,omitempty"`

	Company string `json:"company,omitempty"`

	Birthday string `json:"birthday,omitempty"`

	Tags []string `json:"tags,omitempty"`

	CustomFields map[string]string `json:"customFields,omitempty"`
}

type ContactApi

type ContactApi struct {
	Configuration *Configuration
}

func NewContactApi

func NewContactApi() *ContactApi

func NewContactApiWithBasePath

func NewContactApiWithBasePath(basePath string) *ContactApi

func (ContactApi) ContactIdentifyPost

func (a ContactApi) ContactIdentifyPost(apiKey string, teamId string, contactDetails ContactRequest) (*ContactResponse, *APIResponse, error)

*

  • Identify a contact as user * *
  • @param apiKey
  • @param teamId
  • @param contactDetails Contact details
  • @return *ContactResponse

func (ContactApi) ContactTrackPost

func (a ContactApi) ContactTrackPost(apiKey string, teamId string, email string, trackDetails TrackRequest) (*TrackResponse, *APIResponse, error)

*

  • Add tracking info using tags to a contact * *
  • @param apiKey
  • @param teamId
  • @param email
  • @param trackDetails Track Details
  • @return *TrackResponse

type ContactRequest

type ContactRequest struct {
	FirstName string `json:"firstName,omitempty"`

	LastName string `json:"lastName,omitempty"`

	Email string `json:"email,omitempty"`

	NewEmail string `json:"newEmail,omitempty"`

	Company string `json:"company,omitempty"`

	Birthday string `json:"birthday,omitempty"`

	Tags []string `json:"tags,omitempty"`

	CustomFields map[string]string `json:"customFields,omitempty"`
}

type ContactResponse

type ContactResponse struct {
	Status string `json:"status,omitempty"`

	Message string `json:"message,omitempty"`

	Data Contact `json:"data,omitempty"`
}

type TrackRequest

type TrackRequest struct {
	AddTags []string `json:"addTags,omitempty"`

	RemoveTags []string `json:"removeTags,omitempty"`
}

type TrackResponse

type TrackResponse struct {
	Status string `json:"status,omitempty"`

	Message string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL