All files / output zcl_abapgit_http_agent.clas.locals.mjs

4.16% Statements 4/96
66.66% Branches 2/3
25% Functions 1/4
4.16% Lines 4/96

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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 961x 1x                                                                                                                                                                                         1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_http_agent.clas.locals_imp.abap
class lcl_http_response {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_HTTP_AGENT-LCL_HTTP_RESPONSE';
  static IMPLEMENTED_INTERFACES = ["ZIF_ABAPGIT_HTTP_RESPONSE"];
  static ATTRIBUTES = {"MI_CLIENT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_HTTP_CLIENT", RTTIName: "\\INTERFACE=IF_HTTP_CLIENT"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MI_RESPONSE": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_HTTP_RESPONSE", RTTIName: "\\INTERFACE=IF_HTTP_RESPONSE"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"CREATE": {"visibility": "U", "parameters": {"RI_RESPONSE": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_HTTP_RESPONSE", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_HTTP_RESPONSE"});}, "is_optional": " "}, "II_CLIENT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_HTTP_CLIENT", RTTIName: "\\INTERFACE=IF_HTTP_CLIENT"});}, "is_optional": " "}}}};
  #mi_client;
  #mi_response;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
    this.#mi_client = new abap.types.ABAPObject({qualifiedName: "IF_HTTP_CLIENT", RTTIName: "\\INTERFACE=IF_HTTP_CLIENT"});
    this.FRIENDS_ACCESS_INSTANCE["mi_client"] = this.#mi_client;
    this.#mi_response = new abap.types.ABAPObject({qualifiedName: "IF_HTTP_RESPONSE", RTTIName: "\\INTERFACE=IF_HTTP_RESPONSE"});
    this.FRIENDS_ACCESS_INSTANCE["mi_response"] = this.#mi_response;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async create(INPUT) {
    return lcl_http_response.create(INPUT);
  }
  static async create(INPUT) {
    let ri_response = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_HTTP_RESPONSE", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_HTTP_RESPONSE"});
    let ii_client = INPUT?.ii_client;
    if (ii_client?.getQualifiedName === undefined || ii_client.getQualifiedName() !== "IF_HTTP_CLIENT") { ii_client = undefined; }
    if (ii_client === undefined) { ii_client = new abap.types.ABAPObject({qualifiedName: "IF_HTTP_CLIENT", RTTIName: "\\INTERFACE=IF_HTTP_CLIENT"}).set(INPUT.ii_client); }
    let lo_response = new abap.types.ABAPObject({qualifiedName: "LCL_HTTP_RESPONSE", RTTIName: "\\CLASS-POOL=ZCL_ABAPGIT_HTTP_AGENT\\CLASS=LCL_HTTP_RESPONSE"});
    lo_response.set(await (new abap.Classes['CLAS-ZCL_ABAPGIT_HTTP_AGENT-LCL_HTTP_RESPONSE']()).constructor_());
    lo_response.get().FRIENDS_ACCESS_INSTANCE["mi_client"].set(ii_client);
    lo_response.get().FRIENDS_ACCESS_INSTANCE["mi_response"].set(ii_client.get().if_http_client$response);
    await abap.statements.cast(ri_response, lo_response);
    return ri_response;
  }
  async zif_abapgit_http_response$close() {
    await this.#mi_client.get().if_http_client$close();
  }
  async zif_abapgit_http_response$is_ok() {
    let rv_yes = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    let lv_code = new abap.types.Integer({qualifiedName: "I"});
    lv_code.set((await this.zif_abapgit_http_response$code()));
    rv_yes.set(abap.builtin.boolc(abap.compare.ge(lv_code, abap.IntegerFactory.get(200)) && abap.compare.lt(lv_code, new abap.types.Integer().set(300))));
    return rv_yes;
  }
  async zif_abapgit_http_response$data() {
    let rv_data = new abap.types.XString({qualifiedName: "XSTRING"});
    rv_data.set((await this.#mi_response.get().if_http_entity$get_data()));
    return rv_data;
  }
  async zif_abapgit_http_response$cdata() {
    let rv_data = new abap.types.String({qualifiedName: "STRING"});
    rv_data.set((await this.#mi_response.get().if_http_entity$get_cdata()));
    return rv_data;
  }
  async zif_abapgit_http_response$code() {
    let rv_code = new abap.types.Integer({qualifiedName: "I"});
    let lv_msg = new abap.types.String({qualifiedName: "STRING"});
    await this.#mi_response.get().if_http_response$get_status({reason: lv_msg, code: rv_code});
    return rv_code;
  }
  async zif_abapgit_http_response$json() {
    let ri_json = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_AJSON", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_AJSON"});
    ri_json.set((await abap.Classes['ZCL_ABAPGIT_AJSON'].parse({iv_json: (await this.zif_abapgit_http_response$cdata())})));
    return ri_json;
  }
  async zif_abapgit_http_response$error() {
    let rv_message = new abap.types.String({qualifiedName: "STRING"});
    rv_message.set((await this.#mi_response.get().if_http_entity$get_cdata()));
    return rv_message;
  }
  async zif_abapgit_http_response$headers() {
    let ro_headers = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_MAP", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_MAP"});
    let lt_headers = abap.types.TableFactory.construct(new abap.types.Structure({
    "name": new abap.types.String({qualifiedName: "STRING"}),
    "value": new abap.types.String({qualifiedName: "STRING"})}, "IHTTPNVP", "IHTTPNVP", {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "TIHTTPNVP");
    let fs_ls_h_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "name": new abap.types.String({qualifiedName: "STRING"}),
    "value": new abap.types.String({qualifiedName: "STRING"})}, "IHTTPNVP", "IHTTPNVP", {}, {}));
    ro_headers.set(await (new abap.Classes['ZCL_ABAPGIT_STRING_MAP']()).constructor_());
    await this.#mi_response.get().if_http_entity$get_header_fields({fields: lt_headers});
    for await (const unique238 of abap.statements.loop(lt_headers)) {
      fs_ls_h_.assign(unique238);
      await ro_headers.get().set({iv_key: fs_ls_h_.get().name, iv_val: fs_ls_h_.get().value});
    }
    return ro_headers;
  }
}
abap.Classes['CLAS-ZCL_ABAPGIT_HTTP_AGENT-LCL_HTTP_RESPONSE'] = lcl_http_response;
export {lcl_http_response};