Documentation ¶
Overview ¶
Package client provides a rest api client for the Team Password Manager api
Index ¶
- Variables
- type APIVersion
- type Count
- type CustomField
- type GeneratedPassword
- type Password
- type Passwords
- type Project
- type Projects
- type TpmClient
- func (client *TpmClient) GeneratePassword() (*GeneratedPassword, error)
- func (client *TpmClient) PasswordGet(id string) (*Password, error)
- func (client *TpmClient) PasswordList(search string) (Passwords, error)
- func (client *TpmClient) ProjectArchive(id string) error
- func (client *TpmClient) ProjectDelete(id string) error
- func (client *TpmClient) ProjectGet(id string) (*Project, error)
- func (client *TpmClient) ProjectList(search string) (Projects, error)
- func (client *TpmClient) ProjectUnarchive(id string) error
- func (client *TpmClient) Version() (*APIVersion, error)
- type User
Constants ¶
This section is empty.
Variables ¶
var ( // Version holds the version number of the tpm rest api client library Version string )
Functions ¶
This section is empty.
Types ¶
type APIVersion ¶
type APIVersion struct { Version string `json:"version"` Date string `json:"version_date"` Number string `json:"api_version"` }
APIVersion represents the version of the team password manager server
type Count ¶
type Count struct { Items int `json:"num_items"` Pages int `json:"num_pages"` ItemsPerPage int `json:"num_items_per_page"` }
Count describes how many items and pages exist in a collection such as projects or passwords.
type CustomField ¶
type CustomField struct { Type string `json:"type"` Label string `json:"label"` Data string `json:"data"` }
CustomField holds generic data associated with a Password
type GeneratedPassword ¶
type GeneratedPassword struct {
Value string `json:"password"`
}
GeneratedPassword represents a API response with the generated password
type Password ¶
type Password struct { ID string `json:"id"` AccessInfo string `json:"access_info"` Archived bool `json:"archived"` CreatedBy User `json:"created_by"` CreatedOn string `json:"created_on"` Email string `json:"email"` ExpiryDate string `json:"expiry_date"` ExpiryStatus int `json:"expiry_status"` ExternalSharing bool `json:"external_sharing"` ExternalURL string `json:"external_url"` Favorite bool `json:"favorite"` Locked bool `json:"locked"` ManagedBy User `json:"managed_by"` Name string `json:"name"` Notes string `json:"notes"` NumFiles string `json:"num_files"` Password string `json:"password"` Project Project `json:"project"` Tags string `json:"tags"` UpdatedBy User `json:"updated_by"` UpdatedOn string `json:"updated_on"` Username string `json:"username"` CustomField1 CustomField `json:"custom_field1"` CustomField2 CustomField `json:"custom_field2"` CustomField3 CustomField `json:"custom_field3"` CustomField4 CustomField `json:"custom_field4"` CustomField5 CustomField `json:"custom_field5"` CustomField6 CustomField `json:"custom_field6"` CustomField7 CustomField `json:"custom_field7"` CustomField8 CustomField `json:"custom_field8"` CustomField9 CustomField `json:"custom_field9"` }
Password represents a password from the team password manager API
func (*Password) UnmarshalJSON ¶
UnmarshalJSON handles id's from team password manager as int and string
type Passwords ¶
type Passwords []Password
Passwords is a collection of team password manager Password types
func (*Passwords) UnmarshalJSON ¶
UnmarshalJSON handles id's from team password manager as int and string
type Project ¶
type Project struct { ID string `json:"id"` ParentID int `json:"parent_id"` Name string `json:"name"` Notes string `json:"notes"` Tags string `json:"tags"` Archived bool `json:"archived"` Favorite bool `json:"favorite"` NumFiles int `json:"num_files"` CreatedOn string `json:"created_on"` CreatedBy User `json:"created_by"` UpdatedOn string `json:"updated_on"` UpdatedBy User `json:"updated_by"` ManagedBy User `json:"managed_by"` }
Project represents a team password manager Project
func (*Project) UnmarshalJSON ¶
UnmarshalJSON handles id's from team password manager as int and string
type Projects ¶
type Projects []Project
Projects is a collection of team password manager Project types
func (*Projects) UnmarshalJSON ¶
UnmarshalJSON handles id's from team password manager as int and string
type TpmClient ¶
type TpmClient struct { Client *http.Client Server string Username string Password string ContentType string UserAgent string }
TpmClient represents the client that handles all interaction with the server
func New ¶
New creates a new instance of TpmClient which can then be used to make api calls It configures the underlying net/http.client with a sensible timeout.
func (*TpmClient) GeneratePassword ¶
func (client *TpmClient) GeneratePassword() (*GeneratedPassword, error)
GeneratePassword uses the team password manager API to generate a random password
func (*TpmClient) PasswordGet ¶
PasswordGet fetches a single password by ID from the API
func (*TpmClient) PasswordList ¶
PasswordList retrieves a list of password matching the given search from the API
func (*TpmClient) ProjectArchive ¶
ProjectArchive archives a project
func (*TpmClient) ProjectDelete ¶
ProjectDelete removes a project
func (*TpmClient) ProjectGet ¶
ProjectGet fetches a single project by ID from the API
func (*TpmClient) ProjectList ¶
ProjectList retrieves a list of projects from the API
func (*TpmClient) ProjectUnarchive ¶
ProjectUnarchive unarchives a project
func (*TpmClient) Version ¶
func (client *TpmClient) Version() (*APIVersion, error)
Version fetches the team password manager server verison. It returns a struct APIVersion and any error encountered