restful

package
v0.0.0-...-f4276bb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 4 Imported by: 0

README

基于RESTful接口的 SDK

client.DescribeBlog(ctx, request)
func httpGet() {
    resp, err := http.Get("http://www.01happy.com/demo/accept.php?id=1")
    if err != nil {
        // handle error
    }
 
    defer resp.Body.Close()
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        // handle error
    }
 
    fmt.Println(string(body))
}

有没有简单的http客户端, k8s restful client

err := client.POST("url").Body(bodyParam).DO(ctx).Into(obj)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlogClient

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

func (*BlogClient) CreateBlog

func (c *BlogClient) CreateBlog(ctx context.Context, in *blog.CreateBlogRequest) (*blog.Blog, error)

接口一定要保证很强一个兼容性

func (*BlogClient) DeleteBlog

func (c *BlogClient) DeleteBlog(ctx context.Context, in *blog.DeleteBlogRequest) (*blog.Blog, error)

删除文章, 返回删除的对象, 用前端提升, 用于对象最终

func (*BlogClient) DescribeBlog

func (c *BlogClient) DescribeBlog(ctx context.Context, in *blog.DescribeBlogRequest) (*blog.Blog, error)

查询单个文章

func (*BlogClient) QueryBlog

func (c *BlogClient) QueryBlog(ctx context.Context, in *blog.QueryBlogRequest) (*blog.BlogSet, error)

查询文章列表

func (*BlogClient) UpdateBlog

func (c *BlogClient) UpdateBlog(ctx context.Context, in *blog.UpdateBlogRequest) (*blog.Blog, error)

更新文章

type Client

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

address, 核心http client

func NewClient

func NewClient(token string) *Client

func (*Client) BlogClient

func (c *Client) BlogClient() blog.Service

Jump to

Keyboard shortcuts

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