segment

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const BaseUrl = "https://api.segmentapis.com/"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(httpClient *http.Client, token string) *Client

func (*Client) AddGroupMembers

func (c *Client) AddGroupMembers(ctx context.Context, groupId, userEmail string) error

AddGroupMembers adds user to a group.

func (*Client) GetWorkspace

func (c *Client) GetWorkspace(ctx context.Context) (*Workspace, error)

GetWorkspace returns workspace of a current token.

func (*Client) ListGroupMembers

func (c *Client) ListGroupMembers(ctx context.Context, groupId, cursor string) ([]User, string, error)

ListGroupMembers returns a list of all user group members.

func (*Client) ListGroups

func (c *Client) ListGroups(ctx context.Context, cursor string) ([]Group, string, error)

ListGroups returns a list of all user groups.

func (*Client) ListRoles

func (c *Client) ListRoles(ctx context.Context, cursor string) ([]Role, string, error)

ListRoles returns a list of all roles.

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, cursor string) ([]User, string, error)

ListUsers returns a list of all users.

func (*Client) RemoveGroupMember

func (c *Client) RemoveGroupMember(ctx context.Context, groupId, userEmail string) error

RemoveGroupMember removes member from the group.

type Error

type Error struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

type Group

type Group struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	MemberCount int64        `json:"memberCount"`
	Permissions []Permission `json:"permissions"`
}

type Pagination

type Pagination struct {
	Current      string `json:"current"`
	Next         string `json:"next,omitempty"`
	TotalEntries int64  `json:"totalEntries"`
}

type Payload

type Payload struct {
	Emails []string `json:"emails"`
}

type Permission

type Permission struct {
	RoleID    string     `json:"roleId"`
	RoleName  string     `json:"roleName"`
	Resources []Resource `json:"resources"`
}

type Resource

type Resource struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

type Role

type Role struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type User

type User struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Email       string       `json:"email"`
	Permissions []Permission `json:"permissions"`
}

type Workspace

type Workspace struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

Jump to

Keyboard shortcuts

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