Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,188 changes: 1,706 additions & 482 deletions ConsumePlugin/Generated2SwaggerGitea.fs

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions ConsumePlugin/GeneratedRestClient.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2246,6 +2246,119 @@ open System.Net
open System.Net.Http
open RestEase

/// Module for constructing a REST client.
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix) ; RequireQualifiedAccess>]
module ApiWithOptionalQuery =
/// Create a REST client.
let make (client : System.Net.Http.HttpClient) : IApiWithOptionalQuery =
{ new IApiWithOptionalQuery with
member _.GetWithMixedQuery
(page : int option, limit : int, search : string option, ct : CancellationToken option)
=
async {
let! ct = Async.CancellationToken

let queryString =
[
page
|> Option.map (fun queryParam ->
"page=" + ((queryParam.ToString ()) |> System.Uri.EscapeDataString)
)
|> Option.toList

[ "limit=" + ((limit.ToString ()) |> System.Uri.EscapeDataString) ]
search
|> Option.map (fun queryParam ->
"search=" + ((queryParam.ToString ()) |> System.Uri.EscapeDataString)
)
|> Option.toList
]
|> List.concat
|> String.concat "&"

let uri =
System.Uri (
(match client.BaseAddress with
| null -> System.Uri "https://whatnot.com/"
| v -> v),
System.Uri (
("endpoint"
+ (if queryString = "" then
""
else
((if "endpoint".IndexOf (char 63) >= 0 then "&" else "?") + queryString))),
System.UriKind.Relative
)
)

use httpMessage =
new System.Net.Http.HttpRequestMessage (
Method = System.Net.Http.HttpMethod.Get,
RequestUri = uri
)

let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
let response = response.EnsureSuccessStatusCode ()
use response = response
let! responseString = response.Content.ReadAsStringAsync ct |> Async.AwaitTask
return responseString
}
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))

member _.GetWithAllOptionalQuery (since : DateOnly option, ct : CancellationToken option) =
async {
let! ct = Async.CancellationToken

let queryString =
[
since
|> Option.map (fun queryParam ->
"since=" + ((queryParam.ToString "yyyy-MM-dd") |> System.Uri.EscapeDataString)
)
|> Option.toList
]
|> List.concat
|> String.concat "&"

let uri =
System.Uri (
(match client.BaseAddress with
| null -> System.Uri "https://whatnot.com/"
| v -> v),
System.Uri (
("endpoint"
+ (if queryString = "" then
""
else
((if "endpoint".IndexOf (char 63) >= 0 then "&" else "?") + queryString))),
System.UriKind.Relative
)
)

use httpMessage =
new System.Net.Http.HttpRequestMessage (
Method = System.Net.Http.HttpMethod.Get,
RequestUri = uri
)

let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
let response = response.EnsureSuccessStatusCode ()
use response = response
let! responseString = response.Content.ReadAsStringAsync ct |> Async.AwaitTask
return responseString
}
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
}
namespace PureGym

open System
open System.Threading
open System.Threading.Tasks
open System.IO
open System.Net
open System.Net.Http
open RestEase

/// Module for constructing a REST client.
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix) ; RequireQualifiedAccess>]
module ClientWithStringBody =
Expand Down
Loading
Loading