Skip to content

Commit

Permalink
Merge pull request #15 from lorenalexm/services-extension
Browse files Browse the repository at this point in the history
Added service injection extension, bumped version
  • Loading branch information
lorenalexm authored Jul 12, 2023
2 parents 68b7483 + 2d6f6ba commit 1307768
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
20 changes: 20 additions & 0 deletions StrapiSharp/Extensions/ServiceCollectionExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.Extensions.DependencyInjection;

namespace StrapiSharp.Extensions
{
public static class ServiceCollectionExtension
{
/// <summary>
/// Adds a <see cref="Strapi"/> object as a singleton instance.
/// </summary>
/// <param name="services"><see cref="IServiceCollection"/>.</param>
/// <param name="host">The Strapi host to make requests against.</param>
/// <returns>Continues the <see cref="IServiceCollection"/> chain.</returns>
public static IServiceCollection AddStrapiSharp(this IServiceCollection services, string host)
{
services.AddSingleton(new Strapi(host));
return services;
}
}
}

7 changes: 6 additions & 1 deletion StrapiSharp/StrapiSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>StrapiSharp</PackageId>
<Version>0.1.3</Version>
<Version>0.1.4</Version>
<Authors>Alex Loren</Authors>
<PackageTags>Strapi;REST;API</PackageTags>
<Description>StrapiSharp is a lightweight C# library for easy integration with Strapi CMS, allowing seamless communication with Strapi's RESTful API.</Description>
Expand All @@ -21,11 +21,16 @@
<None Remove="Enums\" />
<None Remove="Models\" />
<None Remove="Requests\Convenience\" />
<None Remove="Extensions\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Requests\" />
<Folder Include="Enums\" />
<Folder Include="Models\" />
<Folder Include="Requests\Convenience\" />
<Folder Include="Extensions\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
</ItemGroup>
</Project>

0 comments on commit 1307768

Please sign in to comment.