Skip to content

Latest commit

 

History

History
235 lines (179 loc) · 11.7 KB

README.md

File metadata and controls

235 lines (179 loc) · 11.7 KB

Sankhya SDK

📊⚙️ Sankhya .NET SDK.

GitHub license Time tracker

Sankhya logo

CI/CD

Build status Last commit Tests Coverage Code Smells LoC
Build status GitHub last commit AppVeyor tests (branch) Coverage Code Smells Lines of Code

Code Quality

Codacy Badge Codacy Badge

codecov CodeFactor

Maintainability Test Coverage

Quality Gate Status Maintainability Rating

Technical Debt Duplicated Lines (%)

Reliability Rating Security Rating

Bugs Vulnerabilities


Installation

Github Releases

GitHub last release Github All Releases

Download the latest zip file from the Release page.

Nuget package manager

Package Version Downloads
Sankhya Sankhya NuGet Version Sankhya NuGet Downloads

Features

This SDK implements many of Sankhya's web services. Some of them are called Know Services. If the service you seek is not set in the SDK, you can implement the service request/response independently (and use it on your code or submit a pull request to this repository).

Some Request Wrappers allow you to make some requests easily.

Known Services

Wiki page about KSRW

Sankhya Wrapper

The last-mile operations are done on these wrappers. This class defines all HTTP request/response, login/logout, serialization, and download/upload operations.

Avoid using this class directly from your implementation. Only call its methods if you are extending the SDK's functionality or implementing a new feature. Otherwise, I prefer using one of the request wrappers or the Sankhya Context class.


Usage

Service registration (IoC / DI)

This SDK is based on CrispyWaffle toolkit, so you can use its Service Locator feature to register it.

Assuming you are using Crispy Waffle, you can register the Sankhya wrapper in the Bootstrapper.cs file this way:

var connectionSankhya = new Connection(); //Fill in your details
ServiceLocator.Register(() => new SankhyaContext(connectionSankhya), LifeStyle.Singleton);

Later, when you need to access the Sankhya Context in your code, you can just pass it as the constructor's argument or retrieve it from Service Locator

Constructor argument

public class MyClass {

    private readonly SankhyaContext _sankhyaContext;

    public MyClass(SankhyaContext sankyaContext) {
        _sankhyaContext = sankhyaContext ?? throw new ArgumentNullException(nameof(sankhyaContext));
    }
}

Retrieving manually

var sankhyaContext = ServiceLocator.Resolve<SankhyaContext>();

Know Services Wrapper

The KnowServicesRequestWrapper is a static class that can be used anywhere since SankhyaContext is registered through ServiceLocator.

Session management

You can use this to get all active sessions in Sankhya and kill them one by one:

var sessions = KnowServicesRequestWrapper.GetSessions();
foreach (var session in sessions) {
    KnowServicesRequestWrapper.KillSession(session.Id);
}

Support

Please open an issue for support.


Contributing

Refer to CONTRIBUTING.md to learn how to contribute to this project!

Contributors

guibranco
Guilherme Branco Stracini
fandriyaninkov
Fedor Andriyaninkov
pedrowindisch
Pedro Henrique
viktoriussuwandi
Viktorius Suwandi

Bots

dependabot[bot]
dependabot[bot]
github-actions[bot]
github-actions[bot]
penify-dev[bot]
penify-dev[bot]
stack-file[bot]
stack-file[bot]
codefactor-io[bot]
codefactor-io[bot]
gitauto-ai[bot]
gitauto-ai[bot]
snyk-bot
Snyk bot