@@ -106,7 +106,7 @@ type EndpointConfig struct {
106106// It holds a Logger instance to facilitate logging across various API handling methods.
107107// This handler is responsible for encoding and decoding request and response data,
108108// determining content types, and other API interactions as defined by the APIHandler interface.
109- type UnifiedGraphAPIHandler struct {
109+ type GraphAPIHandler struct {
110110 logger Logger // logger is used to output logs for the API handling processes.
111111 endpointAcceptedFormatsCache map [string ][]string
112112}
@@ -135,7 +135,7 @@ type APIHandler interface {
135135
136136// GetAPIHandler initializes and returns an APIHandler with a configured logger.
137137func GetAPIHandler (config Config ) APIHandler {
138- handler := & UnifiedGraphAPIHandler {}
138+ handler := & GraphAPIHandler {}
139139 logger := NewDefaultLogger ()
140140 logger .SetLevel (config .LogLevel ) // Use the LogLevel from the config
141141 handler .SetLogger (logger )
@@ -145,7 +145,7 @@ func GetAPIHandler(config Config) APIHandler {
145145// SetLogger assigns a Logger instance to the UnifiedAPIHandler.
146146// This allows for logging throughout the handler's operations,
147147// enabling consistent logging that follows the configuration of the provided Logger.
148- func (u * UnifiedGraphAPIHandler ) SetLogger (logger Logger ) {
148+ func (u * GraphAPIHandler ) SetLogger (logger Logger ) {
149149 u .logger = logger
150150}
151151
@@ -157,7 +157,7 @@ func (u *UnifiedGraphAPIHandler) SetLogger(logger Logger) {
157157// - For all url endpoints it defaults to "application/json" for the graph beta and V1.0 API's.
158158// If the endpoint does not match any of the predefined patterns, "application/json" is used as a fallback.
159159// This method logs the decision process at various stages for debugging purposes.
160- func (u *UnifiedGraphAPIHandler ) GetContentTypeHeader(endpoint string) string {
160+ func (u *GraphAPIHandler ) GetContentTypeHeader(endpoint string) string {
161161 // Dynamic lookup from configuration should be the first priority
162162 for key, config := range configMap {
163163 if strings.HasPrefix(endpoint, key) {
@@ -188,7 +188,7 @@ func (u *UnifiedGraphAPIHandler) GetContentTypeHeader(endpoint string) string {
188188//
189189// Returns:
190190// - The chosen Content-Type for the request, as a string.
191- func (u * UnifiedGraphAPIHandler ) GetContentTypeHeader (endpoint string ) string {
191+ func (u * GraphAPIHandler ) GetContentTypeHeader (endpoint string ) string {
192192 // Initialize the cache if it's not already initialized
193193 if u .endpointAcceptedFormatsCache == nil {
194194 u .endpointAcceptedFormatsCache = make (map [string ][]string )
@@ -275,7 +275,7 @@ func (u *UnifiedGraphAPIHandler) GetContentTypeHeader(endpoint string) string {
275275// returns an error.
276276// - It is the responsibility of the caller to handle any errors and to decide on the default action
277277// if no formats are returned or in case of an error.
278- func (u * UnifiedGraphAPIHandler ) FetchSupportedRequestFormats (endpoint string ) ([]string , error ) {
278+ func (u * GraphAPIHandler ) FetchSupportedRequestFormats (endpoint string ) ([]string , error ) {
279279 url := fmt .Sprintf ("https://%s%s" , DefaultBaseDomain , endpoint )
280280 req , err := http .NewRequest (http .MethodOptions , url , nil )
281281 if err != nil {
@@ -300,7 +300,7 @@ func (u *UnifiedGraphAPIHandler) FetchSupportedRequestFormats(endpoint string) (
300300}
301301
302302// MarshalRequest encodes the request body according to the endpoint for the API.
303- func (u * UnifiedGraphAPIHandler ) MarshalRequest (body interface {}, method string , endpoint string ) ([]byte , error ) {
303+ func (u * GraphAPIHandler ) MarshalRequest (body interface {}, method string , endpoint string ) ([]byte , error ) {
304304 var (
305305 data []byte
306306 err error
@@ -341,7 +341,7 @@ func (u *UnifiedGraphAPIHandler) MarshalRequest(body interface{}, method string,
341341}
342342
343343// UnmarshalResponse decodes the response body from XML or JSON format depending on the Content-Type header.
344- func (u * UnifiedGraphAPIHandler ) UnmarshalResponse (resp * http.Response , out interface {}) error {
344+ func (u * GraphAPIHandler ) UnmarshalResponse (resp * http.Response , out interface {}) error {
345345 // Handle DELETE method
346346 if resp .Request .Method == "DELETE" {
347347 if resp .StatusCode >= 200 && resp .StatusCode < 300 {
@@ -449,7 +449,7 @@ func (u *UnifiedGraphAPIHandler) UnmarshalResponse(resp *http.Response, out inte
449449// the server is informed of the client's versatile content handling capabilities while
450450// indicating a preference for XML. The specified MIME types cover common content formats like
451451// images, JSON, XML, HTML, plain text, and certificates, with a fallback option for all other types.
452- func (u * UnifiedGraphAPIHandler ) GetAcceptHeader () string {
452+ func (u * GraphAPIHandler ) GetAcceptHeader () string {
453453 weightedAcceptHeader := "application/x-x509-ca-cert;q=0.95," +
454454 "application/pkix-cert;q=0.94," +
455455 "application/pem-certificate-chain;q=0.93," +
@@ -468,7 +468,7 @@ func (u *UnifiedGraphAPIHandler) GetAcceptHeader() string {
468468}
469469
470470// MarshalMultipartFormData takes a map with form fields and file paths and returns the encoded body and content type.
471- func (u * UnifiedGraphAPIHandler ) MarshalMultipartRequest (fields map [string ]string , files map [string ]string ) ([]byte , string , error ) {
471+ func (u * GraphAPIHandler ) MarshalMultipartRequest (fields map [string ]string , files map [string ]string ) ([]byte , string , error ) {
472472 body := & bytes.Buffer {}
473473 writer := multipart .NewWriter (body )
474474
@@ -506,7 +506,7 @@ func (u *UnifiedGraphAPIHandler) MarshalMultipartRequest(fields map[string]strin
506506}
507507
508508// handleBinaryData checks if the response should be treated as binary data and assigns to out if so.
509- func (u * UnifiedGraphAPIHandler ) handleBinaryData (contentType , contentDisposition string , bodyBytes []byte , out interface {}) error {
509+ func (u * GraphAPIHandler ) handleBinaryData (contentType , contentDisposition string , bodyBytes []byte , out interface {}) error {
510510 if strings .Contains (contentType , "application/octet-stream" ) || strings .HasPrefix (contentDisposition , "attachment" ) {
511511 if outPointer , ok := out .(* []byte ); ok {
512512 * outPointer = bodyBytes
0 commit comments