attachmentapi

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 9 Imported by: 0

README

Attachment API

The Attachment API provides endpoints that allow you to upload and query file attachments. You can upload or retrieve a single file with each request.

[GET] /now/attachment

Returns the metadata for multiple attachments.

package main

import (
    attachmentapi "github.com/michaeldcanady/servicenow-sdk-go/attachment-api"
)

func main() {
    
    //Implement credential and client.
    pathParameters := {
        "baseurl":"https://www.{instance}.service-now.com/api/now",
    }

    // Instantiate new TableItemRequestBuilder.
    requestBuilder := attachmentapi.NewAttachmentRequestBuilder(client, pathParameters)

    // Call the get method, with or without AttachmentRequestBuilderGetQueryParameters.
    // Response is a AttachmentCollectionResponse.
    response, err := requestBuilder.Get(nil)

    // Test err, should be nil
    if err != nil {
        panic(err)
    }
}

Documentation

Index

Constants

View Source
const (
	DateFormat     = "2006-01-02"
	TimeFormat     = "15:04:05"
	DateTimeFormat = DateFormat + " " + TimeFormat
)

Variables

View Source
var (
	ErrNilParams = errors.New("params cannot be nil")
)

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	TableSysId        string `json:"table_sys_id"` //nolint:stylecheck
	Size              Int    `json:"size_bytes"`
	DownloadLink      string `json:"download_link"`
	UpdatedOn         Time   `json:"sys_updated_on"`
	SysId             string `json:"sys_id"` //nolint:stylecheck
	ImageHeight       Int    `json:"image_height"`
	SysCreatedOn      Time   `json:"sys_created_on"`
	FileName          string `json:"file_name"`
	SysCreatedBy      string `json:"sys_created_by"`
	Compressed        Bool   `json:"compressed"`
	AverageImageColor string `json:"average_image_color"`
	SysUpdatedBy      string `json:"sys_updated_by"`
	SysTags           string `json:"sys_tags"`
	TableName         string `json:"table_name"`
	ImageWidth        Int    `json:"image_width"`
	SysModCount       Int    `json:"sys_mod_count"`
	ContentType       string `json:"content_type"`
	SizeCompressed    Int    `json:"size_compressed"`
}

type AttachmentCollectionFileRequestConfiguration

type AttachmentCollectionFileRequestConfiguration struct {
	Header          interface{}
	QueryParameters *AttachmentRequestBuilderFileQueryParameters
	Data            interface{}
	ErrorMapping    core.ErrorMapping
	// contains filtered or unexported fields
}

type AttachmentCollectionGetRequestConfiguration

type AttachmentCollectionGetRequestConfiguration struct {
	Header          interface{}
	QueryParameters *AttachmentRequestBuilderGetQueryParameters
	Data            interface{}
	ErrorMapping    core.ErrorMapping
	// contains filtered or unexported fields
}

type AttachmentCollectionResponse

type AttachmentCollectionResponse struct {
	Result []*Attachment
}

func (*AttachmentCollectionResponse) ParseHeaders

func (cR *AttachmentCollectionResponse) ParseHeaders(headers http.Header)

type AttachmentItemResponse

type AttachmentItemResponse struct {
	Result *Attachment
}

func (*AttachmentItemResponse) ParseHeaders

func (cR *AttachmentItemResponse) ParseHeaders(headers http.Header)

type AttachmentRequestBuilder

type AttachmentRequestBuilder struct {
	core.RequestBuilder
}

func NewAttachmentRequestBuilder

func NewAttachmentRequestBuilder(client core.Client, pathParameters map[string]string) *AttachmentRequestBuilder

func (*AttachmentRequestBuilder) File

File ...

func (*AttachmentRequestBuilder) Get

Get sends an HTTP GET request using the specified query parameters and returns a AttachmentCollectionResponse.

Parameters:

  • params: An instance of AttachmentRequestBuilderGetQueryParameters to include in the GET request.

Returns:

  • *AttachmentCollectionResponse: The response data as a AttachmentCollectionResponse.
  • error: An error if there was an issue with the request or response.

type AttachmentRequestBuilderFileQueryParameters

type AttachmentRequestBuilderFileQueryParameters struct {
	//EncryptionContext Sys_id of an encryption context record.
	//Specify this parameter to allow only users with the specified encryption context to access the attachment.
	//For additional information on encryption context records,
	// see [Encryption Support]:https://docs.servicenow.com/csh?topicname=c_EncryptionSupport&version=vancouver&pubname=vancouver-platform-security.
	EncryptionContext string `query:"encryption_context"`
	//FileName Name to give the attachment.
	FileName string `query:"file_name"`
	//TableName Name of the table to attach the file to.
	TableName string `query:"table_name"`
	//TableSysId Sys_id of the record in the table specified in table_name that you want to attach the file to.
	TableSysId string `query:"table_sys_id"` //nolint:stylecheck
}

type AttachmentRequestBuilderGetQueryParameters

type AttachmentRequestBuilderGetQueryParameters struct {
	// Limit Limit to be applied on pagination.
	Limit int `query:"sysparm_limit"`
	// Offset Number of records to exclude from the query. Use this parameter to get more records than specified in sysparm_limit. For example, if sysparm_limit is set to 500, but there are additional records you want to query, you can specify a sysparm_offset value of 500 to get the second set of records.
	Offset int `query:"sysparm_offset"`
	// Query Encoded query. Queries for the Attachment API are relative to the Attachments [sys_attachment] table.
	Query string `query:"sysparm_query"`
}

type Bool

type Bool bool

func (*Bool) UnmarshalJSON

func (i *Bool) UnmarshalJSON(data []byte) error

type Int

type Int int

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(data []byte) error

type Time

type Time time.Time

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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