Giter Club home page Giter Club logo

snipesharp's Introduction

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+

Installation

nuget install SnipeSharp

Usage

SnipeItApi snipe = 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);

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Matthew 'Barry' Carey - Initial work - BarryCarey

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

snipesharp's People

Contributors

barrycarey avatar fordster78 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.