All files / src/request request.inteface.ts

100% Statements 53/53
100% Branches 0/0
100% Functions 0/0
100% Lines 53/53

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 541x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Represents the interface for a response from the server.
 */
export interface HTTPServerResponse {
  response: HTTPResponse
  status: {
    code: number
    message?: string
  }
  headers: HTTPHeaders
  body: HTTPBody
  params: HTTPQueryParams
}
 
export interface HTTPResponse {
  /**
   * The status code of the response.
   */
  retcode: number
 
  /**
   * A message associated with the response.
   */
  message: string
 
  /**
   * The data returned by the server.
   */
  data: unknown
}
 
/**
 * Represents the base type that can be used for properties in a request body,
 * request header, or request parameter.
 */
export interface Dict<T> {
  [key: string]: T | undefined
}
 
/**
 * Represents the type that can be used for the parameters of a request.
 */
export type HTTPQueryParams = Dict<string | number | string[] | null>
 
/**
 * Represents the type that can be used for the headers of a request.
 */
export type HTTPHeaders = Dict<number | string | string[]>
 
/**
 * Represents the type that can be used for the body of a request.
 */
export type HTTPBody = Dict<number | number[] | string | string[] | null>