Documentation ¶
Overview ¶
Copyright 2020 Eurac Research. All rights reserved.
Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package snipeit provides a client for communicating with the Snipe-IT API and defines Snipe-IT specific data types.
Index ¶
- type Client
- func (c *Client) AddOptions(s string, opt interface{}) (string, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) Hardware(opt *HardwareOptions) ([]*Hardware, *http.Response, error)
- func (c *Client) Location(id int64) (*Location, *http.Response, error)
- func (c *Client) Locations(opt *LocationOptions) ([]*Location, *http.Response, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- type Hardware
- type HardwareOptions
- type Location
- type LocationOptions
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
A Client manages communication with the Snipe-IT API.
func NewClient ¶
NewClient returns a new Snipe-IT API client with provided base URL. If base URL does not have a trailing slash, one is added automatically.
func (*Client) AddOptions ¶
AddOptions adds the parameters in opt as URL query parameters to s. opt must be a struct whose fields may contain "url" tags.
func (*Client) Location ¶
Location by ID.
Snipe-IT API doc: https://snipe-it.readme.io/reference#locations-1
func (*Client) Locations ¶
Locations lists all locations.
Snipe-IT API doc: https://snipe-it.readme.io/reference#locations
type Hardware ¶
type Hardware struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` AssetTag string `json:"asset_tag,omitempty"` Serial string `json:"serial,omitempty"` Model struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"model,omitempty"` ModelNumber string `json:"model_number,omitempty"` StatusLabel struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` StatusMeta string `json:"status_meta,omitempty"` } `json:"status_label,omitempty"` Category struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"category,omitempty"` Manufacturer struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"manufacturer,omitempty"` Supplier struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"supplier,omitempty"` Notes string `json:"notes,omitempty"` OrderNumber string `json:"order_number,omitempty"` Company string `json:"company,omitempty"` Location int64 `json:"location,omitempty"` RtdLocation struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"rtd_location,omitempty"` Image string `json:"image,omitempty"` AssignedTo struct { ID int64 `json:"id,omitempty"` Username string `json:"username,omitempty"` Name string `json:"name,omitempty"` Firstname string `json:"first_name,omitempty"` Lastname string `json:"last_name,omitempty"` Emplyee string `json:"employee_number,omitempty"` Type string `json:"type,omitempty"` } `json:"assigned_to,omitempty"` WarrantyMonths interface{} `json:"warranty_months,omitempty"` WarrantyExpires interface{} `json:"warranty_expires,omitempty"` CreatedAt Timestamp `json:"created_at,omitempty"` UpdatedAt Timestamp `json:"updated_at,omitempty"` DeletedAt Timestamp `json:"deleted_at,omitempty"` PurchaseDate Timestamp `json:"purchase_date,omitempty"` LastCheckout Timestamp `json:"last_checkout,omitempty"` ExpectedCheckin Timestamp `json:"expected_checkin,omitempty"` PurchaseCost int64 `json:"purchase_cost,omitempty"` UserCanCheckout bool `json:"user_can_checkout,omitempty"` CustomFields []interface{} `json:"custom_fields,omitempty"` AvailableActions struct { Checkout bool `json:"checkout,omitempty"` Checkin bool `json:"checkin,omitempty"` Clone bool `json:"clone,omitempty"` Restore bool `json:"restore,omitempty"` Update bool `json:"update,omitempty"` Delete bool `json:"delete,omitempty"` } `json:"available_actions,omitempty"` }
Hardware represents a Snipe-IT hardware object.
type HardwareOptions ¶
type HardwareOptions struct { LocationID int `url:"location_id,omitempty"` CompanyID int `url:"company_id,omitempty"` }
HardwareOptions specifies a subset of optional query parameters for listing assets.
type Location ¶
type Location struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` Image string `json:"image,omitempty"` Address string `json:"address,omitempty"` Address2 string `json:"address2,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` Country string `json:"country,omitempty"` Zip string `json:"zip,omitempty"` AssetsAssigned int64 `json:"assigned_assets_count,omitempty"` Assets int64 `json:"assets_count,omitempty"` Users int64 `json:"users_count,omitempty"` Currency string `json:"currency,omitempty"` CreatedAt Timestamp `json:"created_at,omitempty"` UpdatedAt Timestamp `json:"updated_at,omitempty"` Parent struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"parent,omitempty"` Manager string `json:"manager,omitempty"` Children []Location `json:"children,omitempty"` Actions struct { Update bool Delete bool } `json:"available_actions,omitempty"` }
Location represents a Snipe-IT location.
type LocationOptions ¶
type LocationOptions struct { // Search string Search string `url:"search,omitempty"` }
LocationOptions specifies a subset of optional query parameters for listing locations.