Skip to content

Commit

Permalink
Prerelease-0.1.0 (#2)
Browse files Browse the repository at this point in the history
* Split WithEndpoint/WithIdEndpoint extensions

* Add parameters to WithIdEndpoint

* Add parameters to GetIdEndpoint

* Rename project

* Update namespaces

* Enable Complex Requests
  • Loading branch information
YuriyDurov authored Sep 15, 2023
1 parent e955dea commit c6794c3
Show file tree
Hide file tree
Showing 41 changed files with 279 additions and 150 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/Publish Communicator.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/Publish Flex.Net.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
repository_dispatch:
push:
tags:
- "Flex.Net-v[0-9]+.[0-9]+.[0-9]+*"

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY}}

jobs:

Release:
name: Release
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Verify commit
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
- name: Set version
run: echo "VERSION=${GITHUB_REF/refs\/tags\/Flex.Net-v/}" >> $GITHUB_ENV

- name: Build
run: |
dotnet build Flex.Net.sln --configuration Release /p:Version=${VERSION}
dotnet pack Flex.Net.sln --configuration Release /p:Version=${VERSION} --no-build --output .
- name: Push
run: |
dotnet nuget push Flex.Net.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_APIKEY}
dotnet nuget push Flex.Net.REST.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_APIKEY}
10 changes: 5 additions & 5 deletions Communicator.sln → Flex.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BitzArt.Communicator", "src\BitzArt.Communicator\BitzArt.Communicator.csproj", "{FE9CED3F-83D8-43DA-BB05-93F5807F746E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flex.Net", "src\Flex.Net\Flex.Net.csproj", "{FE9CED3F-83D8-43DA-BB05-93F5807F746E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BitzArt.Communicator.REST", "src\BitzArt.Communicator.REST\BitzArt.Communicator.REST.csproj", "{E78BC020-AC54-4F92-8628-14EE6FF9EDBF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flex.Net.REST", "src\Flex.Net.REST\Flex.Net.REST.csproj", "{E78BC020-AC54-4F92-8628-14EE6FF9EDBF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{A3976FBB-F37A-4468-955D-8B2FCC79ACD0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A0FAE66D-5574-463E-8723-E28ECEE565EE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BitzArt.Communicator.Tests", "tests\BitzArt.Communicator.Tests\BitzArt.Communicator.Tests.csproj", "{AEA2C975-E99C-4E44-B121-0CF3D4956732}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flex.Net.Tests", "tests\Flex.Net.Tests\Flex.Net.Tests.csproj", "{AEA2C975-E99C-4E44-B121-0CF3D4956732}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitzArt.Communicator.REST.Tests", "tests\BitzArt.Communicator.REST.Tests\BitzArt.Communicator.REST.Tests.csproj", "{6A90BCF4-FB3B-4B4A-A992-3D288972B4AF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flex.Net.REST.Tests", "tests\Flex.Net.REST.Tests\Flex.Net.REST.Tests.csproj", "{6A90BCF4-FB3B-4B4A-A992-3D288972B4AF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1CF88BCF-544C-463E-A639-594ADE0A9F15}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -22,8 +22,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1CF8
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ABC1CAE6-C4A2-42AB-8F24-9A32299CC512}"
ProjectSection(SolutionItems) = preProject
.github\workflows\Publish Communicator.yml = .github\workflows\Publish Communicator.yml
.github\workflows\Tests.yml = .github\workflows\Tests.yml
.github\workflows\Publish Flex.Net.yml = .github\workflows\Publish Flex.Net.yml
EndProjectSection
EndProject
Global
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using BitzArt.Communicator;
using Microsoft.Extensions.DependencyInjection;
using System.Net;
using Microsoft.Extensions.DependencyInjection;

namespace BitzArt;
namespace Flex;

public static class AddEntityExtension
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json;

namespace BitzArt.Communicator;
namespace Flex;

public static class ICommunicatorRestServiceBuilderExtensions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using BitzArt.Communicator;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

namespace BitzArt;
namespace Flex;

public static class UsingRestExtension
{
Expand Down
20 changes: 20 additions & 0 deletions src/Flex.Net.REST/Extensions/WithEndpointExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Flex;

public static class WithEndpointExtension
{
public static ICommunicatorRestEntityBuilder<TEntity> WithEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, string endpoint)
where TEntity : class
{
builder.EntityOptions.Endpoint = endpoint;

return builder;
}

public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, string endpoint)
where TEntity : class
{
builder.EntityOptions.Endpoint = endpoint;

return builder;
}
}
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
namespace BitzArt.Communicator;
namespace Flex;

public static class ICommunicatorRestEntityBuilderExtensions
public static class WithIdEndpointExtension
{
public static ICommunicatorRestEntityBuilder<TEntity> WithEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, string endpoint)
public static ICommunicatorRestEntityBuilder<TEntity> WithIdEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, string endpoint)
where TEntity : class
{
builder.EntityOptions.Endpoint = endpoint;
builder.EntityOptions.GetIdEndpointAction = (key, parameters) => endpoint;

return builder;
}

public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, string endpoint)
public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithIdEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, string endpoint)
where TEntity : class
{
builder.EntityOptions.Endpoint = endpoint;
builder.EntityOptions.GetIdEndpointAction = (key, parameters) => endpoint;

return builder;
}

public static ICommunicatorRestEntityBuilder<TEntity> WithIdEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, string endpoint)
public static ICommunicatorRestEntityBuilder<TEntity> WithIdEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, Func<string> getEndpoint)
where TEntity : class
{
builder.EntityOptions.GetIdEndpointAction = (key) => endpoint;
builder.EntityOptions.GetIdEndpointAction = (key, parameters) => getEndpoint();

return builder;
}

public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithIdEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, string endpoint)
public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithIdEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, Func<string> getEndpoint)
where TEntity : class
{
builder.EntityOptions.GetIdEndpointAction = (key) => endpoint;
builder.EntityOptions.GetIdEndpointAction = (key, parameters) => getEndpoint();

return builder;
}

public static ICommunicatorRestEntityBuilder<TEntity> WithIdEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, Func<string> getEndpoint)
public static ICommunicatorRestEntityBuilder<TEntity> WithIdEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, Func<object?, string> getEndpoint)
where TEntity : class
{
builder.EntityOptions.GetIdEndpointAction = (key) => getEndpoint();
builder.EntityOptions.GetIdEndpointAction = (key, parameters) => getEndpoint(key);

return builder;
}

public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithIdEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, Func<string> getEndpoint)
public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithIdEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, Func<TKey?, string> getEndpoint)
where TEntity : class
{
builder.EntityOptions.GetIdEndpointAction = (key) => getEndpoint();
builder.EntityOptions.GetIdEndpointAction = (key, parameters) => getEndpoint(key);

return builder;
}

public static ICommunicatorRestEntityBuilder<TEntity> WithIdEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, Func<object?, string> getEndpoint)
public static ICommunicatorRestEntityBuilder<TEntity> WithIdEndpoint<TEntity>(this ICommunicatorRestEntityBuilder<TEntity> builder, Func<object?, object[]?, string> getEndpoint)
where TEntity : class
{
builder.EntityOptions.GetIdEndpointAction = getEndpoint;

return builder;
}

public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithIdEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, Func<TKey?, string> getEndpoint)
public static ICommunicatorRestEntityBuilder<TEntity, TKey> WithIdEndpoint<TEntity, TKey>(this ICommunicatorRestEntityBuilder<TEntity, TKey> builder, Func<TKey?, object[]?, string> getEndpoint)
where TEntity : class
{
builder.EntityOptions.GetIdEndpointAction = getEndpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>BitzArt.Communicator</RootNamespace>
<RootNamespace>Flex</RootNamespace>

<PackageId>BitzArt.Communicator.REST</PackageId>
<PackageId>Flex.Net.Rest</PackageId>
<Authors>BitzArt</Authors>
<Description>Communicator's default RESTful client implementation</Description>
<Description>Flex.Net - REST Api client implementation</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/BitzArt/Communicator</RepositoryUrl>
<PackageProjectUrl>https://github.com/BitzArt/Communicator</PackageProjectUrl>
<RepositoryUrl>https://github.com/BitzArt/Flex.Net</RepositoryUrl>
<PackageProjectUrl>https://github.com/BitzArt/Flex.Net</PackageProjectUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BitzArt.Communicator\BitzArt.Communicator.csproj" />
<ProjectReference Include="..\Flex.Net\Flex.Net.csproj" />
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>BitzArt.Communicator.REST.Tests</_Parameter1>
<_Parameter1>Flex.Net.REST.Tests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BitzArt.Communicator;
namespace Flex;

public interface ICommunicatorRestEntityBuilder<TEntity> : ICommunicatorEntityBuilder, ICommunicatorRestServiceBuilder
where TEntity : class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BitzArt.Communicator;
namespace Flex;

public interface ICommunicatorRestServiceBuilder : ICommunicatorServiceBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.Extensions.DependencyInjection;

namespace BitzArt.Communicator;
namespace Flex;

internal class CommunicatorRestEntityBuilder<TEntity> : ICommunicatorRestEntityBuilder<TEntity>
where TEntity : class
Expand Down
Loading

0 comments on commit c6794c3

Please sign in to comment.