modulepackage
0.0.0-20220929175817-51a7b8ea7a22
Repository: https://github.com/lytics/go-lytics.git
Documentation: pkg.go.dev
# README
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
- Import the library.
go get github.com/lytics/go-lytics
- Create a new client from api key.
- 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
- Single
- Admin User
- Single
GET
- All
GET
- Single
- Segment
- Single
GET
- All
GET
- Single
- Entity (end users) API
GET
- Catalog
- Schema
GET
- Schema
- Query
- All
GET
- Test Evaluation
POST
- All
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
# Functions
Given a set of bytes, convert to json map[string]interface{}, then convert.
The map m should be a map that resulted from json.Unmarshal(), or the behavior is undefined (that's bad).
Attempt to flatten A map of map[string]interface{} into url Values.
No description provided by the author
No description provided by the author
NewLytics creates a new client instance.
# Structs
Account represents a Lytics Account.
AccountAccess describes relationship between user and that account (roles).
AccountUser describes a user that has access to an account.
ApiResp is the core api response for all Lytics endpoints.
Auth is the authorization token (apikey, user-token, oauth-token, jwt-key) to provide Lytics access to a 3rd party resource.
No description provided by the author
Client bundles the data necessary to interact with the vast majority of Lytics REST endpoints.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Entity is the main data source for Lytics User Profiles/Entities.
No description provided by the author
No description provided by the author
No description provided by the author
Specialized Embeddable time that formats to Lytics Standard Api format which is string unix milliseconds since eopch
http://stackoverflow.com/questions/20475321/override-the-layout-used-by-json-marshal-to-format-time-time https://github.com/lytics/lio/wiki/api.
Timestamp in secs.
type Feature struct {
Kind string `json:"kind, omitempty"`
Type string `json:"type, omitempty"`
Name string `json:"name, omitempty"`
Importance float64 `json:"importance, omitempty"`
Correlation float64 `json:"correlation, omitempty"`
Impact struct {
Lift float64 `json:"lift, omitempty"`
Threshold float64 `json:"threshold, omitempty"`
} `json:"impact, omitempty"`
}
type SegmentML struct {
Name string `json:"name"`
Features []Feature `json:"features,omitempty"`
Summary struct {
Mse float64 `json:"mse"`
Rsq float64 `json:"rsq"`
AUC float64 `json:"auc"`
Conf struct {
FalsePositive int `json:"FalsePositive,omitempty"`
TruePositive int `json:"TruePositive,omitempty"`
FalseNegative int `json:"FalseNegative,omitempty"`
TrueNegative int `json:"TrueNegative,omitempty"`
} `json:"Conf,omitempty"`
Fail map[string]int `json:"fail"`
Success map[string]int `json:"success"`
} `json:"summary,omitempty"`
Conf struct {
Source Segment `json:"source"`
Target Segment `json:"target"`
Additional []string `json:"additional"`
Collections []string `json:"collections"`
Collect int `json:"collect"`
UseScores bool `json:"use_scores"`
UseContent bool `json:"use_content"`
WriteToGcs bool `json:"write_to_gcs"`
} `json:"conf,omitempty"`
}
type Dependencies struct {
Fields map[string][][2]float64 "fields"
}
type Prediction struct {
Val string `json:"val"`
FailCt int `json:"fail_ct"`
SuccessCt int `json:"success_ct"`
}
*/.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Filter params for recommendations: https://learn.lytics.com/documentation/developer/api-docs/content#content-recommendation.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Timestamp type handles json timestamp values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author