SnipeSharp 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SnipeSharp --version 0.1.0                
NuGet\Install-Package SnipeSharp -Version 0.1.0                
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="SnipeSharp" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SnipeSharp --version 0.1.0                
#r "nuget: SnipeSharp, 0.1.0"                
#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 SnipeSharp as a Cake Addin
#addin nuget:?package=SnipeSharp&version=0.1.0

// Install SnipeSharp as a Cake Tool
#tool nuget:?package=SnipeSharp&version=0.1.0                

SnipeSharp

A .NET wrapper for the Snipe IT API written (poorly) in C#.

Before You Dive In

The goal of this project is to give easy access to all endpoints of the Snipe IT API via C#. With that said, this build is currently a rough demo. Most of the endpoints work as expected but plan on things breaking or not working 100%.

This project was built to support my own needs. As such features are being worked on in the order I personally need them. However, if you want a feature or find a bug please open an issue.

Final note, this is my first C# project of this scale. I'm not up on all the best practices. If you see something I've done that should be done differently, I encourge you to let me know.

Prerequisites

A Working Install of Snipe IT V4+

Usage

SnipeItApi snip = new SnipeItApi();
snipe.ApiSettings.ApiToken = "XXXXXXXX"
snipe.ApiSettings.BaseUrl = new Uri("http://xxxxx.com/api/v1")

Each endpoint has it's own manager assigned to the SnipeItApi object. Example, SnipeItApi.AssetManager

Each endpoint has a common set of actions. With the exception Assets, Status Labels and Users which use extended managers to deal with extra API functions associated with them.

Common Actions

Return all objects at this end point

snipe.AssetManager.GetAll()

Find all objects matching certain filtering criteria

snipe.AssetManager.FindAll(ISearchFilter filter)

Find first object matching search criteria

snipe.AssetManager.FindOne(ISearchFilter filter)

Get object with ID

snipe.AssetManager.Get(int ID)

Search for object with given name

snipe.AssetManager.Get(string name)

Create an object

snipe.AssetManager.Create(ICommonEndpointObject item)

Update an object

snipe.AssetManager.Update(ICommonEndpointObject item)

Delete an object

snipe.AssetManager.Delete(int id)

Examples

Create a new asset

Asset asset = new Asset() {
    Name = "Loaner1",
    AssetTag = "12345678",
    Model = snipe.ModelManager.Get("Lenovo"),
    Status = snipe.StatusLabelManager.Get("Ready to Deploy"),
    Location = snipe.LocationManager.Get("Maine")
};

snipe.AssetManager.Create(asset);

Update an Asset

Asset asset = snipe.AssetManager.Get("Loaner1");
asset.Serial = "1i37dpc3k";
snipe.AssetManager.Update(asset);

Get all assets from made by a certain manufacturer

AssetSearchFilter filter = new AssetSearchFilter() {
    Manufacturer = snipe.ManufacturerManager.Get("Lenovo")
};

var result = snipe.AssetManager.FindAll(filter);
Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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
0.1.2 1,568 12/24/2017
0.1.1 1,067 12/22/2017
0.1.0 970 12/13/2017

Initial Release