MCPcopy Index your code
hub / github.com/endbasic/endbasic / new

Method new

client/src/cloud.rs:99–120  ·  view source on GitHub ↗

Creates a new client for the cloud service that talks to `api_address`.

(api_address: &str)

Source from the content-addressed store, hash-verified

97impl CloudService {
98 /// Creates a new client for the cloud service that talks to `api_address`.
99 pub fn new(api_address: &str) -> io::Result<Self> {
100 let url = match Url::parse(api_address) {
101 Ok(url) => url,
102 Err(e) => {
103 return Err(io::Error::new(
104 io::ErrorKind::InvalidInput,
105 format!("Invalid base API address: {}", e),
106 ));
107 }
108 };
109
110 if !(url.path().is_empty() || url.path() == "/") {
111 return Err(io::Error::new(
112 io::ErrorKind::InvalidInput,
113 "Invalid base API address: cannot contain a path".to_owned(),
114 ));
115 }
116
117 let auth_data = Rc::from(RefCell::from(None));
118
119 Ok(Self { api_address: url, client: reqwest::Client::default(), auth_data })
120 }
121
122 /// Generates a service URL with the given `path`.
123 fn make_url(&self, path: &str) -> Url {

Callers

nothing calls this directly

Calls 2

parseFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected