forked from microsoft/kiota-abstractions-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_request_builder.go
29 lines (27 loc) · 942 Bytes
/
base_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
package abstractions
// BaseRequestBuilder is the base class for all request builders.
type BaseRequestBuilder struct {
// Path parameters for the request
PathParameters map[string]string
// The request adapter to use to execute the requests.
RequestAdapter RequestAdapter
// Url template to use to build the URL for the current request builder
UrlTemplate string
}
// NewBaseRequestBuilder creates a new BaseRequestBuilder instance.
func NewBaseRequestBuilder(requestAdapter RequestAdapter, urlTemplate string, pathParameters map[string]string) *BaseRequestBuilder {
if requestAdapter == nil {
panic("requestAdapter cannot be nil")
}
pathParametersCopy := make(map[string]string)
if pathParameters != nil {
for idx, item := range pathParameters {
pathParametersCopy[idx] = item
}
}
return &BaseRequestBuilder{
RequestAdapter: requestAdapter,
UrlTemplate: urlTemplate,
PathParameters: pathParametersCopy,
}
}