Record Class BitBucketPPRApiResponse

java.lang.Object
java.lang.Record
io.jenkins.plugins.bitbucketpushandpullrequest.client.api.BitBucketPPRApiResponse

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public record BitBucketPPRApiResponse(int statusCode, String body) extends Record
Outcome of a Bitbucket API call, detached from the transport that produced it. The sender fully owns the lifecycle of its HTTP client and response: by the time this value is returned, every underlying resource has been consumed and released, so callers can hold it freely.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BitBucketPPRApiResponse(int statusCode, String body)
    Creates an instance of a BitBucketPPRApiResponse record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the body record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    from(com.github.scribejava.core.model.Response response)
    Materializes a scribejava response with the same body cap as the Apache path.
    from(org.apache.http.HttpResponse response)
    Materializes an Apache HttpClient response.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the statusCode record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BitBucketPPRApiResponse

      public BitBucketPPRApiResponse(int statusCode, String body)
      Creates an instance of a BitBucketPPRApiResponse record class.
      Parameters:
      statusCode - the value for the statusCode record component
      body - the value for the body record component
  • Method Details

    • from

      public static BitBucketPPRApiResponse from(org.apache.http.HttpResponse response) throws IOException
      Materializes an Apache HttpClient response. Used as the ResponseHandler of CloseableHttpClient#execute(HttpUriRequest, ResponseHandler), the execution form that releases the connection before returning.
      Throws:
      IOException
    • from

      public static BitBucketPPRApiResponse from(com.github.scribejava.core.model.Response response) throws IOException
      Materializes a scribejava response with the same body cap as the Apache path. The stream is decompressed when the reply declares Content-Encoding: gzip, mirroring what Response#getBody() would do, but reading at most the cap.
      Throws:
      IOException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • statusCode

      public int statusCode()
      Returns the value of the statusCode record component.
      Returns:
      the value of the statusCode record component
    • body

      public String body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component