diff --git a/internal/client/graphcustom/get_request.go b/internal/client/graphcustom/get_request.go index a7cb4799..f47d14aa 100644 --- a/internal/client/graphcustom/get_request.go +++ b/internal/client/graphcustom/get_request.go @@ -179,7 +179,7 @@ func GetRequestByResourceId(ctx context.Context, adapter abstractions.RequestAda func makeRequest(ctx context.Context, adapter abstractions.RequestAdapter, requestInfo *abstractions.RequestInformation) ([]byte, error) { nativeReq, err := adapter.ConvertToNativeRequest(ctx, requestInfo) if err != nil { - return nil, fmt.Errorf("error converting to native request: %w", err) + return nil, fmt.Errorf("error converting to native HTTP request: %w", err) } httpReq := nativeReq.(*http.Request) @@ -191,7 +191,7 @@ func makeRequest(ctx context.Context, adapter abstractions.RequestAdapter, reque resp, err := client.Do(httpReq) if err != nil { - return nil, fmt.Errorf("error executing request: %w", err) + return nil, fmt.Errorf("error executing GET request: %w", err) } defer resp.Body.Close() diff --git a/internal/client/graphcustom/post_request.go b/internal/client/graphcustom/post_request.go index 2244e807..df9c96d1 100644 --- a/internal/client/graphcustom/post_request.go +++ b/internal/client/graphcustom/post_request.go @@ -68,7 +68,7 @@ func PostRequest( // Send the request using the adapter's Send method result, err := adapter.Send(ctx, requestInfo, factory, errorMappings) if err != nil { - return nil, fmt.Errorf("error sending request: %v", err) + return nil, err } return result, nil @@ -106,7 +106,7 @@ func PostRequestNoContent(ctx context.Context, adapter abstractions.RequestAdapt // Use SendNoContent for requests that don't return a response body err = adapter.SendNoContent(ctx, requestInfo, nil) if err != nil { - return fmt.Errorf("error sending post request: %v", err) + return err } return nil diff --git a/internal/client/graphcustom/put_request.go b/internal/client/graphcustom/put_request.go index 8d9a15e1..a24af713 100644 --- a/internal/client/graphcustom/put_request.go +++ b/internal/client/graphcustom/put_request.go @@ -28,6 +28,11 @@ type PutRequestConfig struct { RequestBody s.Parsable } +type PutResponse struct { + StatusCode int + Error error +} + // PutRequestByResourceId performs a custom PUT request using the Microsoft Graph SDK when the operation // is not available in the generated SDK methods. This function supports both Beta and V1.0 Graph API versions // and expects a 204 No Content response from the server on success. @@ -78,7 +83,7 @@ func PutRequestByResourceId(ctx context.Context, adapter abstractions.RequestAda err = adapter.SendNoContent(ctx, requestInfo, nil) if err != nil { - return fmt.Errorf("error sending request: %v", err) + return err } return nil