openapi_nexus/generators/go/http/
runtime.rs1use crate::codegen::traits::file_writer::FileInfo;
9
10const CLIENT_GO: &str = include_str!("runtime/client.go.txt");
11const AUTH_GO: &str = include_str!("runtime/auth.go.txt");
12const ERRORS_GO: &str = include_str!("runtime/errors.go.txt");
13
14pub fn runtime_files(header: &str) -> Vec<FileInfo> {
18 vec![
19 FileInfo::runtime("client.go".to_string(), with_header(header, CLIENT_GO)),
20 FileInfo::runtime("auth.go".to_string(), with_header(header, AUTH_GO)),
21 FileInfo::runtime("errors.go".to_string(), with_header(header, ERRORS_GO)),
22 ]
23}
24
25fn with_header(header: &str, body: &str) -> String {
26 let mut out = String::with_capacity(header.len() + body.len());
27 out.push_str(header);
28 out.push_str(body);
29 out
30}