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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | await import("./zcl_abapgit_http_agent.clas.locals.mjs"); const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_http_agent.clas.abap class zcl_abapgit_http_agent { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'ZCL_ABAPGIT_HTTP_AGENT'; static IMPLEMENTED_INTERFACES = ["ZIF_ABAPGIT_HTTP_AGENT"]; static ATTRIBUTES = {"MO_GLOBAL_HEADERS": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_MAP", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_MAP"});}, "visibility": "I", "is_constant": " ", "is_class": " "}, "ZIF_ABAPGIT_HTTP_AGENT~C_METHODS": {"type": () => {return new abap.types.Structure({ "get": new abap.types.String({qualifiedName: "STRING"}), "post": new abap.types.String({qualifiedName: "STRING"}), "put": new abap.types.String({qualifiedName: "STRING"}), "delete": new abap.types.String({qualifiedName: "STRING"}), "patch": new abap.types.String({qualifiedName: "STRING"})}, undefined, undefined, {}, {});}, "visibility": "U", "is_constant": "X", "is_class": "X"}}; static METHODS = {"ATTACH_PAYLOAD": {"visibility": "I", "parameters": {"II_REQUEST": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_HTTP_REQUEST", RTTIName: "\\INTERFACE=IF_HTTP_REQUEST"});}, "is_optional": " "}, "IV_PAYLOAD": {"type": () => {return new abap.types.Character(4);}, "is_optional": " "}}}, "CREATE": {"visibility": "U", "parameters": {"RI_INSTANCE": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_HTTP_AGENT", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_HTTP_AGENT"});}, "is_optional": " "}}}, "CONSTRUCTOR": {"visibility": "U", "parameters": {}}}; #mo_global_headers; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { }; this.#mo_global_headers = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_MAP", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_MAP"}); this.FRIENDS_ACCESS_INSTANCE["mo_global_headers"] = this.#mo_global_headers; this.zif_abapgit_http_agent$c_methods = abap.Classes['ZIF_ABAPGIT_HTTP_AGENT'].zif_abapgit_http_agent$c_methods; } async attach_payload(INPUT) { return zcl_abapgit_http_agent.attach_payload(INPUT); } static async attach_payload(INPUT) { let ii_request = INPUT?.ii_request; if (ii_request?.getQualifiedName === undefined || ii_request.getQualifiedName() !== "IF_HTTP_REQUEST") { ii_request = undefined; } if (ii_request === undefined) { ii_request = new abap.types.ABAPObject({qualifiedName: "IF_HTTP_REQUEST", RTTIName: "\\INTERFACE=IF_HTTP_REQUEST"}).set(INPUT.ii_request); } let iv_payload = INPUT?.iv_payload; let lo_type = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_TYPEDESCR", RTTIName: "\\CLASS=CL_ABAP_TYPEDESCR"}); lo_type.set((await abap.Classes['CL_ABAP_TYPEDESCR'].describe_by_data({p_data: iv_payload}))); if (abap.compare.eq(lo_type.get().type_kind, abap.Classes['CL_ABAP_TYPEDESCR'].typekind_xstring)) { await ii_request.get().if_http_entity$set_data({data: iv_payload}); } else if (abap.compare.eq(lo_type.get().type_kind, abap.Classes['CL_ABAP_TYPEDESCR'].typekind_string)) { await ii_request.get().if_http_entity$set_cdata({data: iv_payload}); } else { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Unexpected payload type ${abap.templateFormatting(lo_type.get().absolute_name)}`)}); } } async constructor_(INPUT) { this.#mo_global_headers.set(await (new abap.Classes['ZCL_ABAPGIT_STRING_MAP']()).constructor_()); return this; } async create() { return zcl_abapgit_http_agent.create(); } static async create() { let ri_instance = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_HTTP_AGENT", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_HTTP_AGENT"}); ri_instance.set(await (new abap.Classes['ZCL_ABAPGIT_HTTP_AGENT']()).constructor_()); return ri_instance; } async zif_abapgit_http_agent$global_headers() { let ro_global_headers = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_MAP", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_MAP"}); ro_global_headers.set(this.#mo_global_headers); return ro_global_headers; } async zif_abapgit_http_agent$request(INPUT) { let ri_response = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_HTTP_RESPONSE", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_HTTP_RESPONSE"}); let iv_url = INPUT?.iv_url; if (iv_url?.getQualifiedName === undefined || iv_url.getQualifiedName() !== "STRING") { iv_url = undefined; } if (iv_url === undefined) { iv_url = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_url); } let iv_method = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_method) {iv_method.set(INPUT.iv_method);} if (INPUT === undefined || INPUT.iv_method === undefined) {iv_method = abap.Classes['ZIF_ABAPGIT_HTTP_AGENT'].zif_abapgit_http_agent$c_methods.get().get;} let io_query = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_MAP", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_MAP"}); if (INPUT && INPUT.io_query) {io_query.set(INPUT.io_query);} let io_headers = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_MAP", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_MAP"}); if (INPUT && INPUT.io_headers) {io_headers.set(INPUT.io_headers);} let iv_payload = INPUT?.iv_payload || new abap.types.Character(4); let li_client = new abap.types.ABAPObject({qualifiedName: "IF_HTTP_CLIENT", RTTIName: "\\INTERFACE=IF_HTTP_CLIENT"}); let lo_proxy_configuration = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_PROXY_CONFIG", RTTIName: "\\CLASS=ZCL_ABAPGIT_PROXY_CONFIG"}); let lv_code = new abap.types.Integer({qualifiedName: "I"}); let lv_message = new abap.types.String({qualifiedName: "STRING"}); let fs_ls_entry_ = new abap.types.FieldSymbol(new abap.types.Structure({ "k": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_STRING_MAP=>TY_ENTRY-K"}), "v": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_STRING_MAP=>TY_ENTRY-V"})}, "zcl_abapgit_string_map=>ty_entry", undefined, {}, {})); lo_proxy_configuration.set(await (new abap.Classes['ZCL_ABAPGIT_PROXY_CONFIG']()).constructor_()); await abap.Classes['CL_HTTP_CLIENT'].create_by_url({url: iv_url, ssl_id: (await (await abap.Classes['ZCL_ABAPGIT_EXIT'].get_instance()).get().zif_abapgit_exit$get_ssl_id()), proxy_host: (await lo_proxy_configuration.get().get_proxy_url({iv_repo_url: iv_url})), proxy_service: (await lo_proxy_configuration.get().get_proxy_port({iv_repo_url: iv_url})), client: li_client}); await li_client.get().if_http_client$request.get().if_http_request$set_version({version: abap.Classes['IF_HTTP_REQUEST'].if_http_entity$co_protocol_version_1_1}); await li_client.get().if_http_client$request.get().if_http_request$set_method({method: iv_method}); if (abap.compare.initial(io_query) === false) { for await (const unique239 of abap.statements.loop(io_query.get().mt_entries)) { fs_ls_entry_.assign(unique239); await li_client.get().if_http_client$request.get().if_http_entity$set_form_field({name: fs_ls_entry_.get().k, value: fs_ls_entry_.get().v}); } } for await (const unique240 of abap.statements.loop(this.#mo_global_headers.get().mt_entries)) { fs_ls_entry_.assign(unique240); await li_client.get().if_http_client$request.get().if_http_entity$set_header_field({name: abap.builtin.to_lower({val: fs_ls_entry_.get().k}), value: fs_ls_entry_.get().v}); } if (abap.compare.initial(io_headers) === false) { for await (const unique241 of abap.statements.loop(io_headers.get().mt_entries)) { fs_ls_entry_.assign(unique241); await li_client.get().if_http_client$request.get().if_http_entity$set_header_field({name: abap.builtin.to_lower({val: fs_ls_entry_.get().k}), value: fs_ls_entry_.get().v}); } } if (abap.compare.eq(iv_method, abap.Classes['ZIF_ABAPGIT_HTTP_AGENT'].zif_abapgit_http_agent$c_methods.get().post) || abap.compare.eq(iv_method, abap.Classes['ZIF_ABAPGIT_HTTP_AGENT'].zif_abapgit_http_agent$c_methods.get().put) || abap.compare.eq(iv_method, abap.Classes['ZIF_ABAPGIT_HTTP_AGENT'].zif_abapgit_http_agent$c_methods.get().patch)) { await this.attach_payload({ii_request: li_client.get().if_http_client$request, iv_payload: iv_payload}); } try { await li_client.get().if_http_client$send(); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "HTTP_COMMUNICATION_FAILURE": abap.builtin.sy.get().subrc.set(1); break; case "HTTP_INVALID_STATE": abap.builtin.sy.get().subrc.set(2); break; case "HTTP_PROCESSING_FAILED": abap.builtin.sy.get().subrc.set(3); break; case "HTTP_INVALID_TIMEOUT": abap.builtin.sy.get().subrc.set(4); break; default: abap.builtin.sy.get().subrc.set(5); break; } } else { throw e; } } if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { try { await li_client.get().if_http_client$receive(); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "HTTP_COMMUNICATION_FAILURE": abap.builtin.sy.get().subrc.set(1); break; case "HTTP_INVALID_STATE": abap.builtin.sy.get().subrc.set(2); break; case "HTTP_PROCESSING_FAILED": abap.builtin.sy.get().subrc.set(3); break; default: abap.builtin.sy.get().subrc.set(4); break; } } else { throw e; } } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await li_client.get().if_http_client$get_last_error({code: lv_code, message: lv_message}); await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`HTTP error: [${abap.templateFormatting(lv_code)}] ${abap.templateFormatting(lv_message)}`)}); } ri_response.set((await abap.Classes['CLAS-ZCL_ABAPGIT_HTTP_AGENT-LCL_HTTP_RESPONSE'].create({ii_client: li_client}))); return ri_response; } } abap.Classes['ZCL_ABAPGIT_HTTP_AGENT'] = zcl_abapgit_http_agent; zcl_abapgit_http_agent.zif_abapgit_http_agent$c_methods = new abap.types.Structure({ "get": new abap.types.String({qualifiedName: "STRING"}), "post": new abap.types.String({qualifiedName: "STRING"}), "put": new abap.types.String({qualifiedName: "STRING"}), "delete": new abap.types.String({qualifiedName: "STRING"}), "patch": new abap.types.String({qualifiedName: "STRING"})}, undefined, undefined, {}, {}); zcl_abapgit_http_agent.zif_abapgit_http_agent$c_methods.get().get.set('GET'); zcl_abapgit_http_agent.zif_abapgit_http_agent$c_methods.get().post.set('POST'); zcl_abapgit_http_agent.zif_abapgit_http_agent$c_methods.get().put.set('PUT'); zcl_abapgit_http_agent.zif_abapgit_http_agent$c_methods.get().delete.set('DELETE'); zcl_abapgit_http_agent.zif_abapgit_http_agent$c_methods.get().patch.set('PATCH'); export {zcl_abapgit_http_agent}; |