agones.dev/agones@v1.53.0/test/sdk/restapi/swagger/response.go (about)

     1  // Copyright 2024 Google LLC All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // This code was autogenerated. Do not edit directly.
    16  /*
    17   * sdk.proto
    18   *
    19   * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
    20   *
    21   * API version: version not set
    22   * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
    23   */
    24  package swagger
    25  
    26  import (
    27  	"net/http"
    28  )
    29  
    30  type APIResponse struct {
    31  	*http.Response `json:"-"`
    32  	Message        string `json:"message,omitempty"`
    33  	// Operation is the name of the swagger operation.
    34  	Operation string `json:"operation,omitempty"`
    35  	// RequestURL is the request URL. This value is always available, even if the
    36  	// embedded *http.Response is nil.
    37  	RequestURL string `json:"url,omitempty"`
    38  	// Method is the HTTP method used for the request.  This value is always
    39  	// available, even if the embedded *http.Response is nil.
    40  	Method string `json:"method,omitempty"`
    41  	// Payload holds the contents of the response body (which may be nil or empty).
    42  	// This is provided here as the raw response.Body() reader will have already
    43  	// been drained.
    44  	Payload []byte `json:"-"`
    45  }
    46  
    47  func NewAPIResponse(r *http.Response) *APIResponse {
    48  
    49  	response := &APIResponse{Response: r}
    50  	return response
    51  }
    52  
    53  func NewAPIResponseWithError(errorMessage string) *APIResponse {
    54  
    55  	response := &APIResponse{Message: errorMessage}
    56  	return response
    57  }