diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 0169e6f..9538e8e 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -20,7 +20,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Install dependencies run: dotnet restore - name: Build diff --git a/src/Funogram.Generator/Funogram.Generator.fsproj b/src/Funogram.Generator/Funogram.Generator.fsproj index 99245df..69dfc57 100644 --- a/src/Funogram.Generator/Funogram.Generator.fsproj +++ b/src/Funogram.Generator/Funogram.Generator.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/src/Funogram.Telegram/Directory.Build.props b/src/Funogram.Telegram/Directory.Build.props index 46ea3d0..67083d4 100644 --- a/src/Funogram.Telegram/Directory.Build.props +++ b/src/Funogram.Telegram/Directory.Build.props @@ -1,6 +1,6 @@ - 6.9.0.0 + 6.9.0.1 Nikolay Matyushin Funogram.Telegram Funogram.Telegram diff --git a/src/Funogram.Tests/Funogram.Tests.fsproj b/src/Funogram.Tests/Funogram.Tests.fsproj index fc70128..77dee13 100644 --- a/src/Funogram.Tests/Funogram.Tests.fsproj +++ b/src/Funogram.Tests/Funogram.Tests.fsproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 false diff --git a/src/Funogram.Tests/Json.fs b/src/Funogram.Tests/Json.fs index dbf7f46..98ae223 100644 --- a/src/Funogram.Tests/Json.fs +++ b/src/Funogram.Tests/Json.fs @@ -13,6 +13,14 @@ let ``JSON deserializing MessageEntity`` () = | Ok r -> shouldEqual r Constants.jsonTestObj | Error e -> failwith e.Description +[] +let ``JSON deserializing MessageEntity as Object`` () = + let a = parseJson(Constants.jsonTestObjResultString) + + match a with + | Ok r -> shouldEqual true (r <> null) + | Error e -> failwith e.Description + [] let ``JSON serializing MessageEntity``() = Constants.jsonTestObj @@ -68,7 +76,6 @@ let ``JSON deserializing MaskPosition`` () = |> function | Ok result -> shouldEqual result Constants.testMaskPosition | Error error -> failwith error.Description - [] let ``JSON serializing MaskPosition`` () = @@ -89,7 +96,7 @@ let ``JSON deserializing ForwardMessage`` () = |> function | Ok result -> shouldEqual result Constants.jsonMessageForward | Error error -> failwith error.Description - + [] let ``JSON serializing params dictionary`` () = Constants.paramsDictionary @@ -101,7 +108,7 @@ let ``JSON serializing forward message request`` () = Constants.forwardMessageReq |> toJsonBotRequestString |> shouldEqual Constants.jsonForwardMessageReq - + [] let ``JSON deserializing ChatMember``() = Constants.jsonTestObjChatMemberResultString diff --git a/src/Funogram/Api.fs b/src/Funogram/Api.fs index a8be817..1cdddfa 100644 --- a/src/Funogram/Api.fs +++ b/src/Funogram/Api.fs @@ -4,4 +4,7 @@ module Funogram.Api open Funogram.Tools let api config (request: IRequestBase<'a>) = - Api.makeRequestAsync config request \ No newline at end of file + Api.makeRequestAsync<'a> config request + + let apiRaw config (request: IBotRequest) = + Api.makeRequestAsync config request \ No newline at end of file diff --git a/src/Funogram/Funogram.fsproj b/src/Funogram/Funogram.fsproj index 96339c9..d72f2b4 100644 --- a/src/Funogram/Funogram.fsproj +++ b/src/Funogram/Funogram.fsproj @@ -1,9 +1,9 @@  - netstandard2.0 + netstandard2.0 - 2.0.8 + 2.0.9 Nikolay Matyushin Funogram Funogram is a functional Telegram Bot Api library for F# diff --git a/src/Funogram/Tools.fs b/src/Funogram/Tools.fs index 2ed1751..5e02e4c 100644 --- a/src/Funogram/Tools.fs +++ b/src/Funogram/Tools.fs @@ -4,6 +4,7 @@ open System open System.Net open System.Net.Http open System.Runtime.CompilerServices +open Funogram.Types open Utf8Json open Utf8Json.Resolvers @@ -74,7 +75,7 @@ let internal parseJsonStream<'a> (data: Stream) = Exception("Can't parse json") |> Result.Error let internal parseJsonStreamApiResponse<'a> (data: Stream) = - match parseJsonStream> data with + match parseJsonStream> data with | Ok x when x.Ok && x.Result.IsSome -> Ok x.Result.Value | Ok x when x.Description.IsSome && x.ErrorCode.IsSome -> @@ -376,7 +377,7 @@ module Api = let fn = mkRequestGenerator<'a> () fun (request: IBotRequest) -> fn (request :?> 'a) "" - let makeRequestAsync config (request: IRequestBase<'a>) = + let makeRequestAsync<'a> config (request: IBotRequest) = async { let client = config.Client let url = getUrl config request.MethodName @@ -400,7 +401,6 @@ module Api = else return Error { Description = "HTTP_ERROR"; ErrorCode = int result.StatusCode } } - let makeJsonBodyRequestAsync config (request: IRequestBase<'a>) = async { diff --git a/src/examples/Funogram.Examples.AnonChat/Funogram.Examples.AnonChat.fsproj b/src/examples/Funogram.Examples.AnonChat/Funogram.Examples.AnonChat.fsproj index a6ec55d..bc9365c 100644 --- a/src/examples/Funogram.Examples.AnonChat/Funogram.Examples.AnonChat.fsproj +++ b/src/examples/Funogram.Examples.AnonChat/Funogram.Examples.AnonChat.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/src/examples/Funogram.Examples.Banhammer/Funogram.Examples.Banhammer.fsproj b/src/examples/Funogram.Examples.Banhammer/Funogram.Examples.Banhammer.fsproj index a6ec55d..bc9365c 100644 --- a/src/examples/Funogram.Examples.Banhammer/Funogram.Examples.Banhammer.fsproj +++ b/src/examples/Funogram.Examples.Banhammer/Funogram.Examples.Banhammer.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/src/examples/Funogram.Examples.HelloWorld/Funogram.Examples.HelloWorld.fsproj b/src/examples/Funogram.Examples.HelloWorld/Funogram.Examples.HelloWorld.fsproj index a6ec55d..bc9365c 100644 --- a/src/examples/Funogram.Examples.HelloWorld/Funogram.Examples.HelloWorld.fsproj +++ b/src/examples/Funogram.Examples.HelloWorld/Funogram.Examples.HelloWorld.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/src/examples/Funogram.Examples.WebSocket/Funogram.Examples.WebSocket.fsproj b/src/examples/Funogram.Examples.WebSocket/Funogram.Examples.WebSocket.fsproj index a6ec55d..bc9365c 100644 --- a/src/examples/Funogram.Examples.WebSocket/Funogram.Examples.WebSocket.fsproj +++ b/src/examples/Funogram.Examples.WebSocket/Funogram.Examples.WebSocket.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/src/examples/Funogram.TestBot/Funogram.TestBot.fsproj b/src/examples/Funogram.TestBot/Funogram.TestBot.fsproj index 333d8bf..56684fd 100644 --- a/src/examples/Funogram.TestBot/Funogram.TestBot.fsproj +++ b/src/examples/Funogram.TestBot/Funogram.TestBot.fsproj @@ -1,7 +1,7 @@  exe - net6.0 + net8.0