SnipeSharp 0.1.0
See the version list below for details.
dotnet add package SnipeSharp --version 0.1.0
NuGet\Install-Package SnipeSharp -Version 0.1.0
<PackageReference Include="SnipeSharp" Version="0.1.0" />
paket add SnipeSharp --version 0.1.0
#r "nuget: SnipeSharp, 0.1.0"
// 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 | Versions 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. |
-
- Newtonsoft.Json (>= 10.0.3)
- RestSharp (>= 106.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial Release