resources

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IHasName

type IHasName interface {
	GetName() string
	SetName(string)
}

type IHasSpace

type IHasSpace interface {
	GetSpaceID() string
	SetSpaceID(string)
}

type IResource

type IResource interface {
	GetID() string
	GetModifiedBy() string
	GetModifiedOn() *time.Time
	GetLinks() map[string]string
	SetID(string)
	SetLinks(map[string]string)
	SetModifiedBy(string)
	SetModifiedOn(*time.Time)
	Validate() error
}

IResource defines the interface for resources.

type IResources added in v2.3.0

type IResources[T any] interface {
	GetNextPage(client *sling.Sling) (*Resources[T], error)
	GetAllPages(client *sling.Sling) ([]T, error)
}
type Links struct {
	Self        string `json:"Self"`
	Template    string `json:"Template"`
	PageAll     string `json:"Page.All"`
	PageCurrent string `json:"Page.Current"`
	PageLast    string `json:"Page.Last"`
	PageNext    string `json:"Page.Next"`
}

type PagedResults

type PagedResults struct {
	ItemsPerPage   int    `json:"ItemsPerPage"`
	ItemType       string `json:"ItemType"`
	LastPageNumber int    `json:"LastPageNumber"`
	Links          Links  `json:"Links"`
	NumberOfPages  int    `json:"NumberOfPages"`
	TotalResults   int    `json:"TotalResults"`
}

type ProcessReferenceDataItem

type ProcessReferenceDataItem struct {
	ID          string `json:"Id,omitempty"`
	Name        string `json:"Name,omitempty"`
	ProcessType string `json:"ProcessType,omitempty"`
}

type ReferenceDataItem

type ReferenceDataItem struct {
	ID   string `json:"Id,omitempty"`
	Name string `json:"Name,omitempty"`
}

type Resource

type Resource struct {
	ID         string            `json:"Id,omitempty"`
	ModifiedBy string            `json:"LastModifiedBy,omitempty"`
	ModifiedOn *time.Time        `json:"LastModifiedOn,omitempty"`
	Links      map[string]string `json:"Links,omitempty"`
}

func NewResource

func NewResource() *Resource

func (*Resource) GetID

func (r *Resource) GetID() string

GetID returns the ID value of the resource.

func (r *Resource) GetLinks() map[string]string

GetLinks returns the associated links with the value of this resource.

func (*Resource) GetModifiedBy

func (r *Resource) GetModifiedBy() string

GetModifiedBy returns the name of the account that modified the value of this resource.

func (*Resource) GetModifiedOn

func (r *Resource) GetModifiedOn() *time.Time

GetModifiedOn returns the time when the value of this resource was changed.

func (*Resource) SetID

func (r *Resource) SetID(id string)

SetID sets the ID value of the resource.

func (r *Resource) SetLinks(links map[string]string)

SetLinks sets the associated links with the value of this resource.

func (*Resource) SetModifiedBy

func (r *Resource) SetModifiedBy(modifiedBy string)

SetModifiedBy set the name of the account that modified the value of this resource.

func (*Resource) SetModifiedOn

func (r *Resource) SetModifiedOn(modifiedOn *time.Time)

SetModifiedOn set the time when the value of this resource was changed.

func (*Resource) Validate

func (r *Resource) Validate() error

Validate checks the state of the resource and returns an error if invalid.

type Resources

type Resources[T any] struct {
	Items []T `json:"Items"`
	PagedResults
}

func (*Resources[T]) GetAllPages added in v2.3.0

func (r *Resources[T]) GetAllPages(client *sling.Sling) ([]T, error)

GetAllPages will retrive all remaining next pages in the link collection and return the result as list of concatenated Items; Including the items from the base Resource.

func (*Resources[T]) GetNextPage added in v2.3.0

func (r *Resources[T]) GetNextPage(client *sling.Sling) (*Resources[T], error)

GetNextPage retrives the next page from the links collection. If no next page exists it will return nill

Jump to

Keyboard shortcuts

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