/
explore.go
52 lines (46 loc) · 1.25 KB
/
explore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Code generated by goagen v1.4.3, DO NOT EDIT.
//
// API "feedpushr": explore Resource Client
//
// Command:
// $ goagen
// --design=github.com/ncarlier/feedpushr/v3/design
// --out=/home/nicolas/workspace/feedpushr/autogen
// --version=v1.4.3
package client
import (
"context"
"fmt"
"net/http"
"net/url"
)
// GetExplorePath computes a request path to the get action of explore.
func GetExplorePath() string {
return fmt.Sprintf("/v2/explore")
}
// Search RSS feed using external search engine
func (c *Client) GetExplore(ctx context.Context, path string, q *string) (*http.Response, error) {
req, err := c.NewGetExploreRequest(ctx, path, q)
if err != nil {
return nil, err
}
return c.Client.Do(ctx, req)
}
// NewGetExploreRequest create the request corresponding to the get action endpoint of the explore resource.
func (c *Client) NewGetExploreRequest(ctx context.Context, path string, q *string) (*http.Request, error) {
scheme := c.Scheme
if scheme == "" {
scheme = "http"
}
u := url.URL{Host: c.Host, Scheme: scheme, Path: path}
values := u.Query()
if q != nil {
values.Set("q", *q)
}
u.RawQuery = values.Encode()
req, err := http.NewRequestWithContext(ctx, "GET", u.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}