client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package client provides a client for the API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIv1

type APIv1 struct {
	// Config is the configuration for the APIv1 client
	Config Config
	// HTTPSlingClient is the HTTP client for the APIv1 client
	Requester *httpsling.Requester
}

APIv1 implements the Client interface and provides methods to interact with the openlane cloud API

func (*APIv1) OrganizationCreate

func (c *APIv1) OrganizationCreate(ctx context.Context, in *models.OrganizationRequest) (out *models.OrganizationReply, err error)

OrganizationCreate creates an organizational hierarchy for a new organization based on the name, environment(s), bucket(s), and relationship(s) provided in the request

type Client

type Client interface {
	// OrganizationCreate creates an organizational hierarchy for a organization
	OrganizationCreate(context.Context, *models.OrganizationRequest) (*models.OrganizationReply, error)
}

Client is the interface that wraps the openlane cloud API REST client methods

func New

func New(config Config, opts ...ClientOption) (_ Client, err error)

New creates a new API v1 client that implements the Client interface

func NewWithDefaults

func NewWithDefaults() (Client, error)

NewWithDefaults creates a new API v1 client with default configuration

type ClientOption

type ClientOption func(c *APIv1) error

ClientOption allows us to configure the APIv1 client when it is created

func WithBaseURL

func WithBaseURL(baseURL *url.URL) ClientOption

WithBaseURL sets the base URL for the APIv1 client

type Config

type Config struct {
	// BaseURL is the base URL for the openlane API
	BaseURL *url.URL `json:"baseUrl" yaml:"baseUrl" koanf:"baseUrl" default:"http://localhost:17610"`
}

Config is the configuration for the openlane cloud API client

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig returns a new default configuration for the openlane cloud API client

type RequestError

type RequestError struct {
	// StatusCode is the http response code that was returned
	StatusCode int
	// Body of the response
	Body string
}

RequestError is a generic error when a request with the client fails

func (*RequestError) Error

func (e *RequestError) Error() string

Error returns the RequestError in string format

Jump to

Keyboard shortcuts

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