debian-forge-composer/internal/client
Brian C. Lane 55325a8549 weldr: Add API v1 support to source listing
This is the first patch in a series to add APIv1 support to the
/projects/source routes. The change involves using the store.Sources key
in a different way (as an id instead of as a duplicate of the struct's
Name field) but does not actually involve changing the Sources json in
the store.

In the V0 API the name of the source was used as the identifier, and
there was no short id. In V1 the source is identified by the API using
a short id, and the Name is just a field in the struct to describe the
source. This will become more obvious with the /projects/source/info
response.

This commit changes the following:

Changes store.ListSources to ListSourcesByName and explicitly pulls the
name from the source struct instead of the key. v0 will use this
function call.

Adds store.ListSourcesById which returns the source key as the
identifier. This is used by v1.

Adds a new weldr.SourcesListV1 response type, even though it is exactly
the same as the V1 response in this specific case. I thought it would be
better to have one called V1 than to reuse the V0 struct and possibly
confuse people.

The /projects/source/list API now lists the sources by name for v0 and id for v1.

A test has been added. You will notice it still uses v0 to push and
delete the sources. These will be updated when the new version of the
functions are added in subsequent commits.
2020-06-03 21:24:47 +02:00
..
blueprints.go Move the API struct definitions into internal/weldr 2020-03-23 21:08:01 +01:00
blueprints_test.go tests: Add missing descriptions to test blueprints 2020-05-28 08:28:11 +02:00
client.go client: Add GetRawBody function to return the io.ReadCloser from the request 2020-04-15 11:35:05 +02:00
client_test.go tests: replace cmd.Diff() with require functions 2020-04-20 14:00:49 +02:00
compose.go client: Add functions to handle Metadata and Results requests 2020-05-28 00:39:10 +02:00
compose_test.go tests: lorax-composer returns 2 errors for these tests 2020-05-28 08:28:11 +02:00
integration_test.go client: drop client timeout in tests 2020-05-12 22:38:10 +02:00
modules.go client: Add /modules/ support 2020-03-25 10:01:14 +01:00
modules_test.go client: Handle the differences between unit tests and integration tests 2020-03-27 19:07:33 +01:00
projects.go client: Add /projects/ support 2020-03-25 10:01:14 +01:00
projects_test.go client: Handle the differences between unit tests and integration tests 2020-03-27 19:07:33 +01:00
source.go weldr: Add API v1 support to source listing 2020-06-03 21:24:47 +02:00
source_test.go weldr: Add API v1 support to source listing 2020-06-03 21:24:47 +02:00
unit_test.go rpmmd/RepoConf: rename Id to Name 2020-05-28 00:23:54 +02:00
utils.go client: drop client timeout in tests 2020-05-12 22:38:10 +02:00
weldr.go Move the API struct definitions into internal/weldr 2020-03-23 21:08:01 +01:00