onepassword

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 5 Imported by: 28

Documentation

Index

Constants

View Source
const (
	Login                ItemCategory = "LOGIN"
	Password             ItemCategory = "PASSWORD"
	ApiCredential        ItemCategory = "API_CREDENTIAL"
	Server               ItemCategory = "SERVER"
	Database             ItemCategory = "DATABASE"
	CreditCard           ItemCategory = "CREDIT_CARD"
	Membership           ItemCategory = "MEMBERSHIP"
	Passport             ItemCategory = "PASSPORT"
	SoftwareLicense      ItemCategory = "SOFTWARE_LICENSE"
	OutdoorLicense       ItemCategory = "OUTDOOR_LICENSE"
	SecureNote           ItemCategory = "SECURE_NOTE"
	WirelessRouter       ItemCategory = "WIRELESS_ROUTER"
	BankAccount          ItemCategory = "BANK_ACCOUNT"
	DriverLicense        ItemCategory = "DRIVER_LICENSE"
	Identity             ItemCategory = "IDENTITY"
	RewardProgram        ItemCategory = "REWARD_PROGRAM"
	Document             ItemCategory = "DOCUMENT"
	EmailAccount         ItemCategory = "EMAIL_ACCOUNT"
	SocialSecurityNumber ItemCategory = "SOCIAL_SECURITY_NUMBER"
	MedicalRecord        ItemCategory = "MEDICAL_RECORD"
	SSHKey               ItemCategory = "SSH_KEY"
	Custom               ItemCategory = "CUSTOM"

	FieldPurposeUsername ItemFieldPurpose = "USERNAME"
	FieldPurposePassword ItemFieldPurpose = "PASSWORD"
	FieldPurposeNotes    ItemFieldPurpose = "NOTES"

	FieldTypeAddress          ItemFieldType = "ADDRESS"
	FieldTypeConcealed        ItemFieldType = "CONCEALED"
	FieldTypeCreditCardNumber ItemFieldType = "CREDIT_CARD_NUMBER"
	FieldTypeCreditCardType   ItemFieldType = "CREDIT_CARD_TYPE"
	FieldTypeDate             ItemFieldType = "DATE"
	FieldTypeEmail            ItemFieldType = "EMAIL"
	FieldTypeGender           ItemFieldType = "GENDER"
	FieldTypeMenu             ItemFieldType = "MENU"
	FieldTypeMonthYear        ItemFieldType = "MONTH_YEAR"
	FieldTypeOTP              ItemFieldType = "OTP"
	FieldTypePhone            ItemFieldType = "PHONE"
	FieldTypeReference        ItemFieldType = "REFERENCE"
	FieldTypeString           ItemFieldType = "STRING"
	FieldTypeURL              ItemFieldType = "URL"
	FieldTypeFile             ItemFieldType = "FILE"
	FieldTypeSSHKey           ItemFieldType = "SSH_KEY"
	FieldTypeUnknown          ItemFieldType = "UNKNOWN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error added in v1.2.0

type Error struct {
	StatusCode int    `json:"status"`
	Message    string `json:"message"`
}

Error is an error returned by the Connect API.

func (*Error) Error added in v1.2.0

func (e *Error) Error() string

func (*Error) Is added in v1.2.0

func (e *Error) Is(target error) bool

type File added in v1.2.0

type File struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Section     *ItemSection `json:"section,omitempty"`
	Size        int          `json:"size"`
	ContentPath string       `json:"content_path"`
	// contains filtered or unexported fields
}

func (*File) Content added in v1.2.0

func (f *File) Content() ([]byte, error)

Content returns the content of the file if they have been loaded and returns an error if they have not been loaded. Use `client.GetFileContent(file *File)` instead to make sure the content is fetched automatically if not present.

func (*File) SetContent added in v1.2.0

func (f *File) SetContent(content []byte)

func (*File) UnmarshalJSON added in v1.2.0

func (f *File) UnmarshalJSON(data []byte) error

type GeneratorRecipe

