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 := files.NewAPIClient("http://localhost:26900")

If using a healthcheck client, it can be instantiated as follows:

import "github.com/ONSdigital/dp-api-clients-go/v2/health"

hcClient := health.NewClient("api-router", "http://localhost:26900")
c := files.NewWithHealthClient(hcClient)
c.Version = "v1"

Here you will notice that the version has been set for the files client. This is important as it will prepend this to GetFile requests. I.e. /{.Version}/files/*.

Remote:

c := files.NewAPIClient("http://localhost:12700")

Set collection ID

err := c.SetCollectionID(context.Background(), "testing/test.txt", "123456789")

if err != nil {
	...
}

Publish Collection

err := c.PublishCollection(context.Background(), "123456789")

if err != nil {
    ...
}

Get File by Path

result, err := client.GetFile(context.Background(), "test/testing.csv", "AUTH TOKEN")

if err != nil {
    ...
}

if result.IsPublshable {
	...
}

# Functions

NewAPIClient creates a new instance of files Client with a given image API URL.
NewWithHealthClient creates a new instances of files Client using healthcheck client.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Client is an files API client which can be used to make requests to the server.
No description provided by the author
No description provided by the author