# README
Static File Upload Client
Usage
Setup
Local:
c := upload.NewAPIClient("http://localhost:25100")
Remote:
c := upload.NewAPIClient("http://localhost:11850")
Uploading a file
f := io.NopCloser(strings.NewReader("File content"))
m := upload.Metadata{
CollectionID: &collectionID, // Collection ID is option. Leave it unset if you do not have it at upload
FileName: "test.txt",
Path: "testing/docs",
IsPublishable: true,
Title: "A testing file",
FileSizeBytes: 12,
FileType: "text/plain",
License: "MIT",
LicenseURL: "https://opensource.org/licenses/MIT",
}
err := c.Upload(f, m)
if err != nil {
...
}
Notes:
- all fields are required, except collection Id
- but it must be set before publishing
- see https://github.com/ONSdigital/dp-api-clients-go/tree/main/files
- File name will be part of the AWS S3 object name so should adhere to the S3 object naming guidelines
- Path will be part of the AWS S3 bucket name so should adhere to the S3 bucket naming rules
- FileType is the the mime type of the file being uploaded
- used when file is downloaded
# Functions
NewAPIClient creates a new instance of Upload Client with a given image API URL.
# Constants
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
Client is an upload API client which can be used to make requests to the server.
No description provided by the author