type GeneratorRecipe struct {
	Length            int      `json:"length,omitempty"`
	CharacterSets     []string `json:"characterSets,omitempty"`
	ExcludeCharacters string   `json:"excludeCharacters,omitempty"`
}

GeneratorRecipe Representation of a "recipe" used to generate a field

type Item

type Item struct {
	ID    string `json:"id"`
	Title string `json:"title"`

	URLs     []ItemURL `json:"urls,omitempty"`
	Favorite bool      `json:"favorite,omitempty"`
	Tags     []string  `json:"tags,omitempty"`
	Version  int       `json:"version,omitempty"`

	Vault    ItemVault    `json:"vault"`
	Category ItemCategory `json:"category,omitempty"` // TODO: switch this to `category`

	Sections []*ItemSection `json:"sections,omitempty"`
	Fields   []*ItemField   `json:"fields,omitempty"`
	Files    []*File        `json:"files,omitempty"`

	LastEditedBy string    `json:"lastEditedBy,omitempty"`
	CreatedAt    time.Time `json:"createdAt,omitempty"`
	UpdatedAt    time.Time `json:"updatedAt,omitempty"`

	// Deprecated: Connect does not return trashed items.
	Trashed bool `json:"trashed,omitempty"`
}

Item represents an item returned to the consumer

func (*Item) GetValue

func (i *Item) GetValue(field string) string

GetValue Retrieve the value of a field on the item by its label. To specify a field from a specific section pass in <section label>.<field label>. If no field matching the selector is found return "".

func (*Item) SectionLabelForID

func (i *Item) SectionLabelForID(id string) string

type ItemCategory

type ItemCategory string

ItemCategory Represents the template of the Item

func (*ItemCategory) UnmarshalJSON

func (ic *ItemCategory) UnmarshalJSON(b []byte) error

UnmarshalJSON Unmarshall Item Category enum strings to Go string enums

type ItemField

type ItemField struct {
	ID       string           `json:"id"`
	Section  *ItemSection     `json:"section,omitempty"`
	Type     ItemFieldType    `json:"type"`
	Purpose  ItemFieldPurpose `json:"purpose,omitempty"`
	Label    string           `json:"label,omitempty"`
	Value    string           `json:"value,omitempty"`
	Generate bool             `json:"generate,omitempty"`
	Recipe   *GeneratorRecipe `json:"recipe,omitempty"`
	Entropy  float64          `json:"entropy,omitempty"`
	TOTP     string           `json:"totp,omitempty"`
}

ItemField Representation of a single field on an Item

type ItemFieldPurpose added in v1.5.1

type ItemFieldPurpose string

type ItemFieldType added in v1.5.1

type ItemFieldType string

type ItemSection

type ItemSection struct {
	ID    string `json:"id,omitempty"`
	Label string `json:"label,omitempty"`
}

ItemSection Representation of a Section on an item

type ItemURL

type ItemURL struct {
	Primary bool   `json:"primary,omitempty"`
	Label   string `json:"label,omitempty"`
	URL     string `json:"href"`
}

ItemURL is a simplified item URL

type ItemVault

type ItemVault struct {
	ID string `json:"id"`
}

ItemVault represents the Vault the Item is found in

type Vault

type Vault struct {
	ID          string `json:"id"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`

	AttrVersion    int       `json:"attributeVersion,omitempty"`
	ContentVersion int       `json:"contentVersion,omitempty"`
	Items          int       `json:"items,omitempty"`
	Type           VaultType `json:"type,omitempty"`

	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

Vault represents a 1password Vault

type VaultType

type VaultType string

VaultType Representation of what the Vault Type is

const (
	PersonalVault    VaultType = "PERSONAL"
	EveryoneVault    VaultType = "EVERYONE"
	TransferVault    VaultType = "TRANSFER"
	UserCreatedVault VaultType = "USER_CREATED"
	UnknownVault     VaultType = "UNKNOWN"
)

func (*VaultType) UnmarshalJSON

func (vt *VaultType) UnmarshalJSON(b []byte) error

UnmarshalJSON Unmarshall Vault Type enum strings to Go string enums

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL