wuapi 0.13.1

Rust SDK for wuapi, a WhatsApp API for developers. Link numbers by QR or pairing code, send and receive messages, manage chats, contacts, groups and channels, split them into projects and verify webhooks.
Documentation
// 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)
    }
}