refactor: improve RunPod client
- Refactor RunPod client to use generics for requests and responses. - This improves code readability and maintainability. - Remove redundant code for building GraphQL queries and handling HTTP requests. - Add support for environment variables in pod creation. - Update example with new API key and environment variables. Co-authored-by: supermario <mariobassem12@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@ pub fn (mut h HTTPConnection) get_json_generic[T](req Request) !T {
|
||||
|
||||
pub fn (mut h HTTPConnection) post_json_generic[T](req Request) !T {
|
||||
data := h.post_json_str(req)!
|
||||
println('data: ${data}')
|
||||
return json.decode(T, data) or { return error("couldn't decode json for ${req} for ${data}") }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user