nexus

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

README

go-nexus

基于 go 语言的 nexus SDK

License-Anti Link-996 QQ群

基于 go 语言的 nexus SDK

为简化开发工作、提高生产率、解决常见问题而生

更新文档

使用方式

  1. 具体示例请查看对应的测试方法

开发命令

get

go env -w GOPROXY=https://goproxy.cn,direct
# go env -w GOPROXY=https://mirrors.aliyun.com/goproxy,direct
go get -u github.com/google/go-querystring
go get -u github.com/hashicorp/go-cleanhttp
go get -u github.com/hashicorp/go-retryablehttp
go get -u github.com/stretchr/testify

mod

go mod tidy
go mod download

test

go test ./... -v

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

Types

type Client

type Client struct {
	UserAgent string

	Swagger *SwaggerService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string, username string, password string) (*Client, error)

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

func (*Client) Do

func (c *Client) Do(req *retryablehttp.Request, v interface{}) (*Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method string, path string, requestQuery interface{}, requestBody interface{}) (*retryablehttp.Request, error)

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(urlStr string) error

func (*Client) UploadRequest

func (c *Client) UploadRequest(method, path string, content io.Reader, filename string) (*retryablehttp.Request, error)

type ErrorResponse

type ErrorResponse struct {
	Body     []byte
	Response *http.Response
	Message  string
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type Info

type Info struct {
	Version string `json:"version,omitempty"`
	Title   string `json:"title,omitempty"`
}

type ListOptions

type ListOptions struct {
	Page  int `url:"page,omitempty" json:"page,omitempty"`   // 当前的页码
	Limit int `url:"limit,omitempty" json:"limit,omitempty"` // 每页的数量
}

type Response

type Response struct {
	*http.Response
}

type Swagger

type Swagger struct {
	Swagger  string `json:"swagger,omitempty"`
	Info     Info   `json:"info,omitempty"`
	BasePath string `json:"basePath,omitempty"`
}

type SwaggerService

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

func (*SwaggerService) GetSwagger

func (s *SwaggerService) GetSwagger() (*Swagger, *Response, error)

GetSwagger 获取 Swagger 配置 接口不需要凭证

Jump to

Keyboard shortcuts

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