client

package
v1.0.0-beta.13 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTimeout = time.Duration(20000) * time.Millisecond
	Logger         = logger.HcLog().Named("supabase.client")
)

Functions

func Delete

func Delete[T any](url string, rawBody []byte, timeout time.Duration, reqInterceptor RequestInterceptor, resInterceptor ResponseInterceptor) (res T, err error)

func Get

func Get[T any](url string, timeout time.Duration, reqInterceptor RequestInterceptor, resInterceptor ResponseInterceptor) (res T, err error)

func Patch

func Patch[T any](url string, rawBody []byte, timeout time.Duration, reqInterceptor RequestInterceptor, resInterceptor ResponseInterceptor) (res T, err error)

func Post

func Post[T any](url string, rawBody []byte, timeout time.Duration, reqInterceptor RequestInterceptor, resInterceptor ResponseInterceptor) (res T, err error)

func Put

func Put[T any](url string, rawBody []byte, timeout time.Duration, reqInterceptor RequestInterceptor, resInterceptor ResponseInterceptor) (res T, err error)

func SendRequest

func SendRequest(method string, url string, body []byte, timeout time.Duration, reqInterceptor RequestInterceptor, resInterceptor ResponseInterceptor) (rawBody []byte, err error)

func SetClient

func SetClient(c Client)

Types

type Client

type Client interface {
	Do(*fasthttp.Request, *fasthttp.Response) error
	DoTimeout(*fasthttp.Request, *fasthttp.Response, time.Duration) error
}

type DefaultResponse

type DefaultResponse struct {
	Message string `json:"message"`
}

type ReqError

type ReqError struct {
	Message string
	Body    []byte
}

func (ReqError) Error

func (s ReqError) Error() string

type RequestInterceptor

type RequestInterceptor func(req *fasthttp.Request) error

type ResponseInterceptor

type ResponseInterceptor func(resp *fasthttp.Response) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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