Documentation ¶
Index ¶
- Variables
- func AFTER(str string) string
- func AND() string
- func ATORAFTER(str string) string
- func ATORBEFORE(str string) string
- func BEFORE(str string) string
- func BETWEEN(str string) string
- func DisableLogger()
- func Filter(str string) string
- func GetWriter() io.Writer
- func IS(str string) string
- func ISANYTHING() string
- func ISBETWEEN(str1, str2 string) string
- func ISDIFFERENTFROM(str string) string
- func ISEMPTY() string
- func ISGREATERTHAN(str string) string
- func ISGREATERTHANOREQUALS(str string) string
- func ISLESSTHAN(str string) string
- func ISLESSTHANOREQUALS(str string) string
- func ISLIKE(str string) string
- func ISNOT(str string) string
- func ISNOTEMPTY() string
- func ISNOTLIKE(str string) string
- func ISNOTONEOF(str ...string) string
- func ISONEOF(str ...string) string
- func ISSAMEAS(str string) string
- func Item(str ...string) (total string)
- func LESSTHAN(str string) string
- func MORETHAN(str string) string
- func NOTON(str string) string
- func NewInvalidResource(msg string) error
- func NewMissingParameter(msg string) error
- func ON(str string) string
- func OR() string
- func ORDERBY(str string) string
- func ORDERBYDESC(str string) string
- func SetLogOutput(writer io.Writer)
- type Attachment
- func (A Attachment) Delete(sys_id string) (Response, error)
- func (A Attachment) Download(sys_id string, destinationPath string) (Response, error)
- func (A Attachment) Get(sys_id string, limit int) (Response, error)
- func (A Attachment) GetTicket(sys_id string, limit int) (Response, error)
- func (A Attachment) Upload(sys_id, file_path string, multipart bool) (Response, error)
- type Client
- type InvalidResource
- type MissingClientID
- type MissingParameter
- type OauthClient
- type ParamsBuilder
- type ReponseError
- type Request
- type Resource
- func (R Resource) Create(args map[string]string) (resp Response, err error)
- func (R Resource) Delete(query interface{}) (Response, error)
- func (R Resource) Get(query interface{}, limits int, offset int, stream bool, fields ...interface{}) (resp Response, err error)
- func (R Resource) String() string
- func (R Resource) Update(query interface{}, args map[string]string) (resp Response, err error)
- type Response
- type ServiceCatalog
- type ServiceCatalogError
Constants ¶
This section is empty.
Variables ¶
var (
HASMAGIC = false
)
HASMAGIC if the attachment has magic currently not in use
Functions ¶
func ISGREATERTHANOREQUALS ¶
ISGREATERTHANOREQUALS is obvious
func NewInvalidResource ¶
func NewMissingParameter ¶
func SetLogOutput ¶
SetLogOutput used to change where the logger writes to
Types ¶
type Attachment ¶
type Attachment struct { TableName string // contains filtered or unexported fields }
Attachment the ServiceNow Attachments API
func NewAttachment ¶
func NewAttachment(resource Resource, TableName string) (A Attachment)
NewAttachment returns new instance of the attachments API
func (Attachment) Delete ¶
func (A Attachment) Delete(sys_id string) (Response, error)
Delete delete a specific attachment by sys_id
func (Attachment) Download ¶
func (A Attachment) Download(sys_id string, destinationPath string) (Response, error)
Download download specified attachment to desintationPath from ServiceNow
func (Attachment) Get ¶
func (A Attachment) Get(sys_id string, limit int) (Response, error)
Get used to query a specific attachment
type Client ¶
type Client struct { Username string `validate:"required"` Instance string Use_ssl bool Session *grequests.Session BaseURL *url.URL // contains filtered or unexported fields }
Client used as main client for service-now
func (Client) Attachments ¶
func (C Client) Attachments() (Attachment, error)
Attachments returns a new instance of the Attachments API
func (Client) Resource ¶
Resource is used to create table resources Each new table that can be queried needs its own .Resource
func (Client) ServiceCatalog ¶
func (C Client) ServiceCatalog(apiPath string) (ServiceCatalog, error)
ServiceCatalog returns a new instance of the Service Catalog API
type InvalidResource ¶
type InvalidResource struct {
// contains filtered or unexported fields
}
func (InvalidResource) Error ¶
func (err InvalidResource) Error() string
type MissingClientID ¶
type MissingClientID struct { }
type MissingParameter ¶
type MissingParameter struct {
// contains filtered or unexported fields
}
func (MissingParameter) Error ¶
func (err MissingParameter) Error() string
type OauthClient ¶
type OauthClient struct {
// contains filtered or unexported fields
}
func NewOauth ¶
func NewOauth(clientId, clientSecret, tokenUpdater string) (O OauthClient, err error)
type ParamsBuilder ¶
type ParamsBuilder struct {
// contains filtered or unexported fields
}
ParamsBuilder representation of ServiceNow Parameter
func NewParamsBuilder ¶
func NewParamsBuilder() (P ParamsBuilder)
NewParamsBuilder returns new instance of builder for ServiceNow parameters
func (ParamsBuilder) AddCustom ¶
func (P ParamsBuilder) AddCustom(params map[string]interface{})
AddCustom used to add custom parameters
type ReponseError ¶
type ReponseError struct {
// contains filtered or unexported fields
}
func (ReponseError) Error ¶
func (err ReponseError) Error() string
type Request ¶
type Request struct { Session *grequests.Session URLBuilder *url.URL Chunk_size int Resource Resource ServiceCatalog ServiceCatalog Parameters ParamsBuilder // contains filtered or unexported fields }
Request used to preform requests against the ServiceNow APIs. Contains the querying URL and the parameters
func NewRequest ¶
func NewRequest(parameters ParamsBuilder, session *grequests.Session, url_builder *url.URL, chunk_size int, resource interface{}) (R Request)
NewRequest used to create a new serviceNow request
type Resource ¶
type Resource struct { Session *grequests.Session ChunkSize int Parameters ParamsBuilder // contains filtered or unexported fields }
Resource representations of the vague service now API api/now
func NewResource ¶
func NewResource(BaseURL *url.URL, BasePath, ApiPath string, session *grequests.Session, chunkSize int) (R Resource)
NewResource returns a new serviceNow API resource
func (Resource) Get ¶
func (R Resource) Get(query interface{}, limits int, offset int, stream bool, fields ...interface{}) (resp Response, err error)
Get used to fetch a record
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response a ServiceNow API response
func NewResponse ¶
func NewResponse(response *grequests.Response, chunk_size int, resource Resource, stream bool) (R Response)
NewResponse generates a response struct
type ServiceCatalog ¶
type ServiceCatalog struct { Session *grequests.Session ChunkSize int Parameters ParamsBuilder // contains filtered or unexported fields }
ServiceCatalog the service catalog API
func NewServiceCatalog ¶
func NewServiceCatalog(BaseURL *url.URL, BasePath, ApiPath string, session *grequests.Session, chunkSize int) (S ServiceCatalog)
NewServiceCatalog returns a new instance of the service catalog API
func (ServiceCatalog) Get ¶
func (S ServiceCatalog) Get(query interface{}) (resp Response, err error)
Get returns a response and an error
func (ServiceCatalog) String ¶
func (S ServiceCatalog) String() string
String returns a string representation of the path
type ServiceCatalogError ¶
type ServiceCatalogError struct {
// contains filtered or unexported fields
}
func (ServiceCatalogError) Error ¶
func (err ServiceCatalogError) Error() string