Skip to content

Commit

Permalink
refactor client.{get|post}
Browse files Browse the repository at this point in the history
  • Loading branch information
dmmulroy committed Mar 22, 2024
1 parent faba6b2 commit 56911ac
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions src/glitch/api/client.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,18 @@ pub fn get(
client: Client,
request: TwitchApiRequest,
) -> Result(Response(String), TwitchApiError(error)) {
todo
// let headers =
// client
// |> headers
// |> merge_headers(request.headers)
//
// request
// |> request.set_method(Get)
// |> request_ext.set_headers(headers)
// |> api_request.from_request
// |> httpc.send
// |> result.map_error(RequestError)
request
|> api_request.set_headers(headers(client))
|> api_request.set_method(Get)
|> api_request.send
}

pub fn post(
client: Client,
request: Request(String),
request: TwitchApiRequest,
) -> Result(Response(String), TwitchApiError(error)) {
// let headers =
// client
// |> headers
// |> merge_headers(request.headers)
//
// request
// |> request.set_method(Post)
// |> request_ext.set_headers(headers)
// |> api_request.from_request
// |> function.tap(fn(req) {
// io.debug(
// request.to_uri(req)
// |> uri.to_string,
// )
// })
// |> httpc.send
// |> result.map_error(RequestError)
todo
request
|> api_request.set_headers(headers(client))
|> api_request.set_method(Post)
|> api_request.send
}

0 comments on commit 56911ac

Please sign in to comment.