cloudflare/endpoints/workers/
list_bindings.rs

1use super::WorkersBinding;
2use crate::framework::endpoint::{EndpointSpec, Method};
3use crate::framework::response::ApiSuccess;
4
5/// List Bindings
6/// Lists all bindings for a given script
7#[derive(Debug)]
8pub struct ListBindings<'a> {
9    /// account id of owner of the script
10    pub account_id: &'a str,
11    /// name of script to list bindings for
12    pub script_name: &'a str,
13}
14
15impl EndpointSpec for ListBindings<'_> {
16    type JsonResponse = Vec<WorkersBinding>;
17    type ResponseType = ApiSuccess<Self::JsonResponse>;
18
19    fn method(&self) -> Method {
20        Method::GET
21    }
22
23    fn path(&self) -> String {
24        format!(
25            "accounts/{}/workers/scripts/{}/bindings",
26            self.account_id, self.script_name
27        )
28    }
29}