duo

package
v0.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Name string `json:"name"`
}

type AccountResponse

type AccountResponse struct {
	ErrorResponse
	Stat     string  `json:"stat"`
	Response Account `json:"response"`
}

type Admin

type Admin struct {
	AdminID string `json:"admin_id"`
	Email   string `json:"email"`
	Name    string `json:"name"`
	Role    string `json:"role"`
	Status  string `json:"status"`
}

type AdminsResponse

type AdminsResponse struct {
	ErrorResponse
	Metadata ListResultMetadata `json:"metadata"`
	Stat     string             `json:"stat"`
	Response []Admin            `json:"response"`
}

type Client

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

func NewClient

func NewClient(integrationKey string, secretKey string, apiHostname string, httpClient *http.Client) *Client

func (*Client) AddUserToGroup added in v0.0.4

func (c *Client) AddUserToGroup(ctx context.Context, groupId, userId string) error

AddUserToGroup adds a user to a group.

func (*Client) GetAccount

func (c *Client) GetAccount(ctx context.Context) (Account, error)

GetAccount returns account info.

func (*Client) GetAdmins

func (c *Client) GetAdmins(ctx context.Context, offset string) ([]Admin, string, error)

GetAdmins returns all admins.

func (*Client) GetGroupUsers

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

GetGroupUsers returns all users in a group.

func (*Client) GetGroups

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

GetGroups returns all groups.

func (*Client) GetIntegration

func (c *Client) GetIntegration(ctx context.Context) (IntegrationResponse, error)

GetIntegration returns an integration by integration key.

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, userId string) (User, error)

GetUser returns a user by ID.

func (*Client) GetUsers

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

GetUsers returns all users.

func (*Client) RemoveUserFromGroup added in v0.0.4

func (c *Client) RemoveUserFromGroup(ctx context.Context, groupId, userId string) error

RemoveUserFromGroup removes a user from a group.

type ErrorResponse

type ErrorResponse struct {
	Code          int64  `json:"code,omitempty"`
	Message       string `json:"message,omitempty"`
	MessageDetail string `json:"message_detail,omitempty"`
}

type Group

type Group struct {
	Desc    string `json:"desc"`
	GroupID string `json:"group_id"`
	Name    string `json:"name"`
	Status  string `json:"status"`
}

type GroupUsersResponse

type GroupUsersResponse struct {
	ErrorResponse
	Metadata ListResultMetadata `json:"metadata"`
	Stat     string             `json:"stat"`
	Response []User             `json:"response"`
}

type GroupsResponse

type GroupsResponse struct {
	ErrorResponse
	Metadata ListResultMetadata `json:"metadata"`
	Stat     string             `json:"stat"`
	Response []Group            `json:"response,omitempty"`
}

type IntegrationResponse

type IntegrationResponse struct {
	ErrorResponse
	Stat     string `json:"stat"`
	Response struct {
		Name           string `json:"name"`
		IntegrationKey string `json:"integration_key"`
	} `json:"response"`
}

type ListResultMetadata

type ListResultMetadata struct {
	NextOffset   json.Number `json:"next_offset"`
	PrevOffset   json.Number `json:"prev_offset"`
	TotalObjects json.Number `json:"total_objects"`
}

type User

type User struct {
	Email     string `url:"email"`
	FirstName string `url:"firstname"`
	LastName  string `url:"lastname"`
	RealName  string `url:"realname"`
	Status    string `url:"status"`
	UserID    string `json:"user_id"`
	Username  string `url:"username"`
}

type UserResponse

type UserResponse struct {
	ErrorResponse
	Stat     string `json:"stat"`
	Response User   `json:"response"`
}

type UsersResponse

type UsersResponse struct {
	ErrorResponse
	Metadata ListResultMetadata `json:"metadata"`
	Response []User             `json:"response"`
	Stat     string             `json:"stat"`
}

Jump to

Keyboard shortcuts

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