box

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorResponse struct {
	Type        string `json:"type"`
	Code        string `json:"code"`
	ContextInfo struct {
		Message string `json:"message"`
	} `json:"context_info"`
	HelpURL   string `json:"help_url"`
	Message   string `json:"message"`
	RequestID string `json:"request_id"`
	Status    int64  `json:"status"`
}

Functions

func RequestAccessToken

func RequestAccessToken(ctx context.Context, clientID string, clientSecret string, enterpriseId string) (string, error)

RequestAccessToken creates bearer token needed to use the Box API.

Types

type BaseType

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

type Client

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

func NewClient

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

func (*Client) GetCurrentUserWithEnterprise

func (c *Client) GetCurrentUserWithEnterprise(ctx context.Context) (User, error)

GetCurrentUserWithEnterprise returns current user with enterprise data.

func (*Client) GetGroup

func (c *Client) GetGroup(ctx context.Context, groupId string) (Group, error)

GetGroup returns Box group details.

func (*Client) GetGroupMemberships

func (c *Client) GetGroupMemberships(ctx context.Context, groupId string) ([]GroupMembership, error)

GetGroupMemberships returns all group memberships from Box enterprise.

func (*Client) GetGroups

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

GetGroups returns all groups from Box enterprise.

func (*Client) GetUsers

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

GetUsers returns all users from Box enterprise.

type Enterprise

type Enterprise struct {
	BaseType
	Name string `json:"name"`
}

type Group

type Group struct {
	BaseType
	InvitabilityLevel      string `json:"invitability_level"`
	MemberViewabilityLevel string `json:"member_viewability_level"`
	Name                   string `json:"name"`
}

type GroupMembership

type GroupMembership struct {
	BaseType
	Role  string `json:"role"`
	User  User   `json:"user"`
	Group Group  `json:"group"`
}

type User

type User struct {
	BaseType
	Enterprise Enterprise `json:"enterprise"`
	Login      string     `json:"login"`
	Name       string     `json:"name"`
	Phone      string     `json:"phone"`
	Role       string     `json:"role"`
	Status     string     `json:"status"`
}

Jump to

Keyboard shortcuts

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