G4.Api 2025.2.4.26

dotnet add package G4.Api --version 2025.2.4.26                
NuGet\Install-Package G4.Api -Version 2025.2.4.26                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="G4.Api" Version="2025.2.4.26" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add G4.Api --version 2025.2.4.26                
#r "nuget: G4.Api, 2025.2.4.26"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install G4.Api as a Cake Addin
#addin nuget:?package=G4.Api&version=2025.2.4.26

// Install G4.Api as a Cake Tool
#tool nuget:?package=G4.Api&version=2025.2.4.26                

G4.Api

NuGet Build, Test & Release

G4.Api is the official client library for the G4� Engine, providing seamless access to automation, environments, integrations, and templates management. Through its intuitive interfaces, you can quickly leverage the robust features of G4 to build, run, and manage automation workflows, environment parameters, and plugin integrations.


Table of Contents


Features

  1. Automation Management

    • Invoking, tracking, and customizing automated workflows.
    • Handling job, rule, and stage-level events and callbacks.
  2. Environments Management

    • Creating, deleting, and updating environment-specific parameters.
    • Decoding and encoding parameters for secure storage and retrieval.
  3. Integrations

    • Centralized management of external repositories and plugin metadata.
    • Cached retrieval of plugin documents, manifests, and other artifacts.
  4. Templates

    • Adding and removing plugin templates for reuse in automation scenarios.
    • Maintaining a dedicated LiteDB collection for template management.

Installation

You can install G4.Api via NuGet:

# For latest version, visit: https://www.nuget.org/packages/G4.Api

dotnet add package G4.Api --version <LatestVersion>

# Or, if you prefer the latest version:

dotnet add package G4.Api

Or by adding it directly in your .csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <ItemGroup>
    <PackageReference Include="G4.Api" Version="<LatestVersion>" />
  </ItemGroup>
</Project>

Getting Started

  1. Reference the Library
    Add a reference to G4.Api in your .NET project. Ensure you have at least .NET 6 or higher (the library targets .NET 8.0).

  2. Create and Configure a G4Client

    using G4.Api;
    
    var g4Client = new G4Client();
    
  3. Explore Clients

    • Automation: g4Client.Automation
    • Environments: g4Client.Environments
    • Integration: g4Client.Integration
    • Templates: g4Client.Templates
  4. Start Automating!

    • Create or fetch environment parameters.
    • Add or remove plugin templates.
    • Invoke automations and handle events such as RuleInvoking, JobInvoked, and more.

Basic Usage

Below is a simplified example demonstrating how you might use G4.Api to work with an environment parameter and trigger an automation:

using G4.Api;
using Microsoft.Extensions.Logging;

// 1. Create the client
var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
var logger = loggerFactory.CreateLogger("G4Logger");
var g4Client = new G4Client(logger);

// 2. Update environment parameters
var parameters = new Dictionary<string, string>
{
    { "ApiKey", "MY_SECRET_KEY" },
    { "Region", "us-east-1" }
};
g4Client.Environments.SetEnvironment("ProductionEnv", parameters, encode: true);

// 3. Retrieve a parameter (decoded)
var apiKey = g4Client.Environments.GetParameter("ProductionEnv", "ApiKey", decode: true);
Console.WriteLine($"Decoded API Key: {apiKey}");

// 4. Invoke an automation
// (Assume we have a G4AutomationModel with tasks defined)
var automationModel = new G4AutomationModel { /* ... configuration ... */ };
var results = g4Client.Automation.Invoke(automationModel);

foreach (var result in results)
{
    Console.WriteLine($"Automation Group: {result.Key}, Status: {result.Value.Status}");
}

Note: This snippet is purely illustrative and may be modified to fit real-world scenarios.


Contributing

  1. Fork this repository and clone your fork.
  2. Create a feature branch (e.g., feature/awesome-new-feature).
  3. Commit your changes and push them to your fork.
  4. Open a Pull Request against the main branch of this repository.

We welcome contributions of all types - bug reports, fixes, new features, documentation updates, etc. Please make sure to follow the project's code style and standards.


License

This project is licensed under the Apache License 2.0. By contributing to G4.Api, you agree that your contributions will be licensed under its Apache 2.0 License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2025.2.4.26 48 2/4/2025
2025.2.3.25 71 2/3/2025
2025.1.24.24 74 1/24/2025
2025.1.21.23 86 1/21/2025
2025.1.21.22 66 1/21/2025
2025.1.17.21 85 1/17/2025
2025.1.16.20 72 1/16/2025
2025.1.16.19 80 1/16/2025
2024.12.24.18 101 12/24/2024
2024.12.24.17 79 12/24/2024
2024.12.24.16 89 12/24/2024
2024.12.24.15 82 12/24/2024
2024.12.24.14 76 12/24/2024
2024.12.24.13 82 12/24/2024
2024.12.24.12 80 12/24/2024
2024.12.24.11 78 12/24/2024
2024.11.14.75 423 11/14/2024
2024.11.14.74 84 11/14/2024
2024.11.14.73 84 11/14/2024
2024.11.14.72 93 11/14/2024
2024.11.13.70 89 11/13/2024
2024.11.12.63 96 11/12/2024