Skip to content

Commit

Permalink
Categories (#18)
Browse files Browse the repository at this point in the history
* added categories

* Updated csproj

---------

Co-authored-by: bZverok <[email protected]>
  • Loading branch information
vitalii-bezuhlyi and bZverok authored Apr 16, 2024
1 parent 7e34f57 commit 86a2cef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Apps.GoogleSheets/Apps.GoogleSheets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Nullable>enable</Nullable>
<Product>Google Sheets</Product>
<Description>Create and edit online spreadsheets. Get insights together with secure sharing in real-time and from any device</Description>
<Version>1.2.9</Version>
<Version>1.2.10</Version>
<AssemblyName>Apps.GoogleSheets</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blackbird.Applications.Sdk.Common" Version="2.3.2-alpha1" />
<PackageReference Include="Blackbird.Applications.Sdk.Common" Version="2.6.0" />
<PackageReference Include="Blackbird.Applications.SDK.Extensions.FileManagement" Version="1.0.1" />
<PackageReference Include="Blackbird.Applications.Sdk.Glossaries.Utils" Version="1.0.0-alpha11" />
<PackageReference Include="Google.Apis.Drive.v3" Version="1.61.0.3155" />
Expand Down
17 changes: 14 additions & 3 deletions Apps.GoogleSheets/GoogleSheetsApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
using Blackbird.Applications.Sdk.Common.Authentication.OAuth2;
using Apps.GoogleSheets.Auth.OAuth2;
using Blackbird.Applications.Sdk.Common.Invocation;
using Blackbird.Applications.Sdk.Common.Metadata;

namespace Apps.GoogleSheets
{
public class GoogleSheetsApplication : BaseInvocable, IApplication
public class GoogleSheetsApplication : BaseInvocable, IApplication, ICategoryProvider
{
private readonly Dictionary<Type, object> _typesInstances;

public IEnumerable<ApplicationCategory> Categories
{
get =>
[
ApplicationCategory.DatabaseAndSpreadsheet, ApplicationCategory.GoogleApps,
ApplicationCategory.ProjectManagementAndProductivity
];
set { }
}

public GoogleSheetsApplication(InvocationContext invocationContext) : base(invocationContext)
{
_typesInstances = CreateTypesInstances();
Expand All @@ -24,7 +35,7 @@ public T GetInstance<T>()
{
if (!_typesInstances.TryGetValue(typeof(T), out var value))
throw new InvalidOperationException($"Instance of type '{typeof(T)}' not found");

return (T)value;
}

Expand All @@ -37,4 +48,4 @@ private Dictionary<Type, object> CreateTypesInstances()
};
}
}
}
}

0 comments on commit 86a2cef

Please sign in to comment.