package
2.263.0
Repository: https://github.com/onsdigital/dp-api-clients-go.git
Documentation: pkg.go.dev

# 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:

# 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