https://github.com/flownative/harbor-api-client
This package provides API models and a client for Harbor
https://github.com/flownative/harbor-api-client
Last synced: 2 months ago
JSON representation
This package provides API models and a client for Harbor
- Host: GitHub
- URL: https://github.com/flownative/harbor-api-client
- Owner: flownative
- Created: 2024-06-26T15:42:09.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-06-26T16:17:47.000Z (12 months ago)
- Last Synced: 2025-04-03T09:15:27.436Z (2 months ago)
- Language: PHP
- Size: 96.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](http://opensource.org/licenses/MIT)
[](https://www.flownative.com/en/products/open-source.html)# Harbor OpenAPI client
This package provides a client for [Harbor](https://goharbor.io/). It was
auto-generated with [Jane](https://github.com/janephp/janephp) based on the
Harbor API v2.## Feature coverage
This library only provides subset of the resources provided by the Harbor
API. The included API paths are defined in `.jane-openapi`. If further
resources are needed, you can adjust the configuration as needed and rebuild
the client library.## 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:```bash
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:```php
use Http\Client\Common\Plugin\AddHostPlugin;
use Http\Client\Common\Plugin\AddPathPlugin;
use Http\Client\Common\Plugin\AuthenticationPlugin;
use Http\Message\Authentication\BasicAuth;
use Flownative\Harbor\Api\Model\ProjectReq;…
$client = \Flownative\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);
```