Skip to content
Lytics SDK for Go (Golang)
Go
Branch: master
Clone or download

Latest commit

Latest commit 889ff81 Apr 24, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples move csv conversion to lytics/lytics Jan 29, 2019
mock remove deprecated fields from account model Nov 14, 2018
LICENSE.md Move CLI to its own repo Jan 7, 2017
README.md Cleanup readme based on api changes Jun 11, 2018
account.go update models for account and user Feb 19, 2019
account_test.go Cleanup for new cli-ui Jun 11, 2018
auth.go New cli ui Jun 5, 2018
auth_test.go Cleanup for new cli-ui Jun 11, 2018
campaign.go Add new recommendation filters switch to url.Values from map[string]s… Sep 9, 2016
campaign_test.go Cleanup for new cli-ui Jun 11, 2018
catalog.go New cli ui Jun 5, 2018
catalog_test.go Cleanup for new cli-ui Jun 11, 2018
content.go Add GET Taxonomy and GET Topic rollups Sep 23, 2016
content_test.go Cleanup for new cli-ui Jun 11, 2018
entity.go fix entity-api Aug 1, 2018
entity_test.go Cleanup for new cli-ui Jun 11, 2018
json.go Use Recent events in Watch command Jan 4, 2017
json_test.go cli tool to help lql authoring, watch folder, on edit json, lql print… Nov 9, 2016
lytics.go Cleanup for new cli-ui Jun 11, 2018
lytics_test.go public launch Sep 25, 2015
provider.go fix provider.go Sep 24, 2016
provider_test.go Cleanup for new cli-ui Jun 11, 2018
query.go fix bad doc Jun 29, 2018
segment.go fix bad doc Jun 29, 2018
segment_test.go Cleanup for new cli-ui Jun 11, 2018
segmentml.go add missing Segmentml code Apr 23, 2019
segmentml_test.go Cleanup for new cli-ui Jun 11, 2018
user.go update models for account and user Feb 19, 2019
user_test.go Cleanup for new cli-ui Jun 11, 2018
work.go Add statuscode to work struct. Jul 7, 2016
work_test.go Cleanup for new cli-ui Jun 11, 2018

README.md

#Lytics SDK for Go The Lytics SDK for go offers easy integration with our public REST API endpoints. This library is actively being managed and every effort will be made to ensure that all handling reflects the best methods available. Overview of supported methods outlined below.

Full REST API Documentation

https://learn.lytics.com/api-docs

Command Line Tool Doc

The Lytics CLI utilizes this library.

Getting Started

  1. Import the library. go get github.com/lytics/go-lytics
  2. Create a new client from api key.
  3. Run one of the many methods to access account info.
package main

import (
	"fmt"
	"encoding/json"
	
	lytics "github.com/lytics/go-lytics"
)

func main() {
	// set your api key
	key := "<YOUR API KEY>"

	// create the client
	client := lytics.NewLytics(key, nil)

	// create a scanner for All Users in a Segment 
	scan := client.PageSegment(`
		FILTER AND (
		    lastvisit_ts > "now-2d"
		    EXISTS email
		)
		FROM user
	`)

	// handle processing the users
	for {
		e := scan.Next()
		if e == nil {
			break
		}

		by, err := json.Marshal(e.Fields)
		if err != nil {
			fmt.Println("ERROR: ", err)
			continue
		}
		fmt.Println(string(by))
	}
}

Examples

Supported Methods

  • Account
    • Single GET
    • All GET
  • Admin User
    • Single GET
    • All GET
  • Segment
    • Single GET
    • All GET
  • Entity (end users) API GET
  • Catalog
    • Schema GET
  • Query
    • All GET
    • Test Evaluation POST

Contributing

Want to add something? Go for it, just fork the repo and send us a PR. Please make sure all tests run go test -v and that all new functionality comes with well documented and thorough testing.

License

MIT Copyright (c) 2018, 2017, 2016, 2015 Lytics

You can’t perform that action at this time.