Skip to content

Commit c7cacf7

Browse files
committed
Remove unused code related to handling API responses
1 parent 43ae832 commit c7cacf7

File tree

4 files changed

+0
-281
lines changed

4 files changed

+0
-281
lines changed

apiintegrations/apihandler/apihandler.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ type APIHandler interface {
1515
ConstructAPIAuthEndpoint(instanceName string, endpointPath string, log logger.Logger) string
1616
MarshalRequest(body interface{}, method string, endpoint string, log logger.Logger) ([]byte, error)
1717
MarshalMultipartRequest(fields map[string]string, files map[string]string, log logger.Logger) ([]byte, string, error)
18-
//HandleAPISuccessResponse(resp *http.Response, out interface{}, log logger.Logger) error
1918
GetContentTypeHeader(method string, log logger.Logger) string
2019
GetAcceptHeader() string
2120
GetDefaultBaseDomain() string

apiintegrations/jamfpro/jamfpro_api_response.go.back

Lines changed: 0 additions & 111 deletions
This file was deleted.

apiintegrations/msgraph/msgraph_api_response.go

Lines changed: 0 additions & 111 deletions
This file was deleted.

httpclient/request.go

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -388,61 +388,3 @@ func (c *Client) do(req *http.Request, log logger.Logger, method, endpoint strin
388388

389389
return resp, nil
390390
}
391-
392-
// handleErrorResponse processes and logs errors from an HTTP response, allowing for a customizable error message.
393-
//
394-
// Parameters:
395-
// - resp: The *http.Response received from the server.
396-
// - log: An instance of a logger (conforming to the logger.Logger interface) for logging the error details.
397-
// - errorMessage: A custom error message that provides context about the error.
398-
// - method: The HTTP method used for the request, for logging purposes.
399-
// - endpoint: The endpoint the request was sent to, for logging purposes.
400-
//
401-
// Returns:
402-
// - An error object parsed from the HTTP response, indicating the nature of the failure.
403-
// func (c *Client) handleErrorResponse(resp *http.Response, out interface{}, log logger.Logger, method, endpoint string) error {
404-
// if err := c.APIHandler.HandleAPIErrorResponse(resp, out, log); err != nil {
405-
// log.Error("Failed to unmarshal HTTP response",
406-
// zap.String("method", method),
407-
// zap.String("endpoint", endpoint),
408-
// zap.Error(err),
409-
// )
410-
// return err
411-
// }
412-
// log.Info("HTTP request succeeded",
413-
// zap.String("method", method),
414-
// zap.String("endpoint", endpoint),
415-
// zap.Int("status_code", resp.StatusCode),
416-
// )
417-
// return nil
418-
// }
419-
420-
// handleSuccessResponse unmarshals a successful HTTP response into the provided output parameter and logs the
421-
// success details. It's designed for use when the response indicates success (status code within 200-299).
422-
// The function logs the request's success and, in case of unmarshalling errors, logs the failure and returns the error.
423-
//
424-
// Parameters:
425-
// - resp: The *http.Response received from the server.
426-
// - out: A pointer to the variable where the unmarshalled response will be stored.
427-
// - log: An instance of a logger (conforming to the logger.Logger interface) for logging success or unmarshalling errors.
428-
// - method: The HTTP method used for the request, for logging purposes.
429-
// - endpoint: The endpoint the request was sent to, for logging purposes.
430-
//
431-
// Returns:
432-
// - nil if the response was successfully unmarshalled into the 'out' parameter, or an error if unmarshalling failed.
433-
// func (c *Client) handleSuccessResponse(resp *http.Response, out interface{}, log logger.Logger, method, endpoint string) error {
434-
// if err := c.APIHandler.HandleAPISuccessResponse(resp, out, log); err != nil {
435-
// log.Error("Failed to unmarshal HTTP response",
436-
// zap.String("method", method),
437-
// zap.String("endpoint", endpoint),
438-
// zap.Error(err),
439-
// )
440-
// return err
441-
// }
442-
// log.Info("HTTP request succeeded",
443-
// zap.String("method", method),
444-
// zap.String("endpoint", endpoint),
445-
// zap.Int("status_code", resp.StatusCode),
446-
// )
447-
// return nil
448-
// }

0 commit comments

Comments
 (0)