github.com/grokify/go-ringcentral-client@v0.3.31/office/v1/client/response.go (about)

     1  /*
     2   * RingCentral Connect Platform API Explorer
     3   *
     4   * <p>This is a beta interactive API explorer for the RingCentral Connect Platform. To use this service, you will need to have an account with the proper credentials to generate an OAuth2 access token.</p><p><h2>Quick Start</h2></p><ol><li>1) Go to <b>Authentication > /oauth/token</b></li><li>2) Enter <b>app_key, app_secret, username, password</b> fields and then click \"Try it out!\"</li><li>3) Upon success, your access_token is loaded and you can access any form requiring authorization.</li></ol><h2>Links</h2><ul><li><a href=\"https://github.com/ringcentral\" target=\"_blank\">RingCentral SDKs on Github</a></li><li><a href=\"mailto:devsupport@ringcentral.com\">RingCentral Developer Support Email</a></li></ul>
     5   *
     6   * API version: 1.0
     7   * Generated by: OpenAPI Generator (https://openapi-generator.tech)
     8   */
     9  
    10  package ringcentral
    11  
    12  import (
    13  	"net/http"
    14  )
    15  
    16  type APIResponse struct {
    17  	*http.Response `json:"-"`
    18  	Message        string `json:"message,omitempty"`
    19  	// Operation is the name of the OpenAPI operation.
    20  	Operation string `json:"operation,omitempty"`
    21  	// RequestURL is the request URL. This value is always available, even if the
    22  	// embedded *http.Response is nil.
    23  	RequestURL string `json:"url,omitempty"`
    24  	// Method is the HTTP method used for the request.  This value is always
    25  	// available, even if the embedded *http.Response is nil.
    26  	Method string `json:"method,omitempty"`
    27  	// Payload holds the contents of the response body (which may be nil or empty).
    28  	// This is provided here as the raw response.Body() reader will have already
    29  	// been drained.
    30  	Payload []byte `json:"-"`
    31  }
    32  
    33  func NewAPIResponse(r *http.Response) *APIResponse {
    34  
    35  	response := &APIResponse{Response: r}
    36  	return response
    37  }
    38  
    39  func NewAPIResponseWithError(errorMessage string) *APIResponse {
    40  
    41  	response := &APIResponse{Message: errorMessage}
    42  	return response
    43  }