1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 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 16 #ifndef APP_DOMAIN_VERIFY_I_HTTP_TASK_H 17 #define APP_DOMAIN_VERIFY_I_HTTP_TASK_H 18 #include "http_client_response.h" 19 #include "http_client_request.h" 20 #include "http_client_task.h" 21 #include "http_client.h" 22 namespace OHOS::AppDomainVerify { 23 using namespace OHOS::NetStack::HttpClient; 24 class IHttpTask { 25 public: 26 IHttpTask(); 27 virtual ~IHttpTask() = default; 28 virtual std::shared_ptr<OHOS::NetStack::HttpClient::HttpClientTask> CreateHttpClientTask() = 0; 29 virtual void OnSuccess(const HttpClientRequest& request, const HttpClientResponse& response) = 0; 30 31 virtual void OnCancel(const HttpClientRequest& request, const HttpClientResponse& response) = 0; 32 33 virtual void OnFail( 34 const HttpClientRequest& request, const HttpClientResponse& response, const HttpClientError& error) = 0; 35 36 virtual void OnDataReceive(std::shared_ptr<OHOS::NetStack::HttpClient::HttpClientTask> task, 37 const HttpClientRequest& request, const uint8_t* data, size_t length) = 0; 38 uint32_t GetTaskId(); 39 40 private: 41 uint32_t taskId_; 42 }; 43 } 44 #endif // APP_DOMAIN_VERIFY_I_HTTP_TASK_H 45