Updates to /graph/betasdk/beta_client.go

Registers serializers for connector.
Adds explicit comments on connector usage and patterns.
Removes Sites() call from supported commands.
This commit is contained in:
Danny Adams 2023-01-26 16:08:25 -05:00
parent 817a7a2bc6
commit f8d65d66de

View File

@ -2,11 +2,34 @@ package betasdk
import (
i1a3c1a5501c5e41b7fd169f2d4c768dce9b096ac28fb5431bf02afcc57295411 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/sites"
absser "github.com/microsoft/kiota-abstractions-go"
kioser "github.com/microsoft/kiota-abstractions-go/serialization"
kform "github.com/microsoft/kiota-serialization-form-go"
kw "github.com/microsoft/kiota-serialization-json-go"
ktext "github.com/microsoft/kiota-serialization-text-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
)
// BetaClient the main entry point of the SDK, exposes the configuration and the fluent API.
// Minimal Beta Connector:
// Details on how the Code was generated is present in `kioter-lock.json`.
// NOTE: kiota gen file is altered to indicate what files are included in the created
//
// Beta files use an adapter that allows for ASync() request. This feature is disabled in main. Generic Kiota adapters do not support.
// For the client, only calls that begin as client.SitesBy(siteID).Pages() have an endpoint.
//
// The use case specific to Pages(). All other requests should be routed to the /internal/connector/graph.Servicer
//
// Supported Pages models are located within the models subdirectory
// Supported Call source are located within the sites subdirectory
// Specifics on `betaClient.SitesById(siteID).Pages` are located: sites/site_item_request_builder.go
//
// BetaClient minimal msgraph-beta-sdk-go for connecting to msgraph-beta-sdk-go
// for retrieving `SharePoint.Pages`. Code is generated from kiota.dev.
// requestAdapter is registered with the following the serializers:
// -- "Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory",
// -- "Microsoft.Kiota.Serialization.Text.TextParseNodeFactory",
// -- "Microsoft.Kiota.Serialization.Form.FormParseNodeFactory"
type BetaClient struct {
// Path parameters for the request
pathParameters map[string]string
@ -23,6 +46,24 @@ func NewBetaClient(requestAdapter *msgraphsdk.GraphRequestAdapter) *BetaClient {
m.pathParameters = make(map[string]string)
m.urlTemplate = "{+baseurl}"
m.requestAdapter = requestAdapter
absser.RegisterDefaultSerializer(func() kioser.SerializationWriterFactory {
return kw.NewJsonSerializationWriterFactory()
})
absser.RegisterDefaultSerializer(func() kioser.SerializationWriterFactory {
return ktext.NewTextSerializationWriterFactory()
})
absser.RegisterDefaultSerializer(func() kioser.SerializationWriterFactory {
return kform.NewFormSerializationWriterFactory()
})
absser.RegisterDefaultDeserializer(func() kioser.ParseNodeFactory {
return kw.NewJsonParseNodeFactory()
})
absser.RegisterDefaultDeserializer(func() kioser.ParseNodeFactory {
return ktext.NewTextParseNodeFactory()
})
absser.RegisterDefaultDeserializer(func() kioser.ParseNodeFactory {
return kform.NewFormParseNodeFactory()
})
if m.requestAdapter.GetBaseUrl() == "" {
m.requestAdapter.SetBaseUrl("https://graph.microsoft.com/beta")
@ -30,11 +71,6 @@ func NewBetaClient(requestAdapter *msgraphsdk.GraphRequestAdapter) *BetaClient {
return m
}
// Sites the sites property
func (m *BetaClient) Sites() *i1a3c1a5501c5e41b7fd169f2d4c768dce9b096ac28fb5431bf02afcc57295411.SitesRequestBuilder {
return i1a3c1a5501c5e41b7fd169f2d4c768dce9b096ac28fb5431bf02afcc57295411.NewSitesRequestBuilderInternal(m.pathParameters, m.requestAdapter)
}
// SitesById provides operations to manage the collection of site entities.
func (m *BetaClient) SitesById(id string) *i1a3c1a5501c5e41b7fd169f2d4c768dce9b096ac28fb5431bf02afcc57295411.SiteItemRequestBuilder {
urlTplParams := make(map[string]string)