Create creates a new Crawler. It returns the Crawler ID if successful.
(name string, config Config)
| 146 | // Create creates a new Crawler. |
| 147 | // It returns the Crawler ID if successful. |
| 148 | func (c *Client) Create(name string, config Config) (string, error) { |
| 149 | var res struct { |
| 150 | ID string `json:"id"` |
| 151 | } |
| 152 | path := "crawlers" |
| 153 | |
| 154 | crawler := &Crawler{ |
| 155 | Name: name, |
| 156 | Config: &config, |
| 157 | } |
| 158 | |
| 159 | err := c.request(&res, http.MethodPost, path, crawler, nil) |
| 160 | if err != nil { |
| 161 | return "", err |
| 162 | } |
| 163 | |
| 164 | return res.ID, nil |
| 165 | } |
| 166 | |
| 167 | // List lists Crawlers. |
| 168 | func (c *Client) List(itemsPerPage, page int, name, appID string) (*CrawlersResponse, error) { |
no test coverage detected