openapi

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

README

Go API client for openapi

APPR API documentation

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 0.2.6
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./openapi"

Documentation for API Endpoints

All URIs are relative to https://localhost:5000

Class Method HTTP request Description
BlobsApi PullBlob Get /api/v1/packages/{namespace}/{package}/blobs/sha256/{digest} Pull a package blob by digest
BlobsApi PullBlobJson Get /api/v1/packages/{namespace}/{package}/blobs/sha256/{digest}/json Pull a package blob by digest
BlobsApi PullPackage Get /api/v1/packages/{namespace}/{package}/{release}/{media_type}/pull Download the package
BlobsApi PullPackageJson Get /api/v1/packages/{namespace}/{package}/{release}/{media_type}/pull/json Download the package
ChannelApi CreateChannel Post /api/v1/packages/{namespace}/{package}/channels Create a new channel
ChannelApi CreateChannelRelease Post /api/v1/packages/{namespace}/{package}/channels/{channel}/{release} Add a release to a channel
ChannelApi DeleteChannel Delete /api/v1/packages/{namespace}/{package}/channels/{channel} Delete channel
ChannelApi DeleteChannelRelease Delete /api/v1/packages/{namespace}/{package}/channels/{channel}/{release} Remove a release from the channel
ChannelApi ListChannels Get /api/v1/packages/{namespace}/{package}/channels List channels
ChannelApi ShowChannel Get /api/v1/packages/{namespace}/{package}/channels/{channel} show channel
InfoApi GetVersion Get /version Display api version
PackageApi CreatePackage Post /api/v1/packages Push new package release to the registry
PackageApi DeletePackage Delete /api/v1/packages/{namespace}/{package}/{release}/{media_type} Delete a package release
PackageApi ListPackages Get /api/v1/packages List packages
PackageApi PullPackage Get /api/v1/packages/{namespace}/{package}/{release}/{media_type}/pull Download the package
PackageApi PullPackageJson Get /api/v1/packages/{namespace}/{package}/{release}/{media_type}/pull/json Download the package
PackageApi ShowPackage Get /api/v1/packages/{namespace}/{package}/{release}/{media_type} Show a package
PackageApi ShowPackageManifests Get /api/v1/packages/{namespace}/{package}/{release} List all manifests for a package
PackageApi ShowPackageReleases Get /api/v1/packages/{namespace}/{package} List all releases for a package

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	BlobsApi *BlobsApiService

	ChannelApi *ChannelApiService

	InfoApi *InfoApiService

	PackageApi *PackageApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the APPR API API v0.2.6 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type BlobPullPackageJsonOpts

type BlobPullPackageJsonOpts struct {
	Format optional.String
}

type BlobPullPackageOpts

type BlobPullPackageOpts struct {
	Format optional.String
}

type BlobsApiService

type BlobsApiService service

func (*BlobsApiService) PullBlob

func (a *BlobsApiService) PullBlob(ctx context.Context, namespace string, package_ string, digest string) ([]byte, *http.Response, error)

BlobsApiService Pull a package blob by digest

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param namespace namespace
  • @param package_ package name
  • @param digest content digest

@return *os.File

func (*BlobsApiService) PullBlobJson

func (a *BlobsApiService) PullBlobJson(ctx context.Context, namespace string, package_ string, digest string, localVarOptionals *PullBlobJsonOpts) (PullJson, *http.Response, error)

func (*BlobsApiService) PullPackage

func (a *BlobsApiService) PullPackage(ctx context.Context, namespace string, package_ string, release string, mediaType string, localVarOptionals *BlobPullPackageOpts) (*os.File, *http.Response, error)

func (*BlobsApiService) PullPackageJson

func (a *BlobsApiService) PullPackageJson(ctx context.Context, namespace string, package_ string, release string, mediaType string, localVarOptionals *BlobPullPackageJsonOpts) (PullJson, *http.Response, error)

type Channel

type Channel struct {
	// Channel name
	Name string `json:"name,omitempty"`
	// Current/latest release in the channel. The channel returns this release by default
	Current string `json:"current,omitempty"`
	// All availables releases in the channel
	Releases []string `json:"releases,omitempty"`
}

