Documentation ¶
Index ¶
- func HTTPStatusToError(status int) error
- func MCClient() *ezhttp.EzClient
- func MCUrl() string
- func ToError(resp *http.Response, errs []error) error
- func ToJSON(from string, to interface{}) error
- func Url(path string) string
- type CreateProjectRequest
- type CreateProjectResponse
- type CreateUploadRequest
- type CreateUploadResponse
- type DirectoryRequest
- type GetDirectoryRequest
- type GetDirectoryResponse
- type ServerAPI
- func (s *ServerAPI) CreateProject(req CreateProjectRequest) (*CreateProjectResponse, error)
- func (s *ServerAPI) CreateUpload(req CreateUploadRequest) (*CreateUploadResponse, error)
- func (s *ServerAPI) DeleteUploadRequest(uploadID string) error
- func (s *ServerAPI) DownloadFile(projectID, fileID, fpath string) error
- func (s *ServerAPI) GetDirectory(req DirectoryRequest) (directoryID string, err error)
- func (s *ServerAPI) GetDirectoryList(projectID, directoryID string) (*ServerDir, error)
- func (s *ServerAPI) GetFileForPath(projectID, fpath string) (*ServerFile, error)
- func (s *ServerAPI) GetUserAPIKey(username, password string) (apikey string, err error)
- func (s *ServerAPI) ListUploadRequests(projectID string) ([]UploadEntry, error)
- func (s *ServerAPI) SendFlowData(req *flow.Request) (*UploadChunkResponse, error)
- type ServerDir
- type ServerFile
- type UploadChunkResponse
- type UploadEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPStatusToError ¶
HTTPStatusToError translates an http state to an application error.
func ToError ¶
ToError tests the list of errors and the response to determine the type of error to return. It calls HTTPStatusToError to translate response status codes to an error.
Types ¶
type CreateProjectRequest ¶
type CreateProjectRequest struct { Name string `json:"name"` MustNotExist bool `json:"must_not_exist"` }
CreateProjectRequest requests that a project be created. If MustNotExist is true, then the given project must not already exist. Existence is determined by the project name for that user.
type CreateProjectResponse ¶
type CreateProjectResponse struct { ProjectID string `json:"project_id"` Existing bool `json:"existing"` }
CreateProjectResponse returns the created project. If the project was an existing project and no new project was created then the Existing flag will be set to false.
type CreateUploadRequest ¶
type CreateUploadRequest struct { ProjectID string `json:"project_id"` DirectoryID string `json:"directory_id"` FileName string `json:"filename"` FileSize int64 `json:"filesize"` ChunkSize int32 `json:"chunk_size"` FileMTime string `json:"filemtime"` Checksum string `json:"checksum"` }
CreateRequest describes the JSON request a client will send to create a new upload request.
type CreateUploadResponse ¶
type CreateUploadResponse struct { RequestID string `json:"request_id"` StartingBlock uint `json:"starting_block"` }
uploadCreateResponse is the format of JSON sent back containing the upload request ID.
type DirectoryRequest ¶
type GetDirectoryRequest ¶
GetDirectoryRequest is a request to get a directory for a project. The directory lookup is by path within the context of the given project.
type GetDirectoryResponse ¶
type GetDirectoryResponse struct { DirectoryID string `json:"directory_id"` Path string `json:"path"` }
GetDirectoryResponse returns the directory id for a directory path for a given project.
type ServerAPI ¶
type ServerAPI struct {
// contains filtered or unexported fields
}
func (*ServerAPI) CreateProject ¶
func (s *ServerAPI) CreateProject(req CreateProjectRequest) (*CreateProjectResponse, error)
func (*ServerAPI) CreateUpload ¶
func (s *ServerAPI) CreateUpload(req CreateUploadRequest) (*CreateUploadResponse, error)
CreateUploadRequest will request an upload request from the server. If an existing upload matches the request then server will send the existing upload request.
func (*ServerAPI) DeleteUploadRequest ¶
DeleteUploadRequest will delete a given upload request.
func (*ServerAPI) DownloadFile ¶
func (*ServerAPI) GetDirectory ¶
func (s *ServerAPI) GetDirectory(req DirectoryRequest) (directoryID string, err error)
func (*ServerAPI) GetDirectoryList ¶
func (*ServerAPI) GetFileForPath ¶
func (s *ServerAPI) GetFileForPath(projectID, fpath string) (*ServerFile, error)
func (*ServerAPI) GetUserAPIKey ¶
GetUserAPIKey will return the users APIKey
func (*ServerAPI) ListUploadRequests ¶
func (s *ServerAPI) ListUploadRequests(projectID string) ([]UploadEntry, error)
ListUploadRequests will return all the upload requests for a given project ID.
func (*ServerAPI) SendFlowData ¶
func (s *ServerAPI) SendFlowData(req *flow.Request) (*UploadChunkResponse, error)
SendFlowData will send the data for a flow request.
type ServerFile ¶
type UploadChunkResponse ¶
type UploadEntry ¶
type UploadEntry struct { RequestID string `json:"request_id"` FileName string `json:"filename"` DirectoryID string `json:"directory_id"` ProjectID string `json:"project_id"` Size int64 `json:"size"` Host string `json:"host"` Checksum string `json:"checksum"` Birthtime time.Time `json:"birthtime"` }
UploadEntry is a client side representation of an upload.