filelocker

package
v0.0.0-...-742ca42 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.0.1"

Version is the main version number that is being run at the moment.

View Source
const VersionPrerelease = ""

VersionPrerelease is a pre-release marker for the version. If this is "" then it means that it is a final release. Otherwise, this is a pre-release such as "dev" (in development), "beta", "rc1", etc.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL  *url.URL     // base URL for "API" calls to filelocker.  ie. https://files.yale.edu/cli/
	Client   *http.Client // HTTP client used to communicate with the "API".
	Errors   []string
	Messages []string
	Origin   string
}

Client is a filelocker client

func NewClient

func NewClient(userID, apiKey, baseURL string, httpClient *http.Client) (*Client, error)

NewClient returns a new Filelocker "API" client. If a nil httpClient is provided, http.DefaultClient will be used with a 30s timeout. A userID, apiKey, and baseURL must also be passed and a session will be established.

func (*Client) Delete

func (c *Client) Delete(files []string) (*DeleteResponse, error)

Delete removes a file from filelocker. It requires an authenticated client.

func (*Client) Files

func (c *Client) Files() (*FilesResponse, error)

Files lists the uploaded files in filelocker. It requires an authenticated client.

func (*Client) Groups

func (c *Client) Groups() (*GroupsResponse, error)

Groups lists a users groups in filelocker. It requires an authenticated client.

func (*Client) NewSecureMessage

func (c *Client) NewSecureMessage(subject, msg string, recipients []string, expire time.Time) (*NewMessageResponse, error)

NewSecureMessage sends a new secure message via filelocker

func (*Client) SecureMessageRead

func (c *Client) SecureMessageRead(id int) (*SecureMessageReadResponse, error)

SecureMessageRead marks a message ID as read

func (*Client) SecureMessages

func (c *Client) SecureMessages() (*SecureMessagesResponse, error)

SecureMessages gets the list of messages for a user

func (*Client) SecureMessagesCount

func (c *Client) SecureMessagesCount() (*SecureMessageCountResponse, error)

SecureMessagesCount gets the new messages count

func (*Client) SecureMessagesDelete

func (c *Client) SecureMessagesDelete(ids []int) (*SecureMessagesDeleteResponse, error)

SecureMessagesDelete marks a message ID as read

func (*Client) Upload

func (c *Client) Upload(name, notes string, scan bool, f io.Reader) (*UploadResponse, error)

Upload takes an io.ReadCloser , reads and uploads from it and then returns the response

type DeleteResponse

type DeleteResponse struct {
	ErrorMessages []string `xml:"messages>error"`
	InfoMessages  []string `xml:"messages>info"`
}

DeleteResponse is the response from filelocker for a list of the user's groups

type File

type File struct {
	ID           string `xml:"id,attr"`
	Name         string `xml:"name,attr"`
	Size         int    `xml:"size,attr"`
	PassedAvScan bool   `xml:"passedAvScan,attr"`
}

File is a file respresentation from filelocker

type FilesResponse

type FilesResponse struct {
	Files         []File   `xml:"data>file"`
	ErrorMessages []string `xml:"messages>error"`
	InfoMessages  []string `xml:"messages>info"`
}

FilesResponse is the response from filelocker for a list of the user's files

type Group

type Group struct {
	ID   string `xml:"id,attr"`
	Name string `xml:"name,attr"`
}

Group is a user's group respresentation from filelocker

type GroupsResponse

type GroupsResponse struct {
	Groups        []Group  `xml:"data>group"`
	ErrorMessages []string `xml:"messages>error"`
	InfoMessages  []string `xml:"messages>info"`
}

GroupsResponse is the response from filelocker for a list of the user's groups

type NewMessageResponse

type NewMessageResponse struct {
	ErrorMessages []string `json:"fMessages"`
	InfoMessages  []string `json:"sMessages"`
}

NewMessageResponse is the response from filelocker sending a new secure message

type SecureMessage

type SecureMessage struct {
	Body       string   `json:"body"`
	Created    string   `json:"creationDatetime"`
	Expiration string   `json:"expirationDatetime"`
	ID         int      `json:"id"`
	OwnerID    string   `json:"ownerId"`
	Recipients []string `json:"messageRecipients"`
	Subject    string   `json:"subject"`
	Viewed     string   `json:"viewedDatetime"`
}

SecureMessage is an encrypted message sent through filelocker

type SecureMessageCountResponse

type SecureMessageCountResponse struct {
	Count         int      `json:"data"`
	ErrorMessages []string `json:"fMessages"`
	InfoMessages  []string `json:"sMessages"`
}

SecureMessageCountResponse is a response for the count of new messages

type SecureMessageReadResponse

type SecureMessageReadResponse struct {
	ErrorMessages []string `json:"fMessages"`
	InfoMessages  []string `json:"sMessages"`
}

SecureMessageReadResponse is the response for marking a message as read

type SecureMessagesDeleteResponse

type SecureMessagesDeleteResponse struct {
	ErrorMessages []string `json:"fMessages"`
	InfoMessages  []string `json:"sMessages"`
}

SecureMessagesDeleteResponse is the response for deleting a secure message

type SecureMessagesResponse

type SecureMessagesResponse struct {
	Messages      [][]SecureMessage `json:"data"`
	ErrorMessages []string          `json:"fMessages"`
	InfoMessages  []string          `json:"sMessages"`
}

SecureMessagesResponse is the response for the list of secure messages

type UploadResponse

type UploadResponse struct {
	ErrorMessages []string `xml:"messages>error"`
	InfoMessages  []string `xml:"messages>info"`
	File          File     `xml:"data>file"`
}

UploadResponse is the response from filelocker upload

Jump to

Keyboard shortcuts

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