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
// Generated by wuapi-codegen from the OpenAPI spec. Do not edit: run `bun run codegen`.
use crate::http::{HttpClient, Method, RequestParts};
use crate::pagination::Paginator;
use crate::types;
/// The countries and cities an account's residential proxy can be placed in: the values `proxyLocation` accepts on `POST /v1/accounts`.
#[derive(Clone, Debug)]
pub struct ProxyLocationsResource {
http: HttpClient,
}
impl ProxyLocationsResource {
pub(crate) fn new(http: HttpClient) -> Self {
Self { http }
}
/// List proxy locations
///
/// The catalog of supported `{country, city}` pairs for `proxyLocation`, ordered by country name, then by city population, largest first. Filter with `country`, or search with `q`.
///
/// With `q`, results are ranked instead: an exact match first, then a prefix (`bogo` finds Bogotá), then a later word (`york` finds New York City), then text anywhere in the name; ties go to the bigger city. `q` matches the city name, the city code, the country name and the ISO code (`cl` returns Chile's cities first), ignoring case and accents (`sao` finds São Paulo). It combines with `country`, and pages like any list.
///
/// `GET /v1/proxy-locations`
///
/// Safe to repeat: retried on timeouts, network errors, `429` and `5xx`.
pub fn list(
&self,
params: types::ProxyLocationsListParams,
) -> Paginator<types::ProxyLocationItemList> {
let parts = RequestParts::new(Method::Get, "/v1/proxy-locations")
.query_opt("country", params.country.as_ref())
.query_opt("q", params.q.as_ref())
.query_opt("limit", params.limit.as_ref())
.retryable();
Paginator::new(self.http.clone(), parts, "cursor", params.cursor)
}
}