GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — go-lytics/account.go at master · lytics/go-lytics

Expand file tree

/

account.go

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
76 lines (64 loc) · 1.87 KB
/

account.go

Copy path

File metadata and controls

76 lines (64 loc) · 1.87 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package lytics
import (
"time"
)
var (
// Ensure we can write out as a table
_ TableWriter = (*Account)(nil)
)
const (
accountEndpoint = "account/:id"
accountListEndpoint = "account"
)
// Account represents a Lytics Account. For customers that have more than one
// Account it is probably an "Environment" (production, test, dev, etc).
type Account struct {
Id string `json:"id"`
Aid int `json:"aid"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Fid string `json:"fid"`
Domain string `json:"domain"`
Email string `json:"email"`
Name string `json:"name"`
TimeZone string `json:"timezone,omitempty"`
PubUsers bool `json:"pubusers"`
}
func (m *Account) Headers() []interface{} {
return []interface{}{
"ID", "domain", "name", "email", "created", "updated",
}
}
func (m *Account) Row() []interface{} {
return []interface{}{
m.Id, m.Domain, m.Name, m.Email, m.Created.Format(time.RFC3339), m.Updated.Format(time.RFC3339),
}
}
// GetAccounts returns a list of all accounts associated with master account
// https://learn.lytics.com/api-docs/account#accounts-list
func (l *Client) GetAccounts() ([]*Account, error) {
res := ApiResp{}
var data []*Account
// make the request
err := l.Get(accountListEndpoint, nil, nil, &res, &data)
if err != nil {
return data, err
}
return data, nil
}
// GetAccount returns the details of a single account based on id
// http://learn.lytics.com/api-docs/account#account
func (l *Client) GetAccount(id string) (Account, error) {
res := ApiResp{}
data := Account{}
// make the request
err := l.Get(parseLyticsURL(accountEndpoint, map[string]string{"id": id}), nil, nil, &res, &data)
if err != nil {
return data, err
}
return data, nil
}
// Other Available Endpoints
// * POST create account
// * PUT upate account
// * DELETE remove account
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.