| 208 | } |
| 209 | |
| 210 | func (c *httpLockClient) Search(remote string, searchReq *lockSearchRequest) (*lockList, int, error) { |
| 211 | e := c.Endpoints.Endpoint("download", remote) |
| 212 | req, err := c.NewRequest("GET", e, "locks", nil) |
| 213 | if err != nil { |
| 214 | return nil, 0, err |
| 215 | } |
| 216 | |
| 217 | q := req.URL.Query() |
| 218 | for key, value := range searchReq.QueryValues() { |
| 219 | q.Add(key, value) |
| 220 | } |
| 221 | req.URL.RawQuery = q.Encode() |
| 222 | |
| 223 | req = c.Client.LogRequest(req, "lfs.locks.search") |
| 224 | res, err := c.DoAPIRequestWithAuth(remote, req) |
| 225 | if err != nil { |
| 226 | if res != nil { |
| 227 | return nil, res.StatusCode, err |
| 228 | } |
| 229 | return nil, 0, err |
| 230 | } |
| 231 | |
| 232 | locks := &lockList{} |
| 233 | if res.StatusCode == http.StatusOK { |
| 234 | err = lfshttp.DecodeJSON(res, locks) |
| 235 | } |
| 236 | |
| 237 | return locks, res.StatusCode, err |
| 238 | } |
| 239 | |
| 240 | // lockVerifiableRequest encapsulates the request sent to the server when the |
| 241 | // client would like a list of locks to verify a Git push. |