data_service

package
v1.1.59-test Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// RatelimitBypassHeader carries the token that exempts a request from
	// data-service rate limiting.
	RatelimitBypassHeader = "x-ratelimit-bypass"
)

Variables

This section is empty.

Functions

func GetLastLinkPart added in v1.1.9

func GetLastLinkPart(link string) string

func GetLinkByRel

func GetLinkByRel(rel string, links []base.Link) string

func GetLinkMap

func GetLinkMap(links []base.Link) map[string]string

func GetLinkedObjectName

func GetLinkedObjectName(rel string, links []base.Link) string

Types

type DataServiceClient

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

func NewClient

func NewClient(url string, token string, serviceName string) *DataServiceClient

func NewCustomClient

func NewCustomClient(url string, token string, serviceName string, httpClient *http.Client) *DataServiceClient

func (*DataServiceClient) DelHeader

func (c *DataServiceClient) DelHeader(key string)

func (*DataServiceClient) Delete

func (c *DataServiceClient) Delete(resource string) (*http.Response, error)

func (*DataServiceClient) DeleteWithContext

func (c *DataServiceClient) DeleteWithContext(ctx context.Context, resource string) (*http.Response, error)

DeleteWithContext performs a DELETE request with context support.

func (*DataServiceClient) Do

func (c *DataServiceClient) Do(request *http.Request, responseBodyOut any) (*http.Response, error)

func (*DataServiceClient) Get

func (c *DataServiceClient) Get(resource string, responseBodyOut any) (*http.Response, error)

func (*DataServiceClient) GetHeader

func (c *DataServiceClient) GetHeader(key string) string

func (*DataServiceClient) GetWithContext

func (c *DataServiceClient) GetWithContext(ctx context.Context, resource string, responseBodyOut any) (*http.Response, error)

GetWithContext performs a GET request with context support.

func (*DataServiceClient) Options

func (c *DataServiceClient) Options(resource string) (*http.Response, error)

func (*DataServiceClient) Patch

func (c *DataServiceClient) Patch(resource string, requestBody string, responseBodyOut any) (*http.Response, error)

func (*DataServiceClient) PatchJSONWithContext

func (c *DataServiceClient) PatchJSONWithContext(ctx context.Context, resource string, body any, responseBodyOut any) (*http.Response, error)

PatchJSONWithContext marshals body to JSON and performs PATCH with context.

func (*DataServiceClient) PatchWithContext

func (c *DataServiceClient) PatchWithContext(ctx context.Context, resource string, requestBody string, responseBodyOut any) (*http.Response, error)

PatchWithContext performs a PATCH request with context support.

func (*DataServiceClient) Post

func (c *DataServiceClient) Post(resource string, requestBody string, responseBodyOut any) (*http.Response, error)

func (*DataServiceClient) PostJSONWithContext

func (c *DataServiceClient) PostJSONWithContext(ctx context.Context, resource string, body any, responseBodyOut any) (*http.Response, error)

PostJSONWithContext marshals body to JSON and performs POST with context.

func (*DataServiceClient) PostWithContext

func (c *DataServiceClient) PostWithContext(ctx context.Context, resource string, requestBody string, responseBodyOut any) (*http.Response, error)

PostWithContext performs a POST request with context support.

func (*DataServiceClient) Put

func (c *DataServiceClient) Put(resource string, requestBody string, responseBodyOut any) (*http.Response, error)

func (*DataServiceClient) PutJSONWithContext

func (c *DataServiceClient) PutJSONWithContext(ctx context.Context, resource string, body any, responseBodyOut any) (*http.Response, error)

PutJSONWithContext marshals body to JSON and performs PUT with context.

func (*DataServiceClient) PutWithContext

func (c *DataServiceClient) PutWithContext(ctx context.Context, resource string, requestBody string, responseBodyOut any) (*http.Response, error)

PutWithContext performs a PUT request with context support.

func (*DataServiceClient) Request

func (c *DataServiceClient) Request(method string, resource string, requestBody string) (*http.Request, error)

func (*DataServiceClient) RequestWithContext

func (c *DataServiceClient) RequestWithContext(ctx context.Context, method string, resource string, requestBody string) (*http.Request, error)

RequestWithContext creates a request with context support.

func (*DataServiceClient) SetHeader

func (c *DataServiceClient) SetHeader(key string, value string)

func (*DataServiceClient) SetRatelimitBypass added in v1.1.23

func (c *DataServiceClient) SetRatelimitBypass(token string)

SetRatelimitBypass presents the bypass token so this client's calls skip data-service rate limiting. An empty token is a no-op.

func (*DataServiceClient) SetToken

func (c *DataServiceClient) SetToken(token string)

type ListIterator

type ListIterator[T any] struct {
	// contains filtered or unexported fields
}

func NewListIterator

func NewListIterator[T any](client *DataServiceClient, url string) *ListIterator[T]

func (*ListIterator[T]) Error

func (i *ListIterator[T]) Error() error

func (*ListIterator[T]) Item

func (i *ListIterator[T]) Item() T

func (*ListIterator[T]) List

func (i *ListIterator[T]) List() ([]T, error)

func (*ListIterator[T]) Next

func (i *ListIterator[T]) Next() bool

func (*ListIterator[T]) VisitAll

func (i *ListIterator[T]) VisitAll(handler func(t T) error) ([]T, error)

Jump to

Keyboard shortcuts

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