api

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package api holds the business-logic layer for the generic, curl-like passthrough to the Bitrise API exposed by the `api` command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

KeyValue is one --field key=value pair.

type Request

type Request struct {
	Method   string
	Path     string
	Fields   []KeyValue
	Headers  http.Header
	Body     io.Reader
	Paginate bool
}

Request describes one `api` command invocation.

type Response

type Response struct {
	StatusCode int
	Header     http.Header
	Body       []byte
}

Response is the result of a Request, ready for the cmd layer to print.

type Service

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

Service exposes the raw API passthrough to the cmd layer.

func NewService

func NewService(client *bitriseapi.Client) *Service

NewService returns a Service backed by the given API client.

func (*Service) Do

func (s *Service) Do(ctx context.Context, req Request) (Response, error)

Do executes req. Fields become a query string for GET requests, or a JSON body for anything else. Every non-GET body — whether built from Fields or passed through from --input — gets a JSON Content-Type unless the caller set one, since the API won't parse a body sent without it. When Paginate is set, the request must be a GET; pages are followed via the "paging.next" cursor and their "data" arrays merged into one response.

Jump to

Keyboard shortcuts

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