Skip to content

Interhyp/metadata-service-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for openapi

Obtain and manage metadata for owners, services, repositories. Please see README for details. CLIENTS MUST READ!

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: v1
  • Package version: 1.0.0
  • Generator version: 7.13.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit http://domain.com

Installation

Install the following dependencies:

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

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

import openapi "github.com/Interhyp/metadata-service-api"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value openapi.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using openapi.ContextOperationServerIndices and openapi.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
ManagementAPI GetHealth Get /health
ManagementAPI GetHealth1 Get /management/health
RestApiV1OwnersAPI CreateOwner Post /rest/api/v1/owners/{owner} create a new owner with a given alias
RestApiV1OwnersAPI DeleteOwner Delete /rest/api/v1/owners/{owner} delete the owner with a given alias
RestApiV1OwnersAPI GetOwner Get /rest/api/v1/owners/{owner} get a single owner by alias
RestApiV1OwnersAPI GetOwners Get /rest/api/v1/owners get owners
RestApiV1OwnersAPI PatchOwner Patch /rest/api/v1/owners/{owner} patch an existing owner with a given alias
RestApiV1OwnersAPI UpdateOwner Put /rest/api/v1/owners/{owner} update an existing owner with a given alias
RestApiV1RepositoriesAPI GetRepositoriesOfOwner Get /rest/api/v1/repositories get repositories
RestApiV1RepositoriesAPI GetRepository Get /rest/api/v1/repositories/{repository} get a single repository by key
RestApiV1RepositoriesAPI PatchRepository Patch /rest/api/v1/repositories/{repository} patch an existing repository with the given key
RestApiV1RepositoriesAPI RegisterRepository Post /rest/api/v1/repositories/{repository} register a new repository with the given key
RestApiV1RepositoriesAPI RemoveRepository Delete /rest/api/v1/repositories/{repository} remove the repository with the given key
RestApiV1RepositoriesAPI UpdateRepository Put /rest/api/v1/repositories/{repository} update an existing repository with the given key
RestApiV1ServicesAPI DeleteService Delete /rest/api/v1/services/{service} delete the service with a given name
RestApiV1ServicesAPI GetService Get /rest/api/v1/services/{service} get a single service by name
RestApiV1ServicesAPI GetServicePromoters Get /rest/api/v1/services/{service}/promoters get all users who may promote a service
RestApiV1ServicesAPI GetServices Get /rest/api/v1/services get services
RestApiV1ServicesAPI PatchService Patch /rest/api/v1/services/{service} patch an existing service with the given name
RestApiV1ServicesAPI RegisterService Post /rest/api/v1/services/{service} register a new service with the given name
RestApiV1ServicesAPI UpdateService Put /rest/api/v1/services/{service} update an existing service with the given name
WebhooksAPI PostWebhook Post /webhooks/vcs/github

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

basicAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), openapi.ContextBasicAuth, openapi.BasicAuth{
	UserName: "username",
	Password: "password",
})
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

About

API spec and generated go code for the [metadata-service](https://github.com/Interhyp/metadata-service) project.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •