diff --git a/frameworks/ets/ani/http/ets/@ohos.net.http.ets b/frameworks/ets/ani/http/ets/@ohos.net.http.ets index 6ec5aac9b03ba17ea38989f052e9e03f0719765f..c31f78d6b1fd9f974fe9bdf83855a1a32e14746e 100644 --- a/frameworks/ets/ani/http/ets/@ohos.net.http.ets +++ b/frameworks/ets/ani/http/ets/@ohos.net.http.ets @@ -184,11 +184,16 @@ export default namespace http { request(url: string, options?: HttpRequestOptions): Promise; - requestInStream(url: string, callback: AsyncCallback): void; + requestInStreamWithCallback(url: string, callback: AsyncCallback): void; - requestInStream(url: string, options: HttpRequestOptions, callback: AsyncCallback): void; + requestInStreamWithOptionCallback(url: string, options: HttpRequestOptions, callback: AsyncCallback): void; - requestInStream(url: string, options?: HttpRequestOptions): Promise; + requestInStreamWithOptionsReturnsPromise(url: string, options?: HttpRequestOptions): Promise; + + overload requestInStream { + requestInStreamWithCallback, + requestInStreamWithOptionCallback, + requestInStreamWithOptionsReturnsPromise }; destroy(): void; @@ -242,15 +247,15 @@ export default namespace http { native requestInStreamInner(url: string, callback: AsyncCallback, options?: HttpRequestOptions): void; - requestInStream(url: string, callback: AsyncCallback): void { + requestInStreamWithCallback(url: string, callback: AsyncCallback): void { this.requestInStreamInner(url, callback); } - requestInStream(url: string, options: HttpRequestOptions, callback: AsyncCallback): void { + requestInStreamWithOptionCallback(url: string, options: HttpRequestOptions, callback: AsyncCallback): void { this.requestInStreamInner(url, callback, options); } - requestInStream(url: string, options?: HttpRequestOptions): Promise { + requestInStreamWithOptionsReturnsPromise(url: string, options?: HttpRequestOptions): Promise { return new Promise((resolve, reject) => { this.requestInStreamInner(url, (err: BusinessError | null, data: int | undefined) => { if (err) { @@ -535,9 +540,11 @@ export default namespace http { flush(): Promise; - delete(callback: AsyncCallback): void; + deleteWithCallback(callback: AsyncCallback): void; - delete(): Promise; + deleteReturnsPromise(): Promise; + + overload delete { deleteWithCallback, deleteReturnsPromise }; } export class HttpResponseCacheInner implements HttpResponseCache { @@ -585,7 +592,7 @@ export default namespace http { native deleteSync():void; - delete(callback: AsyncCallback): void { + deleteWithCallback(callback: AsyncCallback): void { let p1 = taskpool.execute((): undefined => { return this.deleteSync(); }) @@ -596,7 +603,7 @@ export default namespace http { }); } - delete(): Promise { + deleteReturnsPromise(): Promise { return new Promise((resolve, reject) => { taskpool.execute((): undefined => { return this.deleteSync(); diff --git a/frameworks/ets/ani/web_socket/ets/@ohos.net.webSocket.d.ets b/frameworks/ets/ani/web_socket/ets/@ohos.net.webSocket.d.ets index 3a74921863ff737c0a4af2f105a606c2b0b7b720..c4c595c183947facbb2fd8adcb033b410000cadf 100644 --- a/frameworks/ets/ani/web_socket/ets/@ohos.net.webSocket.d.ets +++ b/frameworks/ets/ani/web_socket/ets/@ohos.net.webSocket.d.ets @@ -73,15 +73,19 @@ export default namespace webSocket { // } export interface WebSocket { - connect(url: string, callback: AsyncCallback): void; + connectWithCallback(url: string, callback: AsyncCallback): void; - connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback): void; + connectWithOptionsCallback(url: string, options: WebSocketRequestOptions, callback: AsyncCallback): void; - connect(url: string, options?: WebSocketRequestOptions): Promise; + connectWithOptionsReturnsPromise(url: string, options?: WebSocketRequestOptions): Promise; - send(data: string | ArrayBuffer, callback: AsyncCallback): void; + overload connect { connectWithCallback, connectWithOptionsCallback, connectWithOptionsReturnsPromise }; - send(data: string | ArrayBuffer): Promise; + sendWithCallback(data: string | ArrayBuffer, callback: AsyncCallback): void; + + sendReturnsPromise(data: string | ArrayBuffer): Promise; + + overload send { sendWithCallback, sendReturnsPromise }; close(callback: AsyncCallback): void; @@ -135,7 +139,7 @@ export default namespace webSocket { native connectSync(url: string, options?: WebSocketRequestOptions): boolean; - connect(url: string, callback: AsyncCallback): void { + connectWithCallback(url: string, callback: AsyncCallback): void { let p1 = taskpool.execute((): boolean => { return this.connectSync(url); }) @@ -146,7 +150,7 @@ export default namespace webSocket { }); } - connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback): void { + connectWithOptionsCallback(url: string, options: WebSocketRequestOptions, callback: AsyncCallback): void { let p1 = taskpool.execute((): boolean => { return this.connectSync(url, options); }) @@ -157,7 +161,7 @@ export default namespace webSocket { }); } - connect(url: string, options?: WebSocketRequestOptions): Promise { + connectWithOptionsReturnsPromise(url: string, options?: WebSocketRequestOptions): Promise { return new Promise((resolve, reject) => { taskpool.execute((): boolean => { return this.connectSync(url, options); @@ -171,7 +175,7 @@ export default namespace webSocket { native sendSync(data: string | ArrayBuffer): boolean; - send(data: string | ArrayBuffer, callback: AsyncCallback): void { + sendWithCallback(data: string | ArrayBuffer, callback: AsyncCallback): void { let p1 = taskpool.execute((): boolean => { return this.sendSync(data); }) @@ -182,7 +186,7 @@ export default namespace webSocket { }); } - send(data: string | ArrayBuffer): Promise { + sendReturnsPromise(data: string | ArrayBuffer): Promise { return new Promise((resolve, reject) => { taskpool.execute((): boolean => { return this.sendSync(data);