snipeit

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithGroupId

func WithGroupId(groupID int) queryFunction

func WithLimit

func WithLimit(limit int) queryFunction

func WithOffset

func WithOffset(offset int) queryFunction

Types

type Client

type Client struct {
	uhttp.BaseHttpClient
	// contains filtered or unexported fields
}

func New

func New(baseUrl string, httpClient *http.Client) *Client

func (*Client) AddUserToGroup

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

func (*Client) GetAllGroups

func (c *Client) GetAllGroups(ctx context.Context) (*GroupsResponse, *v2.RateLimitDescription, error)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, id int) (*User, error)

func (*Client) GetUsers

func (c *Client) GetUsers(ctx context.Context, offset, limit int, query ...queryFunction) (*UsersResponse, *v2.RateLimitDescription, error)

func (*Client) RemoveUserFromGroup

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

func (*Client) Validate added in v0.0.3

func (c *Client) Validate(ctx context.Context) error

type Group

type Group struct {
	ID          int         `json:"id"`
	Name        string      `json:"name"`
	Permissions Permissions `json:"permissions"`
}

type GroupsResponse

type GroupsResponse struct {
	Total int     `json:"total"`
	Rows  []Group `json:"rows"`
}

func (GroupsResponse) ContainsGroup

func (x GroupsResponse) ContainsGroup(id int) bool

type PatchUserBody

type PatchUserBody struct {
	Groups []int `json:"groups,omitempty" structs:"groups,omitempty"`
}

type Permission

type Permission string
var (
	Granted   Permission = "1"
	Denied    Permission = "-1"
	Inherited Permission = "0"
)

func (*Permission) UnmarshalJSON added in v0.0.2

func (p *Permission) UnmarshalJSON(b []byte) error

type Permissions

type Permissions map[string]Permission

type User

type User struct {
	ID             int            `json:"id"`
	Username       string         `json:"username"`
	FirstName      string         `json:"first_name"`
	LastName       string         `json:"last_name"`
	Email          string         `json:"email"`
	VIP            bool           `json:"vip"`
	EmployeeNumber string         `json:"employee_num"`
	Activated      bool           `json:"activated"`
	Groups         GroupsResponse `json:"groups"`
	Permissions    Permissions    `json:"permissions"`
}

type UsersResponse

type UsersResponse struct {
	Total int64  `json:"total"`
	Rows  []User `json:"rows"`
}

Jump to

Keyboard shortcuts

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