box

package module
v0.0.0-...-710d0c7 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2015 License: MIT Imports: 15 Imported by: 222

README

box

golang API for box Build Status

status

Currently this box client is early alpha. Most type signatures not relating to file uploads/downloads can be considered mostly stable (but I make no promises). I hope to get most of this ironed out and to get it fairly stable.

To check on the status of any specific functionality, please check out: status spreadsheet.

pull requests

Obviously, pull requests are welcome - however, until I get this client to a point that I'm acceptably happy with, I probably wont accept too many. Having said that, I foresee this being "stable enough" soon.

Also, I would love to get feedback of anyone use this package. Since this is an alpha package, I am more than open to being convinced to change certain design choices I've made.

Documentation

Index

Constants

View Source
const (
	BASE_URL   = "https://api.box.com/2.0"
	UPLOAD_URL = "https://upload.box.com/api/2.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessEmail

type AccessEmail struct {
	// TODO(ttacon): these may change...
	Access string `json:"access,omitempty"`
	Email  string `json:"email,omitempty"`
}

TODO(ttacon): go through and clean up pointer vs non-pointer TODO(ttacon): go through and see where omitempty is appropriate

type Client

type Client struct {
	Client  *http.Client
	BaseUrl *url.URL
}

func (*Client) CollaborationService

func (c *Client) CollaborationService() *CollaborationService

func (*Client) CommentService

func (c *Client) CommentService() *CommentService

func (*Client) Do

func (c *Client) Do(req *http.Request, respStr interface{}) (*http.Response, error)

Do "makes" the request, and if there are no errors and resp is not nil, it attempts to unmarshal the (json) response body into resp.

func (*Client) DoAndGetReader

func (c *Client) DoAndGetReader(req *http.Request) (*http.Response, io.ReadCloser, error)

Do "makes" the request, and if there are no errors and resp is not nil, it returns the resp without reading or closing the resp.Body.

func (*Client) EventService

func (c *Client) EventService() *EventService

func (*Client) FileService

func (c *Client) FileService() *FileService

FileService returns an interface to interact with all of the API methods available for manipulating or querying files.

func (*Client) FolderService

func (c *Client) FolderService() *FolderService

FolderService returns an interface through which one can interact with all the folder manipulation and querying functionality Box exposes in their API.

func (*Client) GroupService

func (c *Client) GroupService() *GroupService

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an *http.Request with the given method, url and request body (if one is passed).

func (*Client) SharedService

func (c *Client) SharedService() *SharedService

func (*Client) TaskService

func (c *Client) TaskService() *TaskService

func (*Client) UserService

func (c *Client) UserService() *UserService

type Collaboration

type Collaboration struct {
	Type           string  `json:"type"`
	ID             string  `json:"id"`
	CreatedBy      *Item   `json:"created_by"`  // TODO(ttacon): this should be user
	CreatedAt      string  `json:"created_at"`  // TODO(ttacon): transition this to time.Time
	ModifiedAt     string  `json:"modified_at"` // TODO(ttacon): transition to time.Time
	ExpiresAt      *string `json:"expires_at"`  // TODO(ttacon): *time.Time
	Status         string  `json:"status"`
	AccessibleBy   *Item   `json:"accessible_by"`   // TODO(ttacon): turn into user
	Role           string  `json:"role"`            // TODO(ttacon): enum (own file?)
	AcknowledgedAt string  `json:"acknowledged_at"` // TODO(ttacon): time.Time
	Item           *Item   `json:"item"`            // TODO(ttacon): mini-folder struct
}

TODO(ttacon):some of these fields pop up everywhere, make common struct and anonymously extend the others with it? Documentation: https://developers.box.com/docs/#collaborations

type CollaborationService

type CollaborationService struct {
	*Client
}

func (*CollaborationService) AddCollaboration

func (c *CollaborationService) AddCollaboration(
	itemId,
	itemType,
	accessibleId,
	accessibleType,
	accessibleEmail,
	role string) (*http.Response, *Collaboration, error)

Documentation: https://developers.box.com/docs/#collaborations-add-a-collaboration

func (*CollaborationService) EditCollaboration

func (c *CollaborationService) EditCollaboration(collaborationId, role, status string) (*http.Response, *Collaboration, error)

Documentation: https://developers.box.com/docs/#collaborations-edit-a-collaboration

func (*CollaborationService) GetPendingCollaborations

func (c *CollaborationService) GetPendingCollaborations() (*http.Response, *Collaborations, error)

Documentation: https://developers.box.com/docs/#collaborations-get-pending-collaborations NOTE(ttacon): not doing to add param since it's just calling the first url with an explicit query string (that never changes, why isn't it an actual route then, or bundled into the documentation of the first one?)

func (*CollaborationService) RemoveCollaboration

func (c *CollaborationService) RemoveCollaboration(collaborationId string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#collaborations-remove-a-collaboration

func (*CollaborationService) RetrieveCollaboration

func (c *CollaborationService) RetrieveCollaboration(collaborationId string) (*http.Response, *Collaboration, error)

Documentation: https://developers.box.com/docs/#collaborations-retrieve-a-collaboration

type Collaborations

type Collaborations struct {
	TotalCount int `json:"total_count"`
	Offset     int `json:"offset"`
	Limit      int `json:"limit"`
	Entries    []*Collaboration
}

type CollectionInfo

type CollectionInfo struct {
	TotalCount int `json:"total_count"`
	Offset     int `json:"offset"`
	Limit      int `json:"limit"`
}

type Comment

type Comment struct {
	Type           string `json:"type"`
	Id             string `json:"id"`
	IsReplyComment bool   `json:"is_reply_comment"`
	Message        string `json:"message"`
	CreatedBy      *Item  `json:"created_by"` // TODO(ttacon): change this to user, this needs to be a mini-user struct
	Item           *Item  `json:"item"`
	CreatedAt      string `json:"created_at"`  // TODO(ttacon): change to time.Time
	ModifiedAt     string `json:"modified_at"` // TODO(ttacon): change to time.Time
}

type CommentCollection

type CommentCollection struct {
	TotalCount int        `json:"total_count"`
	Entries    []*Comment `json:"entries"`
}

type CommentService

type CommentService struct {
	*Client
}

func (*CommentService) AddComment

func (c *CommentService) AddComment(itemType, id, message, taggedMessage string) (*http.Response, *Comment, error)

Documentation: https://developers.box.com/docs/#comments-add-a-comment-to-an-item

func (*CommentService) ChangeCommentsMessage

func (c *CommentService) ChangeCommentsMessage(commendId, message string) (*http.Response, *Comment, error)

Documentation: https://developers.box.com/docs/#comments-change-a-comments-message

func (*CommentService) DeleteComment

func (c *CommentService) DeleteComment(commentId string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#comments-delete-a-comment

func (*CommentService) GetComment

func (c *CommentService) GetComment(commentId string) (*http.Response, *Comment, error)

Documentation: https://developers.box.com/docs/#comments-get-information-about-a-comment

type ConfigSource

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

func NewConfigSource

func NewConfigSource(cfg *oauth2.Config) *ConfigSource

func (*ConfigSource) NewClient

func (c *ConfigSource) NewClient(tok *oauth2.Token) *Client

type CountedEmailAliases

type CountedEmailAliases struct {
	TotalCount int          `json:"total_count"`
	Entries    []EmailAlias `json:"entries"`
}

type EmailAlias

type EmailAlias struct {
	Type        string `json:"type"`
	ID          string `json:"id"`
	IsConfirmed bool   `json:"is_confirmed"`
	Email       string `json:"email"`
}

type Event

type Event struct {
	Type          string          `json:"type"`
	EventID       string          `json:"event_id"`
	CreatedBy     *User           `json:"created_by"`
	EventType     string          `json:"event_type"`
	SessionID     string          `json:"session_id"`
	Source        json.RawMessage `json:"source"`
	File          *File           `json:"-"`
	Folder        *Folder         `json:"-"`
	Comment       *Comment        `json:"-"`
	Collaboration *Collaboration  `json:"-"`
}

type EventCollection

type EventCollection struct {
	Entries            []*Event `json:"entries"`
	ChunkSize          int      `json:"chunk_size"`
	NextStreamPosition int      `json:"next_stream_position"`
}

type EventQueryOptions

type EventQueryOptions struct {
	StreamPosition string `url:"stream_position"`
	StreamType     string `url:"stream_type"`
	Limit          int    `url:"limit"`
}

type EventService

type EventService struct {
	*Client
}

func (*EventService) Channel

func (e *EventService) Channel(size int) chan *Event

func (*EventService) Events

Events retrieves events for the currently authenticated user.

See: https://developers.box.com/docs/#events-get-events-for-a-user

func (*EventService) ListenForEvent

func (e *EventService) ListenForEvent(i LongPollConnInfo, lastSync string) (*http.Response, []*Event, error)

func (*EventService) LongPollURL

func (e *EventService) LongPollURL() (*http.Response, *LongPollInfo, error)

type File

type File struct {
	ID                string          `json:"id,omitempty"`
	FolderUploadEmail *AccessEmail    `json:"folder_upload_email,omitempty"`
	Parent            *Item           `json:"parent,omitempty"`
	ItemStatus        string          `json:"item_status"`
	ItemCollection    *ItemCollection `json:"item_collection"`
	Type              string          `json:"type"` // TODO(ttacon): enum
	Description       string          `json:"description"`
	Size              int             `json:"size"`
	CreatedBy         *Item           `json:"created_by"`
	ModifiedBy        *Item           `json:"modified_by"`
	TrashedAt         *string         `json:"trashed_at"`          // TODO(ttacon): change to time.Time
	ContentModifiedAt *string         `json:"content_modified_at"` // TODO(ttacon): change to time.Time
	PurgedAt          *string         `json:"purged_at"`           // TODO(ttacon): change to time.Time, this field isn't documented but I keep getting it back...
	SharedLinkg       *string         `json:"shared_link"`
	SequenceId        string          `json:"sequence_id"`
	ETag              *string         `json:"etag"`
	Name              string          `json:"name"`
	CreatedAt         *string         `json:"created_at"` // TODO(ttacon): change to time.Time
	OwnedBy           *Item           `json:"owned_by"`
	ModifiedAt        *string         `json:"modified_at"`        // TODO(ttacon): change to time.Time
	ContentCreatedAt  *string         `json:"content_created_at"` // TODO(ttacon): change to time.Time
	PathCollection    *PathCollection `json:"path_collection"`    // TODO(ttacon): make sure this is the correct kind of struct(ure)
	SharedLink        *Link           `json:"shared_link"`

	SHA1 string `json:"sha1"`
}

TODO(ttacon): reconcile this with Folder for one common struct?

type FileCollection

type FileCollection struct {
	TotalCount int     `json:"total_count"`
	Entries    []*File `json:"entries"`
}

type FileService

type FileService struct {
	*Client
}

func (*FileService) CopyFile

func (c *FileService) CopyFile(fileId, parent, name string) (*http.Response, *File, error)

Documentation: https://developers.box.com/docs/#files-copy-a-file

func (*FileService) CreateSharedLinkForFile

func (c *FileService) CreateSharedLinkForFile(fileId, access, unsharedAt string, canDownload, canPreview bool) (*http.Response, *File, error)

Documentation: https://developers.box.com/docs/#files-create-a-shared-link-for-a-file

func (*FileService) DeleteFile

func (c *FileService) DeleteFile(fileId string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#files-delete-a-file

func (*FileService) DeleteVersion

func (f *FileService) DeleteVersion(fileID, fileVersion string) (*http.Response, bool, error)

Documentation: https://developers.box.com/docs/#files-delete-version

func (*FileService) DownloadFile

func (c *FileService) DownloadFile(fileId string) (*http.Response, error)

NOTE: we return the http.Response as Box may return a 202 if there is not yet a download link, or a 302 with the link - this allows the user to decide what to do. Documentation: https://developers.box.com/docs/#files-download-a-file

func (*FileService) DownloadVersion

func (c *FileService) DownloadVersion(fileId, version string) (*http.Response, io.ReadCloser, error)

Documentation: https://developers.box.com/docs/#files-download-old-version

func (*FileService) GetFile

func (c *FileService) GetFile(fileId string) (*http.Response, *File, error)

Documentation: https://developer.box.com/docs/#files-get

func (*FileService) GetThumbnail

func (c *FileService) GetThumbnail(fileId string) (*http.Response, error)

NOTE: we only return the response as there are many possible responses that we feel the user should have control over Documentation: https://developers.box.com/docs/#files-get-a-thumbnail-for-a-file

func (*FileService) GetTrashedFile

func (c *FileService) GetTrashedFile(fileId string) (*http.Response, *File, error)

Documentation: https://developers.box.com/docs/#files-get-a-trashed-file

func (*FileService) Lock

func (f *FileService) Lock(fileID string, lock *Lock) (*http.Response, error)

Documentation: https://developers.box.com/docs/#files-lock-and-unlock

func (*FileService) PermanentlyDeleteTrashedFile

func (c *FileService) PermanentlyDeleteTrashedFile(fileId string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#files-permanently-delete-a-trashed-file

func (*FileService) PreflightCheck

func (f *FileService) PreflightCheck(file *File) (*http.Response, bool, error)

Documentation: https://developers.box.com/docs/#files-preflight-check

func (*FileService) PromoteVersion

func (f *FileService) PromoteVersion(fileID, fileVersion string) (*http.Response, *FileVersion, error)

Documentation: https://developers.box.com/docs/#files-promote-old-version

func (*FileService) RestoreTrashedItem

func (c *FileService) RestoreTrashedItem(fileId, name, parentId string) (*http.Response, *File, error)

Documentation: https://developers.box.com/docs/#files-restore-a-trashed-item

func (*FileService) Update

func (f *FileService) Update(file *File) (*http.Response, *File, error)

Documentation: https://developers.box.com/docs/#files-update-a-files-information

func (*FileService) UploadFile

func (c *FileService) UploadFile(filePath, parentId string) (*http.Response, *FileCollection, error)

Documentation https://developer.box.com/docs/#files-upload-a-file TODO(ttacon): deal with handling SHA1 headers

func (*FileService) UploadFileVersion

func (f *FileService) UploadFileVersion(path, fileID string) (*http.Response, *FileCollection, error)

Documentation: https://developers.box.com/docs/#files-upload-a-new-version-of-a-file

func (*FileService) ViewVersionsOfFile

func (c *FileService) ViewVersionsOfFile(fileId string) (*http.Response, *FileCollection, error)

Documentation: https://developers.box.com/docs/#files-view-versions-of-a-file TODO(ttacon): don't use file collection, make actual structs specific to file versions

type FileVersion

type FileVersion struct {
	Type       string `json:"type"`
	ID         string `json:"id"`
	SHA1       string `json:"sha1"`
	Name       string `json:"name"`
	Size       int    `json:"size"`
	CreatedAt  string `json:"created_at"`
	ModifiedAt string `json:modified_at""`
	ModifiedBy *Item  `json:"modified_by"`
}

type Folder

type Folder struct {
	ID                string          `json:"id,omitempty"`
	FolderUploadEmail *AccessEmail    `json:"folder_upload_email,omitempty"`
	Parent            *Item           `json:"parent,omitempty"`
	ItemStatus        string          `json:"item_status"`
	ItemCollection    *ItemCollection `json:"item_collection"`
	Type              string          `json:"type"`
	Description       string          `json:"description"`
	Size              int             `json:"size"`
	CreatedBy         *Item           `json:"created_by"`
	ModifiedBy        *Item           `json:"modified_by"`
	TrashedAt         *string         `json:"trashed_at"`          // TODO(ttacon): change to time.Time
	ContentModifiedAt *string         `json:"content_modified_at"` // TODO(ttacon): change to time.Time
	PurgedAt          *string         `json:"purged_at"`           // TODO(ttacon): change to time.Time, this field isn't documented but I keep getting it back...
	SequenceId        string          `json:"sequence_id"`
	ETag              *string         `json:"etag"`
	Name              string          `json:"name"`
	CreatedAt         *string         `json:"created_at"` // TODO(ttacon): change to time.Time
	OwnedBy           *Item           `json:"owned_by"`
	ModifiedAt        *string         `json:"modified_at"`        // TODO(ttacon): change to time.Time
	ContentCreatedAt  *string         `json:"content_created_at"` // TODO(ttacon): change to time.Time
	PathCollection    *PathCollection `json:"path_collection"`    // TODO(ttacon): make sure this is the correct kind of struct(ure)
	SharedLink        *Link           `json:"shared_link"`
}

Documentation: https://developers.box.com/docs/#folders-folder-object

type FolderService

type FolderService struct {
	*Client
}

func (*FolderService) CopyFolder

func (c *FolderService) CopyFolder(src, dest, name string) (*http.Response, *Folder, error)

Documentation: https://developers.box.com/docs/#folders-copy-a-folder

func (*FolderService) CreateFolder

func (c *FolderService) CreateFolder(name string, parent int) (*http.Response, *Folder, error)

TODO(ttacon): return the response so the user can check the status code or we should check it? it's more flexible if we let the user decide what they view as an error Documentation: https://developers.box.com/docs/#folders-create-a-new-folder

func (*FolderService) GetFolder

func (c *FolderService) GetFolder(folderId string) (*http.Response, *Folder, error)

TODO(ttacon): can these ids be non-integer? if not, why are they returned as strings in the API TODO(ttacon): return the response for the user to play with if they want Documentation: https://developers.box.com/docs/#folders-get-information-about-a-folder

func (*FolderService) GetFolderItems

func (c *FolderService) GetFolderItems(folderId string) (*http.Response, *ItemCollection, error)

TODO(ttacon): return the response for the user to play with if they want Documentation: https://developers.box.com/docs/#folders-retrieve-a-folders-items

func (*FolderService) GetTrashedFolder

func (c *FolderService) GetTrashedFolder(folderId string) (*http.Response, *Folder, error)

Documentation: https://developers.box.com/docs/#folders-get-a-trashed-folder

func (*FolderService) ItemsInTrash

func (c *FolderService) ItemsInTrash(fields []string, limit, offset int) (*http.Response, *ItemCollection, error)

Documentation: https://developers.box.com/docs/#folders-get-the-items-in-the-trash

func (*FolderService) PermanentlyDeleteTrashedFolder

func (c *FolderService) PermanentlyDeleteTrashedFolder(folderId string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#folders-permanently-delete-a-trashed-folder

func (*FolderService) RestoreTrashedFolder

func (c *FolderService) RestoreTrashedFolder(folderId, name, parent string) (*http.Response, *Folder, error)

Documentation: https://developers.box.com/docs/#folders-restore-a-trashed-folder NOTES:

-name and parent id are not required unless the previous parent folder no
 longer exists or a folder with the previous name exists

type Group

type Group struct {
	Type       string `json:"type"`
	ID         string `json:"id"`
	Name       string `json:"name"`
	CreatedAt  string `json:"created_at"`
	ModifiedAt string `json:"modified_at"`
}

type GroupCollection

type GroupCollection struct {
	TotalCount int     `json:"total_count"`
	Entries    []Group `json:"entries"`
	Limit      int     `json:"limit"`
	Offset     int     `json:"offset"`
}

type GroupService

type GroupService struct {
	*Client
}

func (*GroupService) AddUserToGroup

func (g *GroupService) AddUserToGroup(uID, gID, role string) (*http.Response, *Membership, error)

Documentation: https://developers.box.com/docs/#groups-add-a-member-to-a-group

func (*GroupService) CreateGroup

func (c *GroupService) CreateGroup(name string) (*http.Response, *Group, error)

Docs: https://developers.box.com/docs/#groups-create-a-group TODO(ttacon): test it

func (*GroupService) DeleteGroup

func (c *GroupService) DeleteGroup(groupID string) (*http.Response, bool, error)

Docs: https://developers.box.com/docs/#delete-a-group TODO(ttacon): test it

func (*GroupService) DeleteMembership

func (g *GroupService) DeleteMembership(membershipID string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#groups-delete-a-group-membership

func (*GroupService) Groups

func (c *GroupService) Groups() (*http.Response, []Group, error)

Docs: https://developers.box.com/docs/#groups-get-all-groups TODO(ttacon): test it

func (*GroupService) Membership

func (g *GroupService) Membership(membershipEntryID string) (*http.Response, *Membership, error)

func (*GroupService) UpdateGroup

func (c *GroupService) UpdateGroup(groupID, name string) (*http.Response, *Group, error)

Docs: https://developers.box.com/docs/#update-a-group TODO(ttacon): test it

func (*GroupService) UpdateMembership

func (g *GroupService) UpdateMembership(membershipID, role string) (*http.Response, *Membership, error)

Documentation: https://developers.box.com/docs/#groups-update-a-group-membership

type Item

type Item struct {
	Type       string  `json:"type,omitempty"` // TODO(ttacon): make this an enum eventually
	ID         string  `json:"id,omitempty"`
	SequenceId string  `json:"sequence_id,omitempty"` // no idea what this is supposed to be
	ETag       *string `json:"etag,omitempty"`        // again, not sure what this type is supposed to be
	Name       string  `json:"name,omitempty"`
	Login      string  `json:"login,omitempty"`
	SHA1       string  `json:"sha"`
}

type ItemCollection

type ItemCollection struct {
	TotalCount int      `json:"total_count,omitempty"`
	Entries    []*Item  `json:"entries,omitempty"` // this is probably items... TODO(ttacon): double check
	Offset     int      `json:"offset,omitempty"`
	Limit      int      `json:"limit,omitempty"`
	Order      []*Order `json:"order"`
}
type Link struct {
	Url               string       `json:"url"`
	DownloadUrl       *string      `json:"download_url"`
	VanityUrl         *string      `json:"vanity_url"`
	IsPasswordEnabled bool         `json:"is_password_enabled"`
	UnsharedAt        *string      `json:"unshared_at"` // TODO(ttacon): change to time.Time
	DownloadCount     int          `json:"download_count"`
	PreviewCount      int          `json:"preview_count"`
	Access            string       `json:"access"` // TODO(ttacon): consider enums for these types of values?
	Permissions       *Permissions `json:"permissions"`
}

type Lock

type Lock struct {
	Type                string `json:"type"`
	ExpiresAt           string `json:"expires_at"`
	IsDownloadPrevented bool   `json:"is_download_prevented"`
}

type LongPollConnInfo

type LongPollConnInfo struct {
	Type         string `json:"type"`
	URL          string `json:"url"`
	TTL          string `json:"ttl"`
	MaxRetries   string `json:"max_retries"`
	RetryTimeout int    `json:"retry_timeout"`
}

type LongPollInfo

type LongPollInfo struct {
	ChunkSize int                `json:"chunk_size"`
	Entries   []LongPollConnInfo `json:"entries"`
}

type Membership

type Membership struct {
	Type  string `json:"type"`
	ID    string `json:"id"`
	User  *User  `json:"user"`
	Group *Group `json:"group"`
	Role  string `json:"role"`
}

type MembershipCollection

type MembershipCollection struct {
	CollectionInfo
	Entries []*Membership `json:"entries"`
}

type Order

type Order struct {
	By        string `json:"by"`
	Direction string `json:"direction"`
}

type PathCollection

type PathCollection struct {
	TotalCount int     `json:"total_count"`
	Entries    []*Item `json:"entries"`
}

type Permissions

type Permissions struct {
	CanDownload bool `json:"can_download"`
	CanPreview  bool `json:"can_preview"`
}

TODO(ttacon): leave plurality?

type SharedItem

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

func (*SharedItem) UnmarshalJSON

func (s *SharedItem) UnmarshalJSON(data []byte) error

type SharedLinkOptions

type SharedLinkOptions struct {
	Access      *string                `json:"access"`
	UnsharedAt  *time.Time             `json:"unshared_at,omitempty"`
	Permissions *SharedLinkPermissions `json:"permissions,omitempty"`
}

type SharedLinkPermissions

type SharedLinkPermissions struct {
	CanDownload bool `json:"can_download"`
	CanPreview  bool `json:"can_preview"`
}

type SharedService

type SharedService struct {
	*Client
}

func (*SharedService) GetItem

func (s *SharedService) GetItem(link, password string) (*http.Response, *SharedItem, error)

Documentation: https://developers.box.com/docs/#shared-items-get-a-shared-item

type Task

type Task struct {
	Type                     string                    `json:"type"`
	Id                       string                    `json:"id"`
	Item                     *Item                     `json:"item"`
	DueAt                    *string                   `json:"due_at"`     // TODO(ttacon): time.Time
	CreatedAt                *string                   `json:"created_at"` // TODO(ttacon): time.Time
	CreatedBy                *Item                     `json:"created_by"` // TODO(ttacon): change to user
	Action                   *string                   `json:"action"`     //TODO(ttacon): validation as this must be 'review'?
	Message                  *string                   `json:"message"`
	IsCompleted              *bool                     `json:"is_completed"`
	TaskAssignmentCollection *TaskAssignmentCollection `json:"task_assignment_collection"`
}

Documentation: https://developers.box.com/docs/#tasks-task-object TODO(ttacon): add missing fields

type TaskAssignment

type TaskAssignment struct {
	Type            *string `json:"type"`
	Id              string  `json:"id"`
	Item            *Item   `json:"item"`
	AssignedTo      *Item   `json:"assigned_to"` // TODO(ttacon): change to mini-user
	Message         *string `json:"message"`
	ResolutionState *string `json:"resolution_state"`
	AssignedBy      *Item   `json:"assigned_by"`  // TODO(ttacon): change to mini-user
	CompletedAt     *string `json:"completed_at"` // TODO(ttacon): time.Time
	AssignedAt      *string `json:"assigned_at"`  // TODO(ttacon): time.Time
	RemindedAt      *string `json:"reminded_at"`  // TODO(ttacon): time.Time
}

TODO(ttacon): find out where the deuce this is defined in their documentation?!?!?!

type TaskAssignmentCollection

type TaskAssignmentCollection struct {
	TotalCount int               `json:"total_count"`
	Entries    []*TaskAssignment `json:"entries"`
}

type TaskCollection

type TaskCollection struct {
	TotalCount int     `json:"total_count"`
	Entries    []*Task `json:"entries"`
}

type TaskService

type TaskService struct {
	*Client
}

func (*TaskService) CreateTask

func (c *TaskService) CreateTask(itemId, itemType, action, message, due_at string) (*http.Response, *Task, error)

Documentation: https://developers.box.com/docs/#tasks-create-a-task

func (*TaskService) CreateTaskAssignment

func (c *TaskService) CreateTaskAssignment(taskId, taskType, assignToId, assignToLogin string) (*http.Response, *TaskAssignment, error)

Documentation: https://developers.box.com/docs/#tasks-create-a-task-assignment

func (*TaskService) DeleteTask

func (c *TaskService) DeleteTask(taskId string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#tasks-delete-a-task

func (*TaskService) DeleteTaskAssignment

func (c *TaskService) DeleteTaskAssignment(taskAssignmentId string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#tasks-delete-a-task-assignment

func (*TaskService) GetAssignmentsForTask

func (c *TaskService) GetAssignmentsForTask(taskId string) (*http.Response, *TaskAssignmentCollection, error)

Documentation: https://developers.box.com/docs/#tasks-get-the-assignments-for-a-task TODO(ttacon): rename when add per resource services

func (*TaskService) GetTask

func (c *TaskService) GetTask(taskId string) (*http.Response, *Task, error)

Documentation: https://developers.box.com/docs/#tasks-get-a-task

func (*TaskService) GetTaskAssignment

func (c *TaskService) GetTaskAssignment(taskAssignmentId string) (*http.Response, *TaskAssignment, error)

Documentation: https://developers.box.com/docs/#tasks-get-a-task-assignment

func (*TaskService) UpdateTask

func (c *TaskService) UpdateTask(taskId, action, message, due_at string) (*http.Response, *Task, error)

Documentation: https://developers.box.com/docs/#tasks-update-a-task

func (*TaskService) UpdateTaskAssignment

func (c *TaskService) UpdateTaskAssignment(taskAssignmentId, message, resolution_state string) (*http.Response, *TaskAssignment, error)

Documentation: https://developers.box.com/docs/#tasks-update-a-task-assignment

type User

type User struct {
	Type                          string   `json:"type,omitempty"` // TODO(ttacon): make this an enum eventually
	ID                            string   `json:"id,omitempty"`
	Name                          string   `json:"name,omitempty"`
	Login                         string   `json:"login,omitempty"`
	SHA1                          string   `json:"sha,omitempty"`
	CreatedAt                     *string  `json:"created_at,omitempty"`  // TODO(ttacon): change to time.Time
	ModifiedAt                    *string  `json:"modified_at,omitempty"` // TODO(ttacon): change to time.Time
	Role                          string   `json:"role,omitempty"`
	Language                      string   `json:"language,omitempty"`
	Timezone                      string   `json:"timezone,omitempty"`
	SpaceAmount                   int      `json:"space_amount,omitempty"`
	SpaceUsed                     int      `json:"space_used,omitempty"`
	MaxUploadSize                 int      `json:"max_upload_size,omitempty"`
	TrackingCodes                 string   `json:"tracking_codes,omitempty"` // TODO(ttacon): not sure what this should me
	CanSeeManagedUsers            bool     `json:"can_see_managed_users,omitempty"`
	IsSyncEnabled                 bool     `json:"is_sync_enabled,omitempty"`
	IsExternalCollabRestricted    bool     `json:"is_external_collab_restricted,omitempty"`
	Status                        string   `json:"status,omitempty"`
	JobTitle                      string   `json:"job_title,omitempty"`
	Phone                         string   `json:"phone,omitempty"`
	Address                       string   `json:"address,omitempty"`
	AvatarUrl                     string   `json:"avatar_url,omitempty"`
	IsExemptFromDeviceLimits      bool     `json:"is_exempt_from_device_limits,omitempty"`
	IsExemptFromLoginVerification bool     `json:"is_exempt_from_login_verification,omitempty"`
	Enterprise                    *Item    `json:"enterprise,omitempty"`
	MyTags                        []string `json:"my_tags,omitempty"`
}

type UserService

type UserService struct {
	*Client
}

func (*UserService) ChangePrimaryLogin

func (c *UserService) ChangePrimaryLogin(userID, newLogin string) (*http.Response, *User, error)

Docs: https://developers.box.com/docs/#users-changing-a-users-primary-login

func (*UserService) CreateUser

func (c *UserService) CreateUser(user *User) (*http.Response, *User, error)

Documentation: https://developers.box.com/docs/#users-create-an-enterprise-user

func (*UserService) DeletEmailAlias

func (c *UserService) DeletEmailAlias(userID, emailAliasID string) (*http.Response, bool, error)

Docs: https://developers.box.com/docs/#users-remove-an-email-alias-from-a-user

func (*UserService) DeleteUser

func (u *UserService) DeleteUser(userID string) (*http.Response, error)

Documentation: https://developers.box.com/docs/#users-delete-an-enterprise-user

func (*UserService) GetEnterpriseUsers

func (c *UserService) GetEnterpriseUsers() (*http.Response, *Users, error)

func (*UserService) Membership

func (c *UserService) Membership(userID string) (*http.Response, *MembershipCollection, error)

func (*UserService) UpdateUser

func (u *UserService) UpdateUser(user *User) (*http.Response, *User, error)

Documentation: https://developers.box.com/docs/#users-update-a-users-information

func (*UserService) User

func (u *UserService) User(userID string) (*http.Response, *User, error)

Documentation: https://developers.box.com/docs/#users-get-a-users-information

type Users

type Users struct {
	TotalCount int    `json:"total_count"`
	Entries    []User `json:"entries"`
}

Jump to

Keyboard shortcuts

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