client

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 7 Imported by: 8

Documentation

Index

Constants

View Source
const EndpointACL = "sys_security_acl.do"

EndointACL is the endpoint to manage ACL records.

View Source
const EndpointApplication = "sys_app.do"

EndpointApplication is the endpoint to manage application records.

View Source
const EndpointApplicationCategory = "sys_app_category.do"

EndpointApplicationCategory is the endpoint to manage application category records.

View Source
const EndpointApplicationMenu = "sys_app_application.do"

EndpointApplicationMenu is the endpoint to manage application menu records.

View Source
const EndpointApplicationModule = "sys_app_module.do"

EndpointApplicationModule is the endpoint to manage application modules records.

View Source
const EndpointCSSInclude = "sp_css_include.do"

EndpointCSSInclude is the endpoint to manage CSS includes records.

View Source
const EndpointCSSIncludeRelation = "m2m_sp_dependency_css_include.do"

EndpointCSSIncludeRelation is the endpoint to manage CSS include relation records.

View Source
const EndpointContentCSS = "content_css.do"

EndpointContentCSS is the endpoint to manage content css records.

View Source
const EndpointDBTable = "sys_db_object.do"

EndpointDBTable is the endpoint to manage DB Table records.

View Source
const EndpointExtensionPoint = "sys_extension_point.do"

EndpointExtensionPoint is the endpoint to manage Extension Point records.

View Source
const EndpointJsInclude = "sp_js_include.do"

EndpointJsInclude is the endpoint to manage JS Include records.

View Source
const EndpointJsIncludeRelation = "m2m_sp_dependency_js_include.do"

EndpointJsIncludeRelation is the endpoint to manage JS Include Relation records.

View Source
const EndpointOAuthEntity = "oauth_entity.do"

EndpointOAuthEntity is the endpoint to manage oauth entity records.

View Source
const EndpointRestMessage = "sys_rest_message.do"

EndpointRestMessage is the endpoint to manage REST message records.

View Source
const EndpointRestMessageHeader = "sys_rest_message_headers.do"

EndpointRestMessageHeader is the endpoint to manage REST message header records.

View Source
const EndpointRestMethod = "sys_rest_message_fn.do"

EndpointRestMethod is the endpoint to manage REST message method records.

View Source
const EndpointRestMethodHeader = "sys_rest_message_fn_headers.do"

EndpointRestMethodHeader is the endpoint to manage REST Message method header records.

View Source
const EndpointRole = "sys_user_role.do"

EndpointRole is the endpoint to manage role records.

View Source
const EndpointScriptInclude = "sys_script_include.do"

EndpointScriptInclude is the endpoint to manage script include records.

View Source
const EndpointScriptedRestApi = "sys_ws_definition.do"

EndpointScriptedRestApi is the endpoint to manage Scripted Rest Api records.

View Source
const EndpointScriptedRestResource = "sys_ws_operation.do"

EndpointScriptedRestResource is the endpoint to manage Scripted Rest Resources records.

View Source
const EndpointSystemProperty = "sys_properties.do"

EndpointSystemProperty is the endpoint to manage system property records.

View Source
const EndpointSystemPropertyCategory = "sys_properties_category.do"

EndpointSystemPropertyCategory is the endpoint to manage system property categories records.

View Source
const EndpointSystemPropertyRelation = "sys_properties_category_m2m.do"

EndpointSystemPropertyRelation is the endpoint to manage system property category relation records.

View Source
const EndpointUIMacro = "sys_ui_macro.do"

EndpointUIMacro is the endpoint to manage UI Macro records.

View Source
const EndpointUIPage = "sys_ui_page.do"

EndpointUIPage is the endpoint to manage UI Pages records.

View Source
const EndpointUIScript = "sys_ui_script.do"

EndpointUIScript is the endpoint to manage UI Script records.

View Source
const EndpointWidget = "sp_widget.do"

EndpointWidget is the endpoint to manage widget records.

View Source
const EndpointWidgetDependency = "sp_dependency.do"

EndpointWidgetDependency is the endpoint to manage widget dependency records.

View Source
const EndpointWidgetDependencyRelation = "m2m_sp_widget_dependency.do"

EndpointWidgetDependencyRelation is the endpoint to manage widget dependency relation records.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL added in v0.9.1

