1package api
2
3import (
4	"context"
5	"fmt"
6)
7
8// Help reads the help information for the given path.
9func (c *Client) Help(path string) (*Help, error) {
10	r := c.NewRequest("GET", fmt.Sprintf("/v1/%s", path))
11	r.Params.Add("help", "1")
12
13	ctx, cancelFunc := context.WithCancel(context.Background())
14	defer cancelFunc()
15	resp, err := c.RawRequestWithContext(ctx, r)
16	if err != nil {
17		return nil, err
18	}
19	defer resp.Body.Close()
20
21	var result Help
22	err = resp.DecodeJSON(&result)
23	return &result, err
24}
25
26type Help struct {
27	Help    string                 `json:"help"`
28	SeeAlso []string               `json:"see_also"`
29	OpenAPI map[string]interface{} `json:"openapi"`
30}
31