Skip to content

client-api/semaphore-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for semaphore

Semaphore API provides endpoints for managing and interacting with the Semaphore UI. This documentation outlines the available operations and data models.

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: 2.13.0
  • Package version: 1.0.0
  • Build date: 2025-04-24T10:51:17.217649800+02:00[Europe/Budapest]
  • Generator version: 7.12.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/net/context

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

import semaphore "github.com/client-api/semaphore-go"

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 semaphore.ContextServerIndex of type int.

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

Templated Server URL

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

ctx := context.WithValue(context.Background(), semaphore.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 semaphore.ContextOperationServerIndices and semaphore.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to http://localhost:3000/api

Class Method HTTP request Description
AuthenticationAPI AuthLoginGet Get /auth/login Fetches login metadata
AuthenticationAPI AuthLoginPost Post /auth/login Performs Login
AuthenticationAPI AuthLogoutPost Post /auth/logout Destroys current session
AuthenticationAPI AuthOidcProviderIdLoginGet Get /auth/oidc/{provider_id}/login Begin OIDC authentication flow and redirect to OIDC provider
AuthenticationAPI AuthOidcProviderIdRedirectGet Get /auth/oidc/{provider_id}/redirect Finish OIDC authentication flow, upon succes you will be logged in
AuthenticationAPI UserTokensApiTokenIdDelete Delete /user/tokens/{api_token_id} Expires API token
AuthenticationAPI UserTokensGet Get /user/tokens Fetch API tokens for user
AuthenticationAPI UserTokensPost Post /user/tokens Create an API token
DefaultAPI EventsGet Get /events Get Events related to Semaphore and projects you are part of
DefaultAPI EventsLastGet Get /events/last Get last 200 Events related to Semaphore and projects you are part of
DefaultAPI InfoGet Get /info Fetches information about semaphore
DefaultAPI PingGet Get /ping PING test
DefaultAPI WsGet Get /ws Websocket handler
IntegrationAPI ProjectProjectIdIntegrationsIntegrationIdMatchersGet Get /project/{project_id}/integrations/{integration_id}/matchers Get Integration Matcher linked to integration extractor
IntegrationAPI ProjectProjectIdIntegrationsIntegrationIdMatchersMatcherIdDelete Delete /project/{project_id}/integrations/{integration_id}/matchers/{matcher_id} Removes integration matcher
IntegrationAPI ProjectProjectIdIntegrationsIntegrationIdMatchersMatcherIdPut Put /project/{project_id}/integrations/{integration_id}/matchers/{matcher_id} Updates Integration Matcher
IntegrationAPI ProjectProjectIdIntegrationsIntegrationIdValuesExtractvalueIdDelete Delete /project/{project_id}/integrations/{integration_id}/values/{extractvalue_id} Removes integration extract value
IntegrationAPI ProjectProjectIdIntegrationsIntegrationIdValuesExtractvalueIdPut Put /project/{project_id}/integrations/{integration_id}/values/{extractvalue_id} Updates Integration ExtractValue
IntegrationAPI ProjectProjectIdIntegrationsIntegrationIdValuesGet Get /project/{project_id}/integrations/{integration_id}/values Get Integration Extracted Values linked to integration extractor
ProjectAPI ProjectProjectIdBackupGet Get /project/{project_id}/backup Backup A Project
ProjectAPI ProjectProjectIdDelete Delete /project/{project_id}/ Delete project
ProjectAPI ProjectProjectIdEnvironmentEnvironmentIdDelete Delete /project/{project_id}/environment/{environment_id} Removes environment
ProjectAPI ProjectProjectIdEnvironmentEnvironmentIdGet Get /project/{project_id}/environment/{environment_id} Get environment
ProjectAPI ProjectProjectIdEnvironmentEnvironmentIdPut Put /project/{project_id}/environment/{environment_id} Update environment
ProjectAPI ProjectProjectIdEnvironmentGet Get /project/{project_id}/environment Get environment
ProjectAPI ProjectProjectIdEnvironmentPost Post /project/{project_id}/environment Add environment
ProjectAPI ProjectProjectIdEventsGet Get /project/{project_id}/events Get Events related to this project
ProjectAPI ProjectProjectIdGet Get /project/{project_id}/ Fetch project
ProjectAPI ProjectProjectIdIntegrationsGet Get /project/{project_id}/integrations get all integrations
ProjectAPI ProjectProjectIdIntegrationsIntegrationIdDelete Delete /project/{project_id}/integrations/{integration_id} Remove integration
ProjectAPI ProjectProjectIdIntegrationsIntegrationIdMatchersPost Post /project/{project_id}/integrations/{integration_id}/matchers Add Integration Matcher
ProjectAPI ProjectProjectIdIntegrationsIntegrationIdPut Put /project/{project_id}/integrations/{integration_id} Update Integration
ProjectAPI ProjectProjectIdIntegrationsIntegrationIdValuesPost Post /project/{project_id}/integrations/{integration_id}/values Add Integration Extracted Value
ProjectAPI ProjectProjectIdIntegrationsPost Post /project/{project_id}/integrations create a new integration
ProjectAPI ProjectProjectIdInventoryGet Get /project/{project_id}/inventory Get inventory
ProjectAPI ProjectProjectIdInventoryInventoryIdDelete Delete /project/{project_id}/inventory/{inventory_id} Removes inventory
ProjectAPI ProjectProjectIdInventoryInventoryIdGet Get /project/{project_id}/inventory/{inventory_id} Get inventory
ProjectAPI ProjectProjectIdInventoryInventoryIdPut Put /project/{project_id}/inventory/{inventory_id} Updates inventory
ProjectAPI ProjectProjectIdInventoryPost Post /project/{project_id}/inventory create inventory
ProjectAPI ProjectProjectIdKeysGet Get /project/{project_id}/keys Get access keys linked to project
ProjectAPI ProjectProjectIdKeysKeyIdDelete Delete /project/{project_id}/keys/{key_id} Removes access key
ProjectAPI ProjectProjectIdKeysKeyIdPut Put /project/{project_id}/keys/{key_id} Updates access key
ProjectAPI ProjectProjectIdKeysPost Post /project/{project_id}/keys Add access key
ProjectAPI ProjectProjectIdPut Put /project/{project_id}/ Update project
ProjectAPI ProjectProjectIdRepositoriesGet Get /project/{project_id}/repositories Get repositories
ProjectAPI ProjectProjectIdRepositoriesPost Post /project/{project_id}/repositories Add repository
ProjectAPI ProjectProjectIdRepositoriesRepositoryIdDelete Delete /project/{project_id}/repositories/{repository_id} Removes repository
ProjectAPI ProjectProjectIdRepositoriesRepositoryIdGet Get /project/{project_id}/repositories/{repository_id} Get repository
ProjectAPI ProjectProjectIdRepositoriesRepositoryIdPut Put /project/{project_id}/repositories/{repository_id} Updates repository
ProjectAPI ProjectProjectIdRoleGet Get /project/{project_id}/role Fetch permissions of the current user for project
ProjectAPI ProjectProjectIdTasksGet Get /project/{project_id}/tasks Get Tasks related to current project
ProjectAPI ProjectProjectIdTasksLastGet Get /project/{project_id}/tasks/last Get last 200 Tasks related to current project
ProjectAPI ProjectProjectIdTasksPost Post /project/{project_id}/tasks Starts a job
ProjectAPI ProjectProjectIdTasksTaskIdDelete Delete /project/{project_id}/tasks/{task_id} Deletes task (including output)
ProjectAPI ProjectProjectIdTasksTaskIdGet Get /project/{project_id}/tasks/{task_id} Get a single task
ProjectAPI ProjectProjectIdTasksTaskIdOutputGet Get /project/{project_id}/tasks/{task_id}/output Get task output
ProjectAPI ProjectProjectIdTasksTaskIdStopPost Post /project/{project_id}/tasks/{task_id}/stop Stop a job
ProjectAPI ProjectProjectIdTemplatesGet Get /project/{project_id}/templates Get template
ProjectAPI ProjectProjectIdTemplatesPost Post /project/{project_id}/templates create template
ProjectAPI ProjectProjectIdTemplatesTemplateIdDelete Delete /project/{project_id}/templates/{template_id} Removes template
ProjectAPI ProjectProjectIdTemplatesTemplateIdGet Get /project/{project_id}/templates/{template_id} Get template
ProjectAPI ProjectProjectIdTemplatesTemplateIdPut Put /project/{project_id}/templates/{template_id} Updates template
ProjectAPI ProjectProjectIdUsersGet Get /project/{project_id}/users Get users linked to project
ProjectAPI ProjectProjectIdUsersPost Post /project/{project_id}/users Link user to project
ProjectAPI ProjectProjectIdUsersUserIdDelete Delete /project/{project_id}/users/{user_id} Removes user from project
ProjectAPI ProjectProjectIdUsersUserIdPut Put /project/{project_id}/users/{user_id} Update user role
ProjectAPI ProjectProjectIdViewsGet Get /project/{project_id}/views Get view
ProjectAPI ProjectProjectIdViewsPost Post /project/{project_id}/views create view
ProjectAPI ProjectProjectIdViewsViewIdDelete Delete /project/{project_id}/views/{view_id} Removes view
ProjectAPI ProjectProjectIdViewsViewIdGet Get /project/{project_id}/views/{view_id} Get view
ProjectAPI ProjectProjectIdViewsViewIdPut Put /project/{project_id}/views/{view_id} Updates view
ProjectsAPI ProjectsGet Get /projects Get projects
ProjectsAPI ProjectsPost Post /projects Create a new project
ProjectsAPI ProjectsRestorePost Post /projects/restore Restore Project
ScheduleAPI ProjectProjectIdSchedulesPost Post /project/{project_id}/schedules create schedule
ScheduleAPI ProjectProjectIdSchedulesScheduleIdDelete Delete /project/{project_id}/schedules/{schedule_id} Deletes schedule
ScheduleAPI ProjectProjectIdSchedulesScheduleIdGet Get /project/{project_id}/schedules/{schedule_id} Get schedule
ScheduleAPI ProjectProjectIdSchedulesScheduleIdPut Put /project/{project_id}/schedules/{schedule_id} Updates schedule
UserAPI UserGet Get /user/ Fetch logged in user
UserAPI UserTokensApiTokenIdDelete Delete /user/tokens/{api_token_id} Expires API token
UserAPI UserTokensGet Get /user/tokens Fetch API tokens for user
UserAPI UserTokensPost Post /user/tokens Create an API token
UserAPI UsersGet Get /users Fetches all users
UserAPI UsersPost Post /users Creates a user
UserAPI UsersUserIdDelete Delete /users/{user_id}/ Deletes user
UserAPI UsersUserIdGet Get /users/{user_id}/ Fetches a user profile
UserAPI UsersUserIdPasswordPost Post /users/{user_id}/password Updates user password
UserAPI UsersUserIdPut Put /users/{user_id}/ Updates user details

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

cookie

  • Type: API key
  • API key parameter name: Cookie
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: cookie and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		semaphore.ContextAPIKeys,
		map[string]semaphore.APIKey{
			"cookie": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: bearer and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		semaphore.ContextAPIKeys,
		map[string]semaphore.APIKey{
			"bearer": {Key: "API_KEY_STRING"},
		},
	)
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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published