helpers

package
v0.0.0-...-e284d0c Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package helpers provides a simple API client for making HTTP requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

func HandleControllerApi

func HandleControllerApi(result bool, statusCode string, message string, controllerFunction string, data interface{}, err error) ([]byte, error)

func HandleControllerGeneric

func HandleControllerGeneric(message string, controllerFunction string, data interface{}, err error) ([]byte, error)

It has used to manage the response of the controller function if response return values instead of an api response

func LoadConfig

func LoadConfig()

func ReplaceInFile

func ReplaceInFile(filePath, oldValue, newValue string) error

func ReturnCompleteDockerRepoPath

func ReturnCompleteDockerRepoPath(repoUrl string, dockerRepo string) string

func UpdateImageTagWithRegex

func UpdateImageTagWithRegex(filePath, newTag string) error

Types

type ApiClient

type ApiClient struct {
	BaseURL    string
	AuthType   string // "Bearer", "Basic", or "None"
	AuthToken  string
	HTTPClient *http.Client
}

APIClient handles HTTP requests with support for different authentication methods.

func NewApiClient

func NewApiClient(baseURL, authToken, authType string, timeout ...int) *ApiClient

NewApiClient creates a new API client with default settings. Accepts an optional timeout parameter; defaults to 60 seconds if not provided.

func (*ApiClient) Request

func (client *ApiClient) Request(method string, endpoint string, body interface{}) models.ApiResponse

request makes an HTTP request with the specified method, endpoint, and body.

type Config

type Config struct {
	SINALOA_DEBUG       bool
	ARGOCD_URL          string
	ARGOCD_USER         string
	ARGOCD_PASSWORD     string
	AZURE_TENANT_ID     string
	AZURE_CLIENT_ID     string
	AZURE_CLIENT_SECRET string
	AZURE_DRIVE_ID      string
	DOCKER_HUB_USER_RWD string
	DOCKER_HUB_PWD_RWD  string
	GITHUB_TOKEN        string
}
var (
	AppConfig Config
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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