scottbass3/harbor-api-client

This package provides API models and a client for Harbor

Installs: 4

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 1

pkg:composer/scottbass3/harbor-api-client

v1.0.1 2025-08-22 08:47 UTC

This package is auto-updated.

Last update: 2025-10-22 09:10:48 UTC


README

MIT license

Harbor OpenAPI client

This package provides a client for Harbor. It was auto-generated with Jane based on the Harbor API v2.

Rebuilding the client library

Jane provides commands for generating the client code. Switch to this package's directory and install Composer dependencies. You can then run a command for generating the code:

composer update
bin/jane-openapi-generate

Usage

The client is instantiated using the create() factory method. The following example shows how to create a project, authenticating with username and password of a Harbor robot user:

use Http\Client\Common\Plugin\AddHostPlugin;
use Http\Client\Common\Plugin\AddPathPlugin;
use Http\Client\Common\Plugin\AuthenticationPlugin;
use Http\Message\Authentication\BasicAuth;
use Scottbass3\Harbor\Api\Model\ProjectReq;

…

$client = \Scottbass3\Harbor\Api\Client::create(
    null,
    [
        new AddHostPlugin(
            $endpointUri
        ),
        new AddPathPlugin(
            $endpointUri
        ),
        new AuthenticationPlugin(
            new BasicAuth(
                $username,
                $password,
            )
        )
    ]
);

$projectRequest = new ProjectReq();
$projectRequest
    ->setProjectName((string)$projectName)
    ->setPublic(false);

$client->createProject($projectRequest);