Skip to content

Commit

Permalink
Bump .Net to 8.0
Browse files Browse the repository at this point in the history
Add apiRaw method
  • Loading branch information
Dolfik1 committed Jan 31, 2024
1 parent bb9afb3 commit 9af4f31
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Funogram.Generator/Funogram.Generator.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Funogram.Telegram/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>6.9.0.0</Version>
<Version>6.9.0.1</Version>
<Authors>Nikolay Matyushin</Authors>
<Product>Funogram.Telegram</Product>
<Title>Funogram.Telegram</Title>
Expand Down
2 changes: 1 addition & 1 deletion src/Funogram.Tests/Funogram.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
13 changes: 10 additions & 3 deletions src/Funogram.Tests/Json.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ let ``JSON deserializing MessageEntity`` () =
| Ok r -> shouldEqual r Constants.jsonTestObj
| Error e -> failwith e.Description

[<Fact>]
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

[<Fact>]
let ``JSON serializing MessageEntity``() =
Constants.jsonTestObj
Expand Down Expand Up @@ -68,7 +76,6 @@ let ``JSON deserializing MaskPosition`` () =
|> function
| Ok result -> shouldEqual result Constants.testMaskPosition
| Error error -> failwith error.Description


[<Fact>]
let ``JSON serializing MaskPosition`` () =
Expand All @@ -89,7 +96,7 @@ let ``JSON deserializing ForwardMessage`` () =
|> function
| Ok result -> shouldEqual result Constants.jsonMessageForward
| Error error -> failwith error.Description

[<Fact>]
let ``JSON serializing params dictionary`` () =
Constants.paramsDictionary
Expand All @@ -101,7 +108,7 @@ let ``JSON serializing forward message request`` () =
Constants.forwardMessageReq
|> toJsonBotRequestString
|> shouldEqual Constants.jsonForwardMessageReq

[<Fact>]
let ``JSON deserializing ChatMember``() =
Constants.jsonTestObjChatMemberResultString
Expand Down
5 changes: 4 additions & 1 deletion src/Funogram/Api.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ module Funogram.Api
open Funogram.Tools

let api config (request: IRequestBase<'a>) =
Api.makeRequestAsync config request
Api.makeRequestAsync<'a> config request

let apiRaw config (request: IBotRequest) =
Api.makeRequestAsync<obj> config request
4 changes: 2 additions & 2 deletions src/Funogram/Funogram.fsproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>2.0.8</VersionPrefix>
<VersionPrefix>2.0.9</VersionPrefix>
<Authors>Nikolay Matyushin</Authors>
<Product>Funogram</Product>
<Description>Funogram is a functional Telegram Bot Api library for F#</Description>
Expand Down
6 changes: 3 additions & 3 deletions src/Funogram/Tools.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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<Types.ApiResponse<'a>> data with
match parseJsonStream<ApiResponse<'a>> data with
| Ok x when x.Ok && x.Result.IsSome -> Ok x.Result.Value

| Ok x when x.Description.IsSome && x.ErrorCode.IsSome ->
Expand Down Expand Up @@ -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
Expand All @@ -400,7 +401,6 @@ module Api =
else
return Error { Description = "HTTP_ERROR"; ErrorCode = int result.StatusCode }
}


let makeJsonBodyRequestAsync config (request: IRequestBase<'a>) =
async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/examples/Funogram.TestBot/Funogram.TestBot.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Core.fs" />
Expand Down

0 comments on commit 9af4f31

Please sign in to comment.