type ACL struct {
	BaseResult
	Type           string `json:"type"`
	Operation      string `json:"operation"`
	AdminOverrides bool   `json:"admin_overrides,string"`
	Name           string `json:"name"`
	Description    string `json:"description,omitempty"`
	Active         bool   `json:"active,string"`
	Advanced       bool   `json:"advanced,string"`
	Condition      string `json:"condition,omitempty"`
	Script         string `json:"script,omitempty"`
}

ACL is the json response for an ACL in ServiceNow.

type Application added in v0.4.0

type Application struct {
	BaseResult
	Name    string `json:"name"`
	Scope   string `json:"scope"`
	Version string `json:"version"`
}

Application is the json response for an application in ServiceNow.

type ApplicationCategory added in v0.6.0

type ApplicationCategory struct {
	BaseResult
	Name  string `json:"name"`
	Order string `json:"default_order"`
	Style string `json:"style"`
}

ApplicationCategory represents the json response for a Application Category in ServiceNow.

type ApplicationMenu added in v0.3.0

type ApplicationMenu struct {
	BaseResult
	Title       string `json:"title"`
	Description string `json:"description"`
	Hint        string `json:"hint"`
	DeviceType  string `json:"device_type"`
	Order       int    `json:"order,string"`
	Roles       string `json:"roles"`
	CategoryID  string `json:"category"`
	Active      bool   `json:"active,string"`
}

ApplicationMenu is the json response for an application menu in ServiceNow.

type ApplicationModule added in v0.3.0

type ApplicationModule struct {
	BaseResult
	Title             string `json:"title"`
	MenuID            string `json:"application"`
	Hint              string `json:"hint"`
	Order             int    `json:"order,string"`
	Roles             string `json:"roles"`
	Active            bool   `json:"active,string"`
	OverrideMenuRoles bool   `json:"override_menu_roles,string"`
	LinkType          string `json:"link_type"`
	Arguments         string `json:"query"`
	WindowName        string `json:"window_name"`
	TableName         string `json:"name"`
}

ApplicationModule is the json response for an application menu in ServiceNow.

type BaseResult added in v0.2.0

type BaseResult struct {
	ID               string       `json:"sys_id,omitempty"`
	ProtectionPolicy string       `json:"sys_policy,omitempty"`
	Scope            string       `json:"sys_scope,omitempty"`
	Status           string       `json:"__status,omitempty"`
	Error            *ErrorDetail `json:"__error,omitempty"`
}

BaseResult is representing the default properties of all results.

func (BaseResult) GetError added in v0.6.0

func (record BaseResult) GetError() *ErrorDetail

GetError returns the Error of a BaseRecord, if any.

func (BaseResult) GetID added in v0.6.0

func (record BaseResult) GetID() string

GetID returns the ID of a BaseRecord.

func (BaseResult) GetScope added in v0.6.0

func (record BaseResult) GetScope() string

GetScope returns the Scope of a BaseRecord.

func (BaseResult) GetStatus added in v0.6.0

func (record BaseResult) GetStatus() string

GetStatus returns the Status of a BaseRecord.

type BaseResultList added in v0.6.0

type BaseResultList struct {
	Records []json.RawMessage
}

BaseResultList represents the response from the API. Records are always returned inside an array.

type CSSInclude added in v0.6.0

type CSSInclude struct {
	BaseResult
	Source       string `json:"source"`
	Name         string `json:"name"`
	URL          string `json:"url"`
	StyleSheetID string `json:"sp_css"`
}

CSSInclude represents the json response for a CSS Include in ServiceNow.

type CSSIncludeRelation added in v0.6.0

type CSSIncludeRelation struct {
	BaseResult
	CSSIncludeID string `json:"sp_css_include"`
	DependencyID string `json:"sp_dependency"`
	Order        int    `json:"order,string"`
}

CSSIncludeRelation represents the json response for a CssIncludeRelation in ServiceNow.

type Client added in v0.8.0

type Client struct {
	BaseURL string
	Auth    string
}

Client is the client used to interact with ServiceNow API.

func NewClient

func NewClient(baseURL string, username string, password string) *Client

NewClient is a factory method used to return a new ServiceNowClient.

func (*Client) CreateObject added in v0.8.0

func (client *Client) CreateObject(endpoint string, objectToCreate Record) error

CreateObject creates a new object in ServiceNow, validates the response and fills the object with properties received from the service.

func (*Client) DeleteObject added in v0.8.0

func (client *Client) DeleteObject(endpoint string, id string) error

DeleteObject deletes an object using a specific endpoing and sys_id.

func (*Client) GetObject added in v0.8.0

func (client *Client) GetObject(endpoint string, id string, responseObjectOut Record) error

GetObject retrieves an object via a specific endpoint with a GET method and a specified sys_id. The response is parsed and fills the object in parameters. responseObjectOut parameter must be a pointer.

func (*Client) GetObjectByName added in v0.8.0

func (client *Client) GetObjectByName(endpoint string, name string, responseObjectOut Record) error

GetObjectByName retrieves an object via its name attribute.

func (*Client) UpdateObject added in v0.8.0

func (client *Client) UpdateObject(endpoint string, object Record) error

UpdateObject updates an object using a specific endpoint, sys_id and object data.

type ContentCSS added in v0.6.0

type ContentCSS struct {
	BaseResult
	Name  string `json:"name"`
	Type  string `json:"type"`
	URL   string `json:"url"`
	Style string `json:"style"`
}

ContentCSS represents the json response for a Content Management Style Sheet in ServiceNow.

type DBTable added in v0.5.1

type DBTable struct {
	BaseResult
	Label                string `json:"label"`
	UserRole             string `json:"user_role"`
	Access               string `json:"access"`
	ReadAccess           bool   `json:"read_access,string"`
	CreateAccess         bool   `json:"create_access,string"`
	AlterAccess          bool   `json:"alter_access,string"`
	DeleteAccess         bool   `json:"delete_access,string"`
	WebServiceAccess     bool   `json:"ws_access,string"`
	ConfigurationAccess  bool   `json:"configuration_access,string"`
	Extendable           bool   `json:"is_extendable,string"`
	LiveFeed             bool   `json:"live_feed_enabled,string"`
	CreateAccessControls bool   `json:"create_access_controls,string"`
	CreateModule         bool   `json:"create_module,string"`
	CreateMobileModule   bool   `json:"create_mobile_module,string"`
	Name                 string `json:"name,omitempty"`
}

DBTable is the json response for a Table in ServiceNow.

type ErrorDetail

type ErrorDetail struct {
	Reason  string `json:"reason"`
	Message string `json:"message"`
}

ErrorDetail is the details of an error. Should be included in the json if status is not success.

type ExtensionPoint added in v0.8.0

type ExtensionPoint struct {
	BaseResult
	Name          string `json:"name"`
	RestrictScope bool   `json:"restrict_scope,string"`
	Description   string `json:"description"`
	Example       string `json:"example"`
	APIName       string `json:"api_name,omitempty"`
}

ExtensionPoint represents the json response for a Extension Point in ServiceNow.

type JsInclude added in v0.2.0

type JsInclude struct {
	BaseResult
	Source      string `json:"source"`
	DisplayName string `json:"display_name"`
	URL         string `json:"url"`
	UIScriptID  string `json:"sys_ui_script"`
}

JsInclude represents the json response for a Js Include in ServiceNow.

type JsIncludeRelation added in v0.2.0

type JsIncludeRelation struct {
	BaseResult
	JsIncludeID  string `json:"sp_js_include"`
	DependencyID string `json:"sp_dependency"`
	Order        int    `json:"order,string"`
}

JsIncludeRelation represents the json response for a JsIncludeRelation in ServiceNow.

type OAuthEntity added in v0.6.0

type OAuthEntity struct {
	BaseResult
	Name                 string `json:"name"`
	ClientUUID           string `json:"client_uuid,omitempty"`
	ClientID             string `json:"client_id,omitempty"`
	AccessTokenLifespan  int    `json:"access_token_lifespan,string"`
	RefreshTokenLifespan int    `json:"refresh_token_lifespan,string"`
	RedirectURL          string `json:"redirect_url"`
	LogoURL              string `json:"logo_url"`
	Access               string `json:"access"`
}

OAuthEntity is the json response for a OAuthEntity in ServiceNow.

type Record added in v0.6.0

type Record interface {
	GetID() string
	GetScope() string
	GetStatus() string
	GetError() *ErrorDetail
}

Record is the interface for any BaseResult.

type RestMessage added in v0.6.0

type RestMessage struct {
	BaseResult
	Name               string `json:"name"`
	Description        string `json:"description"`
	RestEndpoint       string `json:"rest_endpoint"`
	Access             string `json:"access"`
	AuthenticationType string `json:"authentication_type"`
}

RestMessage represents the json response for a REST Message in ServiceNow.

type RestMessageHeader added in v0.6.0

type RestMessageHeader struct {
	BaseResult
	Name      string `json:"name"`
	Value     string `json:"value"`
	MessageID string `json:"rest_message"`
}

RestMessageHeader represents the json response for a HTTP header in ServiceNow.

type RestMethod added in v0.6.0

type RestMethod struct {
	BaseResult
	Name               string `json:"function_name"`
	MessageID          string `json:"rest_message"`
	HTTPMethod         string `json:"http_method"`
	RestEndpoint       string `json:"rest_endpoint"`
	AuthenticationType string `json:"authentication_type"`
	QualifiedName      string `json:"qualified_name,omitempty"`
}

RestMethod represents the json response for a HTTP method in ServiceNow.

type RestMethodHeader added in v0.6.0

type RestMethodHeader struct {
	BaseResult
	Name     string `json:"name"`
	Value    string `json:"value"`
	MethodID string `json:"rest_message_function"`
}

RestMethodHeader represents the json response for a HTTP header in ServiceNow.

type Role added in v0.3.0

type Role struct {
	BaseResult
	Name              string `json:"name,omitempty"`
	Description       string `json:"description"`
	ElevatedPrivilege bool   `json:"elevated_privilege,string"`
	Suffix            string `json:"suffix"`
	AssignableBy      string `json:"assignable_by"`
}

Role is the json response for a role in ServiceNow.

type ScriptInclude added in v0.4.0

type ScriptInclude struct {
	BaseResult
	Name           string `json:"name"`
	ClientCallable bool   `json:"client_callable,string"`
	Description    string `json:"description"`
	Script         string `json:"script"`
	Active         bool   `json:"active,string"`
	Access         string `json:"access"`
	APIName        string `json:"api_name,omitempty"`
}

ScriptInclude is the json response for a Script Include in ServiceNow.

type ScriptedRestApi added in v0.9.1

type ScriptedRestApi struct {
	BaseResult
	Active             bool   `json:"active,string"`
	Consumes           string `json:"consumes,omitempty"`
	ConsumesCustomized bool   `json:"consumes_customized,string"`
	EnforceACL         string `json:"enforce_acl,omitempty"`
	Name               string `json:"name"`
	Produces           string `json:"produces,omitempty"`
	ProducesCustomized bool   `json:"produces_customized,string"`
	ServiceId          string `json:"service_id,omitempty"`
	BaseURI            string `json:"base_uri,omitempty"`
	Namespace          string `json:"namespace,omitempty"`
	DocLink            string `json:"doc_link,omitempty"`
	ShortDescription   string `json:"short_description,omitempty"`
}

EndpointScriptedRestApi is the json response for a Scripted Rest Api in ServiceNow.

type ScriptedRestResource added in v0.9.1

type ScriptedRestResource struct {
	BaseResult
	Name                     string `json:"name"`
	Active                   bool   `json:"active,string"`
	EnforceACL               string `json:"enforce_acl,omitempty"`
	RequiresACLAuthorization bool   `json:"requires_acl_authorization,string"`
	RequiresAuthentication   bool   `json:"requires_authentication,string"`
	RequiresSNCInternalRole  bool   `json:"requires_snc_internal_role,string"`
	Produces                 string `json:"produces,omitempty"`
	ProducesCustomized       bool   `json:"produces_customized,string"`
	ShortDescription         string `json:"short_description,omitempty"`
	OperationScript          string `json:"operation_script"`
	RelativePath             string `json:"relative_path,omitempty"`
	RequestExample           string `json:"request_example,omitempty"`
	HTTPMethod               string `json:"http_method"`
	Consumes                 string `json:"consumes,omitempty"`
	ConsumesCustomized       bool   `json:"consumes_customized,string"`
	OperationURI             string `json:"operation_uri,omitempty"`
	WebServiceDefinition     string `json:"web_service_definition,omitempty"`
	WebServiceVersion        string `json:"web_service_version,omitempty"`
}

EndpointScriptedRestResource is the json response for a Scripted Rest Resources in ServiceNow.

type ServiceNowClient

type ServiceNowClient interface {
	GetObject(string, string, Record) error
	GetObjectByName(string, string, Record) error
	CreateObject(string, Record) error
	UpdateObject(string, Record) error
	DeleteObject(string, string) error
}

ServiceNowClient defines possible methods to call on the ServiceNowClient.

type SystemProperty added in v0.6.0

type SystemProperty struct {
	BaseResult
	Suffix      string `json:"suffix"`
	Type        string `json:"type"`
	Choices     string `json:"choices"`
	IsPrivate   bool   `json:"is_private,string"`
	IgnoreCache bool   `json:"ignore_cache,string"`
	Description string `json:"description"`
	WriteRoles  string `json:"write_roles"`
	ReadRoles   string `json:"read_roles"`
	Name        string `json:"name,omitempty"`
	Value       string `json:"value,omitempty"`
}

SystemProperty is the json response for a system property in ServiceNow.

type SystemPropertyCategory added in v0.6.0

type SystemPropertyCategory struct {
	BaseResult
	Name      string `json:"name"`
	TitleHTML string `json:"title"`
}

SystemPropertyCategory is the json response for a system property in ServiceNow.

type SystemPropertyRelation added in v0.6.0

type SystemPropertyRelation struct {
	BaseResult
	CategoryID string `json:"category"`
	PropertyID string `json:"property"`
	Order      string `json:"order,omitempty"`
}

SystemPropertyRelation is the json response for a system property relation in ServiceNow.

type UIMacro added in v0.6.0

type UIMacro struct {
	BaseResult
	Name        string `json:"name"`
	Description string `json:"description"`
	APIName     string `json:"scoped_name"`
	XML         string `json:"xml"`
	Active      bool   `json:"active,string"`
}

UIMacro is the json response for a UI Macro in ServiceNow.

type UIPage added in v0.6.0

type UIPage struct {
	BaseResult
	Name             string `json:"name"`
	Description      string `json:"description"`
	Direct           bool   `json:"direct,string"`
	HTML             string `json:"html"`
	ProcessingScript string `json:"processing_script"`
	ClientScript     string `json:"client_script"`
	Category         string `json:"category"`
	Endpoint         string `json:"endpoint,omitempty"`
}

UIPage is the json response for a UI page in ServiceNow.

type UIScript added in v0.7.0

type UIScript struct {
	BaseResult
	Name        string `json:"script_name"`
	APIName     string `json:"name,omitempty"`
	Description string `json:"description"`
	Script      string `json:"script"`
	Active      bool   `json:"active,string"`
	UIType      string `json:"ui_type"` // All: 10, Mobile: 1, Desktop 0
}

UIScript is the json response for a UI Script in ServiceNow.

type Widget added in v0.2.0

type Widget struct {
	BaseResult
	CustomID     string `json:"id"`
	Name         string `json:"name"`
	Template     string `json:"template"`
	CSS          string `json:"css"`
	Public       bool   `json:"public,string"`
	Roles        string `json:"roles"`
	Link         string `json:"link"`
	Description  string `json:"description"`
	ClientScript string `json:"client_script"`
	ServerScript string `json:"script"`
	DemoData     string `json:"demo_data"`
	OptionSchema string `json:"option_schema"`
	HasPreview   bool   `json:"has_preview,string"`
	DataTable    string `json:"data_table"`
	ControllerAs string `json:"controller_as"`
}

Widget is the json response for a Widget in ServiceNow.

type WidgetDependency added in v0.2.0

type WidgetDependency struct {
	BaseResult
	Name     string `json:"name"`
	Module   string `json:"module"`
	PageLoad bool   `json:"page_load,string"`
}

WidgetDependency represents the json response for a Widget Dependency in ServiceNow.

type WidgetDependencyRelation added in v0.2.0

type WidgetDependencyRelation struct {
	BaseResult
	DependencyID string `json:"sp_dependency"`
	WidgetID     string `json:"sp_widget"`
}

WidgetDependencyRelation represents the json response for a widget dependency relation in ServiceNow.

Jump to

Keyboard shortcuts

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