Organize releases into channel, eg: dev/beta/stable

type ChannelApiService

type ChannelApiService service

func (*ChannelApiService) CreateChannel

func (a *ChannelApiService) CreateChannel(ctx context.Context, name string, namespace string, package_ string) (Channel, *http.Response, error)

ChannelApiService Create a new channel

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name Channel name
  • @param namespace namespace
  • @param package_ package name

@return Channel

func (*ChannelApiService) CreateChannelRelease

func (a *ChannelApiService) CreateChannelRelease(ctx context.Context, channel string, namespace string, package_ string, release string) (Channel, *http.Response, error)

ChannelApiService Add a release to a channel

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param channel channel name
  • @param namespace namespace
  • @param package_ full package name
  • @param release Release name

@return Channel

func (*ChannelApiService) DeleteChannel

func (a *ChannelApiService) DeleteChannel(ctx context.Context, namespace string, channel string, package_ string) ([]Channel, *http.Response, error)

ChannelApiService Delete channel

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param namespace namespace
  • @param channel channel name
  • @param package_ full package name

@return []Channel

func (*ChannelApiService) DeleteChannelRelease

func (a *ChannelApiService) DeleteChannelRelease(ctx context.Context, channel string, namespace string, package_ string, release string) ([]Channel, *http.Response, error)

ChannelApiService Remove a release from the channel

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param channel channel name
  • @param namespace namespace
  • @param package_ full package name
  • @param release Release name

@return []Channel

func (*ChannelApiService) ListChannels

func (a *ChannelApiService) ListChannels(ctx context.Context, namespace string, package_ string) ([]Channel, *http.Response, error)

ChannelApiService List channels

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param namespace namespace
  • @param package_ package name

@return []Channel

func (*ChannelApiService) ShowChannel

func (a *ChannelApiService) ShowChannel(ctx context.Context, channel string, namespace string, package_ string) ([]Channel, *http.Response, error)

ChannelApiService show channel

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param channel channel name
  • @param namespace namespace
  • @param package_ package name

@return []Channel

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type CreatePackageOpts

type CreatePackageOpts struct {
	Force optional.Bool
}

type Error

type Error struct {
	// http status code
	Code int32 `json:"code,omitempty"`
	// error message
	Message string `json:"message,omitempty"`
	// error extra data
	Details map[string]interface{} `json:"details,omitempty"`
}

type GenericOpenAPIError

type GenericOpenAPIError struct {
	// contains filtered or unexported fields
}

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type InfoApiService

type InfoApiService service

func (*InfoApiService) GetVersion

func (a *InfoApiService) GetVersion(ctx context.Context) (Version, *http.Response, error)

InfoApiService Display api version

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return Version

type ListPackagesOpts

type ListPackagesOpts struct {
	Namespace optional.String
	Query     optional.String
	MediaType optional.String
}

type Manifest

type Manifest struct {
	// manifest-type
	MediaType string `json:"mediaType,omitempty"`
	// creation data
	CreatedAt string `json:"created_at,omitempty"`
	// KeyValue object to add complementary and format specific information
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// package name
	Package string `json:"package,omitempty"`
	// release name
	Release string        `json:"release,omitempty"`
	Content OciDescriptor `json:"content,omitempty"`
}

type OciDescriptor

type OciDescriptor struct {
	// content digest
	Digest string `json:"digest,omitempty"`
	// blob size
	Size int64 `json:"size,omitempty"`
	// content type
	MediaType string `json:"mediaType,omitempty"`
	// download mirrors
	Urls []string `json:"urls,omitempty"`
}

OCI descriptor

type Package

type Package struct {
	// manifest-type
	MediaType string   `json:"mediaType,omitempty"`
	Channels  []string `json:"channels,omitempty"`
	// Package creation date
	CreatedAt string        `json:"created_at,omitempty"`
	Content   OciDescriptor `json:"content,omitempty"`
	// Package name
	Package string `json:"package,omitempty"`
	// Package release
	Release string `json:"release,omitempty"`
}

Package object

type PackageApiService

type PackageApiService service

func (*PackageApiService) CreatePackage

func (a *PackageApiService) CreatePackage(ctx context.Context, body PostPackage, localVarOptionals *CreatePackageOpts) (Package, *http.Response, error)

func (*PackageApiService) DeletePackage

func (a *PackageApiService) DeletePackage(ctx context.Context, namespace string, package_ string, release string, mediaType string) (Package, *http.Response, error)

PackageApiService Delete a package release

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param namespace namespace
  • @param package_ package name
  • @param release release name
  • @param mediaType content type

@return Package

func (*PackageApiService) ListPackages

func (a *PackageApiService) ListPackages(ctx context.Context, localVarOptionals *ListPackagesOpts) ([]PackageDescription, *http.Response, error)

func (*PackageApiService) PullPackage

func (a *PackageApiService) PullPackage(ctx context.Context, namespace string, package_ string, release string, mediaType string, localVarOptionals *PackagePullPackageOpts) (*os.File, *http.Response, error)

func (*PackageApiService) PullPackageJson

func (a *PackageApiService) PullPackageJson(ctx context.Context, namespace string, package_ string, release string, mediaType string, localVarOptionals *PackagePullPackageJsonOpts) (PullJson, *http.Response, error)

func (*PackageApiService) ShowPackage

func (a *PackageApiService) ShowPackage(ctx context.Context, namespace string, package_ string, release string, mediaType string) (Package, *http.Response, error)

PackageApiService Show a package

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param namespace namespace
  • @param package_ package name
  • @param release release name
  • @param mediaType content type

@return Package

func (*PackageApiService) ShowPackageManifests

func (a *PackageApiService) ShowPackageManifests(ctx context.Context, namespace string, package_ string, release string) ([]Manifest, *http.Response, error)

PackageApiService List all manifests for a package

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param namespace namespace
  • @param package_ package name
  • @param release release name

@return []Manifest

func (*PackageApiService) ShowPackageReleases

func (a *PackageApiService) ShowPackageReleases(ctx context.Context, namespace string, package_ string, localVarOptionals *ShowPackageReleasesOpts) ([]Manifest, *http.Response, error)

type PackageDescription

type PackageDescription struct {
	// default
	Default string `json:"default,omitempty"`
	// visibility
	Visibility string   `json:"visibility,omitempty"`
	Manifests  []string `json:"manifests,omitempty"`
	Channels   []string `json:"channels,omitempty"`
	// Package creation date
	CreatedAt string `json:"created_at,omitempty"`
	// Package creation date
	UpdatedAt string `json:"updated_at,omitempty"`
	// Package name
	Name string `json:"name,omitempty"`
	// namespace
	Namespace string   `json:"namespace,omitempty"`
	Releases  []string `json:"releases,omitempty"`
}

Package Item object

type PackagePullPackageJsonOpts

type PackagePullPackageJsonOpts struct {
	Format optional.String
}

type PackagePullPackageOpts

type PackagePullPackageOpts struct {
	Format optional.String
}

type PostPackage

type PostPackage struct {
	// Package blob: a tar.gz in b64-encoded
	Blob string `json:"blob,omitempty"`
	// Package name
	Package string `json:"package,omitempty"`
	// Package version
	Release string `json:"release,omitempty"`
	// mediatype of the blob
	MediaType string `json:"media_type,omitempty"`
}

Package object

type PullBlobJsonOpts

type PullBlobJsonOpts struct {
	Format optional.String
}

type PullJson

type PullJson struct {
	// Package blob: a tar.gz in b64-encoded
	Blob string `json:"blob,omitempty"`
	// Package name
	Package string `json:"package,omitempty"`
	// Package version
	Release string `json:"release,omitempty"`
	// suggested filename
	Filename string `json:"filename,omitempty"`
}

Package content

type ShowPackageReleasesOpts

type ShowPackageReleasesOpts struct {
	MediaType optional.String
}

type Version

type Version struct {
	ApprApi string `json:"appr-api,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL