forked from michaeldcanady/servicenow-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnow_request_builder.go
46 lines (40 loc) · 2.35 KB
/
now_request_builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package servicenowsdkgo
import (
attachmentapi "github.com/hdisysteme/servicenow-sdk-go/attachment-api"
"github.com/hdisysteme/servicenow-sdk-go/core"
"github.com/hdisysteme/servicenow-sdk-go/internal"
tableapi "github.com/hdisysteme/servicenow-sdk-go/table-api"
)
type NowRequestBuilder struct {
core.RequestBuilder
}
// NewNowRequestBuilder creates a new instance of the NowRequestBuilder associated with the given URL and Client.
// It accepts the URL and Client as parameters and returns a pointer to the created NowRequestBuiabstraction
func NewNowRequestBuilder(url string, client *ServiceNowClient) *NowRequestBuilder {
pathParameters := map[string]string{internal.BasePathParameter: url}
requestBuilder := core.NewRequestBuilder(client, "{+baseurl}/Now", pathParameters) //nolint:staticcheck
return &NowRequestBuilder{
*requestBuilder,
}
}
// Deprecated: deprecated since v{unreleased}. Use `Table2` instead.
// Table returns a TableRequestBuilder associated with the NowRequestBuilder.
// It accepts a table name as a parameter and constructs the URL for table-related requests.
// The returned TableRequestBuilder can be used to build and execute table-related requests.
func (rB *NowRequestBuilder) Table(tableName string) *tableapi.TableRequestBuilder {
rB.RequestBuilder.PathParameters["table"] = tableName
return tableapi.NewTableRequestBuilder(rB.RequestBuilder.Client.(*ServiceNowClient), rB.RequestBuilder.PathParameters)
}
// Table returns a TableRequestBuilder associated with the NowRequestBuilder.
// It accepts a table name as a parameter and constructs the URL for table-related requests.
// The returned TableRequestBuilder can be used to build and execute table-related requests.
func (rB *NowRequestBuilder) Table2(tableName string) *tableapi.TableRequestBuilder2 {
rB.RequestBuilder.PathParameters["table"] = tableName
requestBuilder, _ := tableapi.NewTableRequestBuilder2(rB.RequestBuilder.Client.(*ServiceNowClient), rB.RequestBuilder.PathParameters)
return requestBuilder
}
// Attachment returns an AttachmentRequestBuilder associated with the NowRequestBuilder.
// It allows you to work with attachments and manage attachments in ServiceNow.
func (rB *NowRequestBuilder) Attachment() *attachmentapi.AttachmentRequestBuilder {
return attachmentapi.NewAttachmentRequestBuilder(rB.RequestBuilder.Client.(*ServiceNowClient), rB.RequestBuilder.PathParameters)
}