1/* 2 * Copyright (c) 2021-2022 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/** 17 * @file 18 * @kit ArkTS 19 */ 20 21/** 22 * The url module provides utilities for URL resolution and parsing. 23 * 24 * @namespace url 25 * @syscap SystemCapability.Utils.Lang 26 * @since 7 27 */ 28/** 29 * The url module provides utilities for URL resolution and parsing. 30 * 31 * @namespace url 32 * @syscap SystemCapability.Utils.Lang 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * The url module provides APIs for parsing URL strings and constructing URL instances to process URL strings. 38 * 39 * @namespace url 40 * @syscap SystemCapability.Utils.Lang 41 * @crossplatform 42 * @atomicservice 43 * @since arkts {'1.1':'11', '1.2':'20'} 44 * @arkts 1.1&1.2 45 */ 46declare namespace url { 47 /** 48 * The URLSearchParams interface defines some practical methods to process URL query strings. 49 * 50 * @syscap SystemCapability.Utils.Lang 51 * @since 7 52 * @deprecated since 9 53 * @useinstead ohos.url.URLParams 54 * @name URLSearchParams 55 */ 56 class URLSearchParams { 57 /** 58 * A parameterized constructor used to create an URLSearchParams instance. 59 * As the input parameter of the constructor function, init supports four types. 60 * The input parameter is a character string two-dimensional array. 61 * The input parameter is the object list. 62 * The input parameter is a character string. 63 * The input parameter is the URLSearchParams object. 64 * 65 * @param { string[][] | Record<string, string> | string | URLSearchParams } init - init init 66 * @syscap SystemCapability.Utils.Lang 67 * @since 7 68 * @deprecated since 9 69 * @useinstead ohos.url.URLParams.constructor 70 */ 71 constructor(init?: string[][] | Record<string, string> | string | URLSearchParams); 72 73 /** 74 * Appends a specified key/value pair as a new search parameter. 75 * 76 * @param { string } name - name name Key name of the search parameter to be inserted. 77 * @param { string } value - value value Values of search parameters to be inserted. 78 * @syscap SystemCapability.Utils.Lang 79 * @since 7 80 * @deprecated since 9 81 * @useinstead ohos.url.URLParams.append 82 */ 83 append(name: string, value: string): void; 84 85 /** 86 * Deletes the given search parameter and its associated value,from the list of all search parameters. 87 * 88 * @param { string } name - name name Name of the key-value pair to be deleted. 89 * @syscap SystemCapability.Utils.Lang 90 * @since 7 91 * @deprecated since 9 92 * @useinstead ohos.url.URLParams.delete 93 */ 94 delete(name: string): void; 95 96 /** 97 * Returns all key-value pairs associated with a given search parameter as an array. 98 * 99 * @param { string } name - name name Specifies the name of a key value. 100 * @returns { string[] } string[] Returns all key-value pairs with the specified name. 101 * @syscap SystemCapability.Utils.Lang 102 * @since 7 103 * @deprecated since 9 104 * @useinstead ohos.url.URLParams.getAll 105 */ 106 getAll(name: string): string[]; 107 108 /** 109 * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 110 * The first item of Array is name, and the second item of Array is value. 111 * 112 * @returns { IterableIterator<[string, string]> } Returns an iterator for ES6. 113 * @syscap SystemCapability.Utils.Lang 114 * @since 7 115 * @deprecated since 9 116 * @useinstead ohos.url.URLParams.entries 117 */ 118 entries(): IterableIterator<[string, string]>; 119 120 /** 121 * Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. 122 * 123 * @param { function } callbackFn - callbackFn callbackFn Current traversal key value. 124 * @param { Object } thisArg - thisArg thisArg thisArg to be used as this value for when callbackFn is called 125 * @syscap SystemCapability.Utils.Lang 126 * @since 7 127 * @deprecated since 9 128 * @useinstead ohos.url.URLParams.forEach 129 */ 130 forEach(callbackFn: (value: string, key: string, searchParams: URLSearchParams) => void, thisArg?: Object): void; 131 132 /** 133 * Returns the first value associated to the given search parameter. 134 * 135 * @param { string } name - name name Specifies the name of a key-value pair. 136 * @returns { string | null } Returns the first value found by name. If no value is found, null is returned. 137 * @syscap SystemCapability.Utils.Lang 138 * @since 7 139 * @deprecated since 9 140 * @useinstead ohos.url.URLParams.get 141 */ 142 get(name: string): string | null; 143 144 /** 145 * Returns a Boolean that indicates whether a parameter with the specified name exists. 146 * 147 * @param { string } name - name name Specifies the name of a key-value pair. 148 * @returns { boolean } Returns a Boolean value that indicates whether a found 149 * @syscap SystemCapability.Utils.Lang 150 * @since 7 151 * @deprecated since 9 152 * @useinstead ohos.url.URLParams.has 153 */ 154 has(name: string): boolean; 155 156 /** 157 * Sets the value associated with a given search parameter to the 158 * given value. If there were several matching values, this method 159 * deletes the others. If the search parameter doesn't exist, this 160 * method creates it. 161 * 162 * @param { string } name - name name Key name of the parameter to be set. 163 * @param { string } value - value value Indicates the parameter value to be set. 164 * @syscap SystemCapability.Utils.Lang 165 * @since 7 166 * @deprecated since 9 167 * @useinstead ohos.url.URLParams.set 168 */ 169 set(name: string, value: string): void; 170 171 /** 172 * Sort all key/value pairs contained in this object in place and return undefined. 173 * 174 * @syscap SystemCapability.Utils.Lang 175 * @since 7 176 * @deprecated since 9 177 * @useinstead ohos.url.URLParams.sort 178 */ 179 sort(): void; 180 181 /** 182 * Returns an iterator allowing to go through all keys contained in this object. 183 * 184 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the names of each name-value pair. 185 * @syscap SystemCapability.Utils.Lang 186 * @since 7 187 * @deprecated since 9 188 * @useinstead ohos.url.URLParams.keys 189 */ 190 keys(): IterableIterator<string>; 191 192 /** 193 * Returns an iterator allowing to go through all values contained in this object. 194 * 195 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the values of each name-value pair. 196 * @syscap SystemCapability.Utils.Lang 197 * @since 7 198 * @deprecated since 9 199 * @useinstead ohos.url.URLParams.values 200 */ 201 values(): IterableIterator<string>; 202 203 /** 204 * Returns an iterator allowing to go through all key/value 205 * pairs contained in this object. 206 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 207 * The first item of Array is name, and the second item of Array is value. 208 * @syscap SystemCapability.Utils.Lang 209 * @since 7 210 * @deprecated since 9 211 * @useinstead ohos.url.URLParams.[Symbol.iterator] 212 */ 213 [Symbol.iterator](): IterableIterator<[string, string]>; 214 215 /** 216 * Returns a query string suitable for use in a URL. 217 * 218 * @returns { string } Returns a search parameter serialized as a string, percent-encoded if necessary. 219 * @syscap SystemCapability.Utils.Lang 220 * @since 7 221 * @deprecated since 9 222 * @useinstead ohos.url.URLParams.toString 223 */ 224 toString(): string; 225 } 226 227 /** 228 * The URLParams interface defines some practical methods to process URL query strings. 229 * 230 * @syscap SystemCapability.Utils.Lang 231 * @since 9 232 * @name URLParams 233 */ 234 /** 235 * The URLParams interface defines some practical methods to process URL query strings. 236 * 237 * @syscap SystemCapability.Utils.Lang 238 * @crossplatform 239 * @since 10 240 * @name URLParams 241 */ 242 /** 243 * The URLParams interface defines some practical methods to process URL query strings. 244 * 245 * @syscap SystemCapability.Utils.Lang 246 * @crossplatform 247 * @atomicservice 248 * @since arkts {'1.1':'11', '1.2':'20'} 249 * @arkts 1.1&1.2 250 * @name URLParams 251 */ 252 class URLParams { 253 /** 254 * A parameterized constructor used to create an URLParams instance. 255 * As the input parameter of the constructor function, init supports four types. 256 * The input parameter is a character string two-dimensional array. 257 * The input parameter is the object list. 258 * The input parameter is a character string. 259 * The input parameter is the URLParams object. 260 * 261 * @param { string[][] | Record<string, string> | string | URLParams } [init] - init init 262 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types; 3.Parameter verification failed. 263 * @syscap SystemCapability.Utils.Lang 264 * @since 9 265 */ 266 /** 267 * A parameterized constructor used to create an URLParams instance. 268 * As the input parameter of the constructor function, init supports four types. 269 * The input parameter is a character string two-dimensional array. 270 * The input parameter is the object list. 271 * The input parameter is a character string. 272 * The input parameter is the URLParams object. 273 * 274 * @param { string[][] | Record<string, string> | string | URLParams } [init] - init init 275 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types; 2.Parameter verification failed. 276 * @syscap SystemCapability.Utils.Lang 277 * @crossplatform 278 * @since 10 279 */ 280 /** 281 * A constructor used to create a URLParams instance. 282 * 283 * @param { string[][] | Record<string, string> | string | URLParams } [init] - Input parameter objects, which include the following: 284 * - string[][]: two-dimensional string array. 285 * - Record<string, string>: list of objects. 286 * - string: string. 287 * - URLParams: object. 288 * The default value is null. 289 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types; 2.Parameter verification failed. 290 * @syscap SystemCapability.Utils.Lang 291 * @crossplatform 292 * @atomicservice 293 * @since 11 294 */ 295 constructor(init?: string[][] | Record<string, string> | string | URLParams); 296 297 /** 298 * A parameterized constructor used to create an URLParams instance. 299 * As the input parameter of the constructor function, init supports four types. 300 * The input parameter is a character string two-dimensional array. 301 * The input parameter is the object list. 302 * The input parameter is a character string. 303 * The input parameter is the URLParams object. 304 * 305 * @param { [string, string][] | Record<string, string> | string | URLParams } [init] - init init 306 * @syscap SystemCapability.Utils.Lang 307 * @crossplatform 308 * @atomicservice 309 * @since 20 310 * @arkts 1.2 311 */ 312 constructor(init?: [string, string][] | Record<string, string> | string | URLParams); 313 314 /** 315 * Appends a specified key/value pair as a new search parameter. 316 * 317 * @param { string } name - name name Key name of the search parameter to be inserted. 318 * @param { string } value - value value Values of search parameters to be inserted. 319 * @throws { BusinessError } 401 - Parameter error. Possible causes: 320 * 1.Mandatory parameters are left unspecified; 321 * 2.Incorrect parameter types; 322 * 3.Parameter verification failed. 323 * @syscap SystemCapability.Utils.Lang 324 * @since 9 325 */ 326 /** 327 * Appends a specified key/value pair as a new search parameter. 328 * 329 * @param { string } name - name name Key name of the search parameter to be inserted. 330 * @param { string } value - value value Values of search parameters to be inserted. 331 * @throws { BusinessError } 401 - Parameter error. Possible causes: 332 * 1.Mandatory parameters are left unspecified; 333 * 2.Incorrect parameter types; 334 * 3.Parameter verification failed. 335 * @syscap SystemCapability.Utils.Lang 336 * @crossplatform 337 * @since 10 338 */ 339 /** 340 * Appends a key-value pair into the query string. 341 * 342 * @param { string } name - Key of the key-value pair to append. 343 * @param { string } value - Value of the key-value pair to append. 344 * @throws { BusinessError } 401 - Parameter error. Possible causes: 345 * 1.Mandatory parameters are left unspecified; 346 * 2.Incorrect parameter types; 347 * 3.Parameter verification failed. 348 * @syscap SystemCapability.Utils.Lang 349 * @crossplatform 350 * @atomicservice 351 * @since arkts {'1.1':'11', '1.2':'20'} 352 * @arkts 1.1&1.2 353 */ 354 append(name: string, value: string): void; 355 356 /** 357 * Deletes the given search parameter and its associated value,from the list of all search parameters. 358 * 359 * @param { string } name - name name Name of the key-value pair to be deleted. 360 * @throws { BusinessError } 401 - Parameter error. Possible causes: 361 * 1.Mandatory parameters are left unspecified; 362 * 2.Incorrect parameter types; 363 * 3.Parameter verification failed. 364 * @syscap SystemCapability.Utils.Lang 365 * @since 9 366 */ 367 /** 368 * Deletes the given search parameter and its associated value,from the list of all search parameters. 369 * 370 * @param { string } name - name name Name of the key-value pair to be deleted. 371 * @throws { BusinessError } 401 - Parameter error. Possible causes: 372 * 1.Mandatory parameters are left unspecified; 373 * 2.Incorrect parameter types; 374 * 3.Parameter verification failed. 375 * @syscap SystemCapability.Utils.Lang 376 * @crossplatform 377 * @since 10 378 */ 379 /** 380 * Deletes key-value pairs of the specified key. 381 * 382 * @param { string } name - Key of the key-value pairs to delete. 383 * @throws { BusinessError } 401 - Parameter error. Possible causes: 384 * 1.Mandatory parameters are left unspecified; 385 * 2.Incorrect parameter types; 386 * 3.Parameter verification failed. 387 * @syscap SystemCapability.Utils.Lang 388 * @crossplatform 389 * @atomicservice 390 * @since arkts {'1.1':'11', '1.2':'20'} 391 * @arkts 1.1&1.2 392 */ 393 delete(name: string): void; 394 395 /** 396 * Returns all key-value pairs associated with a given search parameter as an array. 397 * 398 * @param { string } name - name name Specifies the name of a key value. 399 * @returns { string[] } string[] Returns all key-value pairs with the specified name. 400 * @throws { BusinessError } 401 - Parameter error. Possible causes: 401 * 1.Mandatory parameters are left unspecified; 402 * 2.Incorrect parameter types; 403 * 3.Parameter verification failed. 404 * @syscap SystemCapability.Utils.Lang 405 * @since 9 406 */ 407 /** 408 * Returns all key-value pairs associated with a given search parameter as an array. 409 * 410 * @param { string } name - name name Specifies the name of a key value. 411 * @returns { string[] } string[] Returns all key-value pairs with the specified name. 412 * @throws { BusinessError } 401 - Parameter error. Possible causes: 413 * 1.Mandatory parameters are left unspecified; 414 * 2.Incorrect parameter types; 415 * 3.Parameter verification failed. 416 * @syscap SystemCapability.Utils.Lang 417 * @crossplatform 418 * @since 10 419 */ 420 /** 421 * Obtains all the values based on the specified key. 422 * 423 * @param { string } name - Target key. 424 * @returns { string[] } string[] Returns all key-value pairs with the specified name. 425 * @throws { BusinessError } 401 - Parameter error. Possible causes: 426 * 1.Mandatory parameters are left unspecified; 427 * 2.Incorrect parameter types; 428 * 3.Parameter verification failed. 429 * @syscap SystemCapability.Utils.Lang 430 * @crossplatform 431 * @atomicservice 432 * @since 11 433 */ 434 getAll(name: string): string[]; 435 436 /** 437 * Obtains all the values based on the specified key. 438 * 439 * @param { string } name - Target key. 440 * @returns { Array<string> } Array<string> Returns all key-value pairs with the specified name. 441 * @syscap SystemCapability.Utils.Lang 442 * @crossplatform 443 * @atomicservice 444 * @since 20 445 * @arkts 1.2 446 */ 447 getAll(name: string): Array<string>; 448 449 /** 450 * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 451 * The first item of Array is name, and the second item of Array is value. 452 * 453 * @returns { IterableIterator<[string, string]> } Returns an iterator for ES6. 454 * @syscap SystemCapability.Utils.Lang 455 * @since 9 456 */ 457 /** 458 * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 459 * The first item of Array is name, and the second item of Array is value. 460 * 461 * @returns { IterableIterator<[string, string]> } Returns an iterator for ES6. 462 * @syscap SystemCapability.Utils.Lang 463 * @crossplatform 464 * @since 10 465 */ 466 /** 467 * Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of 468 * each array are the key and value respectively. 469 * 470 * @returns { IterableIterator<[string, string]> } Returns an iterator for ES6. 471 * @syscap SystemCapability.Utils.Lang 472 * @crossplatform 473 * @atomicservice 474 * @since arkts {'1.1':'11', '1.2':'20'} 475 * @arkts 1.1&1.2 476 */ 477 entries(): IterableIterator<[string, string]>; 478 479 /** 480 * Callback functions are used to traverse key-value pairs on the URLParams instance object. 481 * 482 * @param { function } callbackFn - callbackFn value Current traversal key value, 483 * key Indicates the name of the key that is traversed. 484 * @param { Object } [thisArg] - thisArg thisArg to be used as this value for when callbackFn is called 485 * @throws { BusinessError } 401 - Parameter error. Possible causes: 486 * 1.Mandatory parameters are left unspecified; 487 * 2.Incorrect parameter types; 488 * 3.Parameter verification failed. 489 * @syscap SystemCapability.Utils.Lang 490 * @since 9 491 */ 492 /** 493 * Callback functions are used to traverse key-value pairs on the URLParams instance object. 494 * 495 * @param { function } callbackFn - callbackFn value Current traversal key value, 496 * key Indicates the name of the key that is traversed. 497 * @param { Object } [thisArg] - thisArg thisArg to be used as this value for when callbackFn is called 498 * @throws { BusinessError } 401 - Parameter error. Possible causes: 499 * 1.Mandatory parameters are left unspecified; 500 * 2.Incorrect parameter types; 501 * 3.Parameter verification failed. 502 * @syscap SystemCapability.Utils.Lang 503 * @crossplatform 504 * @since 10 505 */ 506 /** 507 * Callback functions are used to traverse key-value pairs on the URLParams instance object. 508 * 509 * @param { function } callbackFn - callbackFn value Current traversal key value, 510 * key Indicates the name of the key that is traversed. 511 * @param { Object } [thisArg] - thisArg thisArg to be used as this value for when callbackFn is called 512 * @throws { BusinessError } 401 - Parameter error. Possible causes: 513 * 1.Mandatory parameters are left unspecified; 514 * 2.Incorrect parameter types; 515 * 3.Parameter verification failed. 516 * @syscap SystemCapability.Utils.Lang 517 * @crossplatform 518 * @atomicservice 519 * @since 11 520 */ 521 forEach(callbackFn: (value: string, key: string, searchParams: URLParams) => void, thisArg?: Object): void; 522 523 /** 524 * Iterates over a collection (e.g., URLs) and executes a callback function for each element. 525 * 526 * @param { UrlCbFn } callbackFn - A callback function to execute for each element. 527 * @syscap SystemCapability.Utils.Lang 528 * @crossplatform 529 * @atomicservice 530 * @since 20 531 * @arkts 1.2 532 */ 533 forEach(callbackFn: UrlCbFn): void; 534 535 /** 536 * Returns the first value associated to the given search parameter. 537 * 538 * @param { string } name - name name Specifies the name of a key-value pair. 539 * @returns { string | null } Returns the first value found by name. If no value is found, null is returned. 540 * @throws { BusinessError } 401 - Parameter error. Possible causes: 541 * 1.Mandatory parameters are left unspecified; 542 * 2.Incorrect parameter types; 543 * 3.Parameter verification failed. 544 * @syscap SystemCapability.Utils.Lang 545 * @since 9 546 */ 547 /** 548 * Returns the first value associated to the given search parameter. 549 * 550 * @param { string } name - name name Specifies the name of a key-value pair. 551 * @returns { string | null } Returns the first value found by name. If no value is found, null is returned. 552 * @throws { BusinessError } 401 - Parameter error. Possible causes: 553 * 1.Mandatory parameters are left unspecified; 554 * 2.Incorrect parameter types; 555 * 3.Parameter verification failed. 556 * @syscap SystemCapability.Utils.Lang 557 * @crossplatform 558 * @since 10 559 */ 560 /** 561 * Obtains the value of the first key-value pair based on the specified key. 562 * 563 * @param { string } name - Key specified to obtain the value. 564 * @returns { string | null } Returns the first value found by name. If no value is found, null is returned. 565 * @throws { BusinessError } 401 - Parameter error. Possible causes: 566 * 1.Mandatory parameters are left unspecified; 567 * 2.Incorrect parameter types; 568 * 3.Parameter verification failed. 569 * @syscap SystemCapability.Utils.Lang 570 * @crossplatform 571 * @atomicservice 572 * @since 11 573 */ 574 get(name: string): string | null; 575 576 /** 577 * Obtains the value of the first key-value pair based on the specified key. 578 * 579 * @param { string } name - Key specified to obtain the value. 580 * @returns { string | undefined } Returns the first value found by name. 581 * If no value is found, undefined is returned. 582 * @syscap SystemCapability.Utils.Lang 583 * @crossplatform 584 * @atomicservice 585 * @since 20 586 * @arkts 1.2 587 */ 588 get(name: string): string | undefined; 589 590 /** 591 * Returns a Boolean that indicates whether a parameter with the specified name exists. 592 * 593 * @param { string } name - name name Specifies the name of a key-value pair. 594 * @returns { boolean } Returns a Boolean value that indicates whether a found 595 * @throws { BusinessError } 401 - Parameter error. Possible causes: 596 * 1.Mandatory parameters are left unspecified; 597 * 2.Incorrect parameter types. 598 * @syscap SystemCapability.Utils.Lang 599 * @since 9 600 */ 601 /** 602 * Returns a Boolean that indicates whether a parameter with the specified name exists. 603 * 604 * @param { string } name - name name Specifies the name of a key-value pair. 605 * @returns { boolean } Returns a Boolean value that indicates whether a found 606 * @throws { BusinessError } 401 - Parameter error. Possible causes: 607 * 1.Mandatory parameters are left unspecified; 608 * 2.Incorrect parameter types. 609 * @syscap SystemCapability.Utils.Lang 610 * @crossplatform 611 * @since 10 612 */ 613 /** 614 * Checks whether a key has a value. 615 * 616 * @param { string } name - Key specified to search for its value. 617 * @returns { boolean } Returns a Boolean value that indicates whether a found 618 * @throws { BusinessError } 401 - Parameter error. Possible causes: 619 * 1.Mandatory parameters are left unspecified; 620 * 2.Incorrect parameter types. 621 * @syscap SystemCapability.Utils.Lang 622 * @crossplatform 623 * @atomicservice 624 * @since arkts {'1.1':'11', '1.2':'20'} 625 * @arkts 1.1&1.2 626 */ 627 has(name: string): boolean; 628 629 /** 630 * Sets the value associated with a given search parameter to the 631 * given value. If there were several matching values, this method 632 * deletes the others. If the search parameter doesn't exist, this 633 * method creates it. 634 * 635 * @param { string } name - name name Key name of the parameter to be set. 636 * @param { string } value - value value Indicates the parameter value to be set. 637 * @throws { BusinessError } 401 - Parameter error. Possible causes: 638 * 1.Mandatory parameters are left unspecified; 639 * 2.Incorrect parameter types; 640 * 3.Parameter verification failed. 641 * @syscap SystemCapability.Utils.Lang 642 * @since 9 643 */ 644 /** 645 * Sets the value associated with a given search parameter to the 646 * given value. If there were several matching values, this method 647 * deletes the others. If the search parameter doesn't exist, this 648 * method creates it. 649 * 650 * @param { string } name - name name Key name of the parameter to be set. 651 * @param { string } value - value value Indicates the parameter value to be set. 652 * @throws { BusinessError } 401 - Parameter error. Possible causes: 653 * 1.Mandatory parameters are left unspecified; 654 * 2.Incorrect parameter types; 655 * 3.Parameter verification failed. 656 * @syscap SystemCapability.Utils.Lang 657 * @crossplatform 658 * @since 10 659 */ 660 /** 661 * Sets the value for a key. If key-value pairs matching the specified key exist, the value of the first key-value 662 * pair will be set to the specified value and other key-value pairs will be deleted. Otherwise, the key-value pair 663 * will be appended to the query string. 664 * 665 * @param { string } name - Key of the value to set. 666 * @param { string } value - Value to set. 667 * @throws { BusinessError } 401 - Parameter error. Possible causes: 668 * 1.Mandatory parameters are left unspecified; 669 * 2.Incorrect parameter types; 670 * 3.Parameter verification failed. 671 * @syscap SystemCapability.Utils.Lang 672 * @crossplatform 673 * @atomicservice 674 * @since arkts {'1.1':'11', '1.2':'20'} 675 * @arkts 1.1&1.2 676 */ 677 set(name: string, value: string): void; 678 679 /** 680 * Sort all key/value pairs contained in this object in place and return undefined. 681 * 682 * @syscap SystemCapability.Utils.Lang 683 * @since 9 684 */ 685 /** 686 * Sort all key/value pairs contained in this object in place and return undefined. 687 * 688 * @syscap SystemCapability.Utils.Lang 689 * @crossplatform 690 * @since 10 691 */ 692 /** 693 * Sorts all key-value pairs contained in this object based on the Unicode code points of the keys and returns 694 * undefined. This method uses a stable sorting algorithm, that is, the relative order between key-value pairs 695 * with equal keys is retained. 696 * 697 * @syscap SystemCapability.Utils.Lang 698 * @crossplatform 699 * @atomicservice 700 * @since arkts {'1.1':'11', '1.2':'20'} 701 * @arkts 1.1&1.2 702 */ 703 sort(): void; 704 705 /** 706 * Returns an iterator allowing to go through all keys contained in this object. 707 * 708 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the names of each name-value pair. 709 * @syscap SystemCapability.Utils.Lang 710 * @since 9 711 */ 712 /** 713 * Returns an iterator allowing to go through all keys contained in this object. 714 * 715 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the names of each name-value pair. 716 * @syscap SystemCapability.Utils.Lang 717 * @crossplatform 718 * @since 10 719 */ 720 /** 721 * Obtains an ES6 iterator that contains the keys of all the key-value pairs. 722 * 723 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the names of each name-value pair. 724 * @syscap SystemCapability.Utils.Lang 725 * @crossplatform 726 * @atomicservice 727 * @since arkts {'1.1':'11', '1.2':'20'} 728 * @arkts 1.1&1.2 729 */ 730 keys(): IterableIterator<string>; 731 732 /** 733 * Returns an iterator allowing to go through all values contained in this object. 734 * 735 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the values of each name-value pair. 736 * @syscap SystemCapability.Utils.Lang 737 * @since 9 738 */ 739 /** 740 * Returns an iterator allowing to go through all values contained in this object. 741 * 742 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the values of each name-value pair. 743 * @syscap SystemCapability.Utils.Lang 744 * @crossplatform 745 * @since 10 746 */ 747 /** 748 * Obtains an ES6 iterator that contains the values of all the key-value pairs. 749 * 750 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the values of each name-value pair. 751 * @syscap SystemCapability.Utils.Lang 752 * @crossplatform 753 * @atomicservice 754 * @since arkts {'1.1':'11', '1.2':'20'} 755 * @arkts 1.1&1.2 756 */ 757 values(): IterableIterator<string>; 758 759 /** 760 * Returns an iterator allowing to go through all key/value 761 * pairs contained in this object. 762 * 763 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 764 * The first item of Array is name, and the second item of Array is value. 765 * @syscap SystemCapability.Utils.Lang 766 * @since 9 767 */ 768 /** 769 * Returns an iterator allowing to go through all key/value 770 * pairs contained in this object. 771 * 772 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 773 * The first item of Array is name, and the second item of Array is value. 774 * @syscap SystemCapability.Utils.Lang 775 * @crossplatform 776 * @since 10 777 */ 778 /** 779 * Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields ofeach array are 780 * the key and value respectively. 781 * 782 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 783 * The first item of Array is name, and the second item of Array is value. 784 * @syscap SystemCapability.Utils.Lang 785 * @crossplatform 786 * @atomicservice 787 * @since 11 788 */ 789 [Symbol.iterator](): IterableIterator<[string, string]>; 790 791 /** 792 * Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields ofeach array are 793 * the key and value respectively. 794 * 795 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. 796 * Each item of the iterator is a JavaScript Array. 797 * The first item of Array is name, and the second item of Array is value. 798 * @syscap SystemCapability.Utils.Lang 799 * @crossplatform 800 * @atomicservice 801 * @since 20 802 * @arkts 1.2 803 */ 804 $_iterator(): IterableIterator<[string, string]>; 805 806 /** 807 * Returns a query string suitable for use in a URL. 808 * 809 * @returns { string } Returns a search parameter serialized as a string, percent-encoded if necessary. 810 * @syscap SystemCapability.Utils.Lang 811 * @since 9 812 */ 813 /** 814 * Returns a query string suitable for use in a URL. 815 * 816 * @returns { string } Returns a search parameter serialized as a string, percent-encoded if necessary. 817 * @syscap SystemCapability.Utils.Lang 818 * @crossplatform 819 * @since 10 820 */ 821 /** 822 * Obtains search parameters that are serialized as a string and, if necessary, percent-encodes the characters in the string. 823 * 824 * @returns { string } Returns a search parameter serialized as a string, percent-encoded if necessary. 825 * @syscap SystemCapability.Utils.Lang 826 * @crossplatform 827 * @atomicservice 828 * @since arkts {'1.1':'11', '1.2':'20'} 829 * @arkts 1.1&1.2 830 */ 831 toString(): string; 832 } 833 834 /** 835 * The interface of URL is used to parse, construct, normalize, and encode URLs. 836 * 837 * @syscap SystemCapability.Utils.Lang 838 * @since 7 839 * @name URL 840 */ 841 /** 842 * The interface of URL is used to parse, construct, normalize, and encode URLs. 843 * 844 * @syscap SystemCapability.Utils.Lang 845 * @crossplatform 846 * @since 10 847 * @name URL 848 */ 849 /** 850 * The interface of URL is used to parse, construct, normalize, and encode URLs. 851 * 852 * @syscap SystemCapability.Utils.Lang 853 * @crossplatform 854 * @atomicservice 855 * @since arkts {'1.1':'11', '1.2':'20'} 856 * @arkts 1.1&1.2 857 * @name URL 858 */ 859 class URL { 860 /** 861 * URL constructor, which is used to instantiate a URL object. 862 * url: Absolute or relative input URL to resolve. Base is required if input is relative. 863 * If input is an absolute value, base ignores the value. 864 * base: Base URL to parse if input is not absolute. 865 * 866 * @param { string } url - url url 867 * @param { string | URL } base - base base 868 * @syscap SystemCapability.Utils.Lang 869 * @since 7 870 * @deprecated since 9 871 * @useinstead ohos.url.URL.parseURL 872 */ 873 constructor(url: string, base?: string | URL); 874 875 /** 876 * URL constructor, which is used to instantiate a URL object. 877 * 878 * @syscap SystemCapability.Utils.Lang 879 * @since 9 880 */ 881 /** 882 * URL constructor, which is used to instantiate a URL object. 883 * 884 * @syscap SystemCapability.Utils.Lang 885 * @crossplatform 886 * @since 10 887 */ 888 /** 889 * A no-argument constructor used to create a URL. It returns a URL object after parseURL is called. 890 * It is not used independently. 891 * 892 * @syscap SystemCapability.Utils.Lang 893 * @crossplatform 894 * @atomicservice 895 * @since arkts {'1.1':'11', '1.2':'20'} 896 * @arkts 1.1&1.2 897 */ 898 constructor(); 899 900 /** 901 * Replaces the original constructor to process arguments and return a url object. 902 * 903 * @param { string } url - url url Absolute or relative input URL to resolve. Base is required if input is relative. 904 * If input is an absolute value, base ignores the value. 905 * @param { string | URL } [base] - base base Base URL to parse if input is not absolute. 906 * @returns { URL } 907 * @throws { BusinessError } 401 - Parameter error. Possible causes: 908 * 1.Mandatory parameters are left unspecified; 909 * 2.Incorrect parameter types; 910 * 3.Parameter verification failed. 911 * @throws { BusinessError } 10200002 - Invalid url string. 912 * @syscap SystemCapability.Utils.Lang 913 * @since 9 914 */ 915 /** 916 * Replaces the original constructor to process arguments and return a url object. 917 * 918 * @param { string } url - url url Absolute or relative input URL to resolve. Base is required if input is relative. 919 * If input is an absolute value, base ignores the value. 920 * @param { string | URL } [base] - base base Base URL to parse if input is not absolute. 921 * @returns { URL } 922 * @throws { BusinessError } 401 - Parameter error. Possible causes: 923 * 1.Mandatory parameters are left unspecified; 924 * 2.Incorrect parameter types; 925 * 3.Parameter verification failed. 926 * @throws { BusinessError } 10200002 - Invalid url string. 927 * @syscap SystemCapability.Utils.Lang 928 * @crossplatform 929 * @since 10 930 */ 931 /** 932 * Parses a URL. 933 * 934 * @param { string } url - A string representing an absolute or a relative URL. 935 * In the case of a relative URL, you must specify base to parse the final URL. 936 * In the case of an absolute URL, the passed base will be ignored. 937 * @param { string | URL } [base] - Either a string or an object. The default value is undefined. 938 * - string: string. 939 * - URL: URL object. 940 * This parameter is used when url is a relative URL. 941 * @returns { URL } 942 * @throws { BusinessError } 401 - Parameter error. Possible causes: 943 * 1.Mandatory parameters are left unspecified; 944 * 2.Incorrect parameter types; 945 * 3.Parameter verification failed. 946 * @throws { BusinessError } 10200002 - Invalid url string. 947 * @syscap SystemCapability.Utils.Lang 948 * @crossplatform 949 * @atomicservice 950 * @since arkts {'1.1':'11', '1.2':'20'} 951 * @arkts 1.1&1.2 952 */ 953 static parseURL(url: string, base?: string | URL): URL; 954 955 /** 956 * Returns the serialized URL as a string. 957 * 958 * @returns { string } Returns the serialized URL as a string. 959 * @syscap SystemCapability.Utils.Lang 960 * @since 7 961 */ 962 /** 963 * Returns the serialized URL as a string. 964 * 965 * @returns { string } Returns the serialized URL as a string. 966 * @syscap SystemCapability.Utils.Lang 967 * @crossplatform 968 * @since 10 969 */ 970 /** 971 * Converts the parsed URL into a string. 972 * 973 * @returns { string } Returns the serialized URL as a string. 974 * @syscap SystemCapability.Utils.Lang 975 * @crossplatform 976 * @atomicservice 977 * @since arkts {'1.1':'11', '1.2':'20'} 978 * @arkts 1.1&1.2 979 */ 980 toString(): string; 981 982 /** 983 * Returns the serialized URL as a string. 984 * 985 * @returns { string } Returns the serialized URL as a string. 986 * @syscap SystemCapability.Utils.Lang 987 * @since 7 988 */ 989 /** 990 * Returns the serialized URL as a string. 991 * 992 * @returns { string } Returns the serialized URL as a string. 993 * @syscap SystemCapability.Utils.Lang 994 * @crossplatform 995 * @since 10 996 */ 997 /** 998 * Converts the parsed URL into a JSON string. 999 * 1000 * @returns { string } Returns the serialized URL as a string. 1001 * @syscap SystemCapability.Utils.Lang 1002 * @crossplatform 1003 * @atomicservice 1004 * @since arkts {'1.1':'11', '1.2':'20'} 1005 * @arkts 1.1&1.2 1006 */ 1007 toJSON(): string; 1008 1009 /** 1010 * Gets and sets the fragment portion of the URL. 1011 * 1012 * @type { string } 1013 * @syscap SystemCapability.Utils.Lang 1014 * @since 7 1015 */ 1016 /** 1017 * Gets and sets the fragment portion of the URL. 1018 * 1019 * @type { string } 1020 * @syscap SystemCapability.Utils.Lang 1021 * @crossplatform 1022 * @since 10 1023 */ 1024 /** 1025 * Gets and sets the fragment portion of the URL. 1026 * 1027 * @type { string } 1028 * @syscap SystemCapability.Utils.Lang 1029 * @crossplatform 1030 * @atomicservice 1031 * @since 11 1032 */ 1033 hash: string; 1034 1035 /** 1036 * Gets and sets the host portion of the URL. 1037 * 1038 * @type { string } 1039 * @syscap SystemCapability.Utils.Lang 1040 * @since 7 1041 */ 1042 /** 1043 * Gets and sets the host portion of the URL. 1044 * 1045 * @type { string } 1046 * @syscap SystemCapability.Utils.Lang 1047 * @crossplatform 1048 * @since 10 1049 */ 1050 /** 1051 * Gets and sets the host portion of the URL. 1052 * 1053 * @type { string } 1054 * @syscap SystemCapability.Utils.Lang 1055 * @crossplatform 1056 * @atomicservice 1057 * @since 11 1058 */ 1059 host: string; 1060 1061 /** 1062 * Gets and sets the host name portion of the URL,not include the port. 1063 * 1064 * @type { string } 1065 * @syscap SystemCapability.Utils.Lang 1066 * @since 7 1067 */ 1068 /** 1069 * Gets and sets the host name portion of the URL,not include the port. 1070 * 1071 * @type { string } 1072 * @syscap SystemCapability.Utils.Lang 1073 * @crossplatform 1074 * @since 10 1075 */ 1076 /** 1077 * Gets and sets the host name portion of the URL,not include the port. 1078 * 1079 * @type { string } 1080 * @syscap SystemCapability.Utils.Lang 1081 * @crossplatform 1082 * @atomicservice 1083 * @since 11 1084 */ 1085 hostname: string; 1086 1087 /** 1088 * Gets and sets the serialized URL. 1089 * 1090 * @type { string } 1091 * @syscap SystemCapability.Utils.Lang 1092 * @since 7 1093 */ 1094 /** 1095 * Gets and sets the serialized URL. 1096 * 1097 * @type { string } 1098 * @syscap SystemCapability.Utils.Lang 1099 * @crossplatform 1100 * @since 10 1101 */ 1102 /** 1103 * Gets and sets the serialized URL. 1104 * 1105 * @type { string } 1106 * @syscap SystemCapability.Utils.Lang 1107 * @crossplatform 1108 * @atomicservice 1109 * @since 11 1110 */ 1111 href: string; 1112 1113 /** 1114 * Gets the read-only serialization of the URL's origin. 1115 * 1116 * @type { string } 1117 * @syscap SystemCapability.Utils.Lang 1118 * @since 7 1119 */ 1120 /** 1121 * Gets the read-only serialization of the URL's origin. 1122 * 1123 * @type { string } 1124 * @syscap SystemCapability.Utils.Lang 1125 * @crossplatform 1126 * @since 10 1127 */ 1128 /** 1129 * Gets the read-only serialization of the URL's origin. 1130 * 1131 * @type { string } 1132 * @readonly 1133 * @syscap SystemCapability.Utils.Lang 1134 * @crossplatform 1135 * @atomicservice 1136 * @since 11 1137 */ 1138 readonly origin: string; 1139 1140 /** 1141 * Gets and sets the password portion of the URL. 1142 * 1143 * @type { string } 1144 * @syscap SystemCapability.Utils.Lang 1145 * @since 7 1146 */ 1147 /** 1148 * Gets and sets the password portion of the URL. 1149 * 1150 * @type { string } 1151 * @syscap SystemCapability.Utils.Lang 1152 * @crossplatform 1153 * @since 10 1154 */ 1155 /** 1156 * Gets and sets the password portion of the URL. 1157 * 1158 * @type { string } 1159 * @syscap SystemCapability.Utils.Lang 1160 * @crossplatform 1161 * @atomicservice 1162 * @since 11 1163 */ 1164 password: string; 1165 1166 /** 1167 * Gets and sets the path portion of the URL. 1168 * 1169 * @type { string } 1170 * @syscap SystemCapability.Utils.Lang 1171 * @since 7 1172 */ 1173 /** 1174 * Gets and sets the path portion of the URL. 1175 * 1176 * @type { string } 1177 * @syscap SystemCapability.Utils.Lang 1178 * @crossplatform 1179 * @since 10 1180 */ 1181 /** 1182 * Gets and sets the path portion of the URL. 1183 * 1184 * @type { string } 1185 * @syscap SystemCapability.Utils.Lang 1186 * @crossplatform 1187 * @atomicservice 1188 * @since 11 1189 */ 1190 pathname: string; 1191 1192 /** 1193 * Gets and sets the port portion of the URL. 1194 * 1195 * @type { string } 1196 * @syscap SystemCapability.Utils.Lang 1197 * @since 7 1198 */ 1199 /** 1200 * Gets and sets the port portion of the URL. 1201 * 1202 * @type { string } 1203 * @syscap SystemCapability.Utils.Lang 1204 * @crossplatform 1205 * @since 10 1206 */ 1207 /** 1208 * Gets and sets the port portion of the URL. 1209 * 1210 * @type { string } 1211 * @syscap SystemCapability.Utils.Lang 1212 * @crossplatform 1213 * @atomicservice 1214 * @since 11 1215 */ 1216 port: string; 1217 1218 /** 1219 * Gets and sets the protocol portion of the URL. 1220 * 1221 * @type { string } 1222 * @syscap SystemCapability.Utils.Lang 1223 * @since 7 1224 */ 1225 /** 1226 * Gets and sets the protocol portion of the URL. 1227 * 1228 * @type { string } 1229 * @syscap SystemCapability.Utils.Lang 1230 * @crossplatform 1231 * @since 10 1232 */ 1233 /** 1234 * Gets and sets the protocol portion of the URL. 1235 * 1236 * @type { string } 1237 * @syscap SystemCapability.Utils.Lang 1238 * @crossplatform 1239 * @atomicservice 1240 * @since 11 1241 */ 1242 protocol: string; 1243 1244 /** 1245 * Gets and sets the serialized query portion of the URL. 1246 * 1247 * @type { string } 1248 * @syscap SystemCapability.Utils.Lang 1249 * @since 7 1250 */ 1251 /** 1252 * Gets and sets the serialized query portion of the URL. 1253 * 1254 * @type { string } 1255 * @syscap SystemCapability.Utils.Lang 1256 * @crossplatform 1257 * @since 10 1258 */ 1259 /** 1260 * Gets and sets the serialized query portion of the URL. 1261 * 1262 * @type { string } 1263 * @syscap SystemCapability.Utils.Lang 1264 * @crossplatform 1265 * @atomicservice 1266 * @since 11 1267 */ 1268 search: string; 1269 1270 /** 1271 * Gets and sets the fragment portion of the URL. 1272 * 1273 * @type { string } 1274 * @syscap SystemCapability.Utils.Lang 1275 * @crossplatform 1276 * @atomicservice 1277 * @since 20 1278 * @arkts 1.2 1279 */ 1280 get hash(): string; 1281 1282 /** 1283 * Gets and sets the fragment portion of the URL. 1284 * 1285 * @type { string } 1286 * @syscap SystemCapability.Utils.Lang 1287 * @crossplatform 1288 * @atomicservice 1289 * @since 20 1290 * @arkts 1.2 1291 */ 1292 set hash(hash: string); 1293 1294 /** 1295 * Gets and sets the host portion of the URL. 1296 * 1297 * @type { string } 1298 * @syscap SystemCapability.Utils.Lang 1299 * @crossplatform 1300 * @atomicservice 1301 * @since 20 1302 * @arkts 1.2 1303 */ 1304 get host(): string; 1305 1306 /** 1307 * Gets and sets the host portion of the URL. 1308 * 1309 * @type { string } 1310 * @syscap SystemCapability.Utils.Lang 1311 * @crossplatform 1312 * @atomicservice 1313 * @since 20 1314 * @arkts 1.2 1315 */ 1316 set host(host: string); 1317 1318 /** 1319 * Gets and sets the host name portion of the URL,not include the port. 1320 * 1321 * @type { string } 1322 * @syscap SystemCapability.Utils.Lang 1323 * @crossplatform 1324 * @atomicservice 1325 * @since 20 1326 * @arkts 1.2 1327 */ 1328 get hostname(): string; 1329 1330 /** 1331 * Gets and sets the host name portion of the URL,not include the port. 1332 * 1333 * @type { string } 1334 * @syscap SystemCapability.Utils.Lang 1335 * @crossplatform 1336 * @atomicservice 1337 * @since 20 1338 * @arkts 1.2 1339 */ 1340 set hostname(hostname: string); 1341 1342 /** 1343 * Gets and sets the serialized URL. 1344 * 1345 * @type { string } 1346 * @syscap SystemCapability.Utils.Lang 1347 * @crossplatform 1348 * @atomicservice 1349 * @since 20 1350 * @arkts 1.2 1351 */ 1352 get href(): string; 1353 1354 /** 1355 * Gets and sets the serialized URL. 1356 * 1357 * @type { string } 1358 * @syscap SystemCapability.Utils.Lang 1359 * @crossplatform 1360 * @atomicservice 1361 * @since 20 1362 * @arkts 1.2 1363 */ 1364 set href(href: string); 1365 1366 /** 1367 * Gets the read-only serialization of the URL's origin. 1368 * 1369 * @type { string } 1370 * @syscap SystemCapability.Utils.Lang 1371 * @crossplatform 1372 * @atomicservice 1373 * @since 20 1374 * @arkts 1.2 1375 */ 1376 get origin(): string; 1377 1378 /** 1379 * Gets and sets the password portion of the URL. 1380 * 1381 * @type { string } 1382 * @syscap SystemCapability.Utils.Lang 1383 * @crossplatform 1384 * @atomicservice 1385 * @since 20 1386 * @arkts 1.2 1387 */ 1388 get password(): string; 1389 1390 /** 1391 * Gets and sets the password portion of the URL. 1392 * 1393 * @type { string } 1394 * @syscap SystemCapability.Utils.Lang 1395 * @crossplatform 1396 * @atomicservice 1397 * @since 20 1398 * @arkts 1.2 1399 */ 1400 set password(password: string); 1401 1402 /** 1403 * Gets and sets the path portion of the URL. 1404 * 1405 * @type { string } 1406 * @syscap SystemCapability.Utils.Lang 1407 * @crossplatform 1408 * @atomicservice 1409 * @since 20 1410 * @arkts 1.2 1411 */ 1412 get pathname(): string; 1413 1414 /** 1415 * Gets and sets the path portion of the URL. 1416 * 1417 * @type { string } 1418 * @syscap SystemCapability.Utils.Lang 1419 * @crossplatform 1420 * @atomicservice 1421 * @since 20 1422 * @arkts 1.2 1423 */ 1424 set pathname(pathname: string); 1425 1426 /** 1427 * Gets and sets the port portion of the URL. 1428 * 1429 * @type { string } 1430 * @syscap SystemCapability.Utils.Lang 1431 * @crossplatform 1432 * @atomicservice 1433 * @since 20 1434 * @arkts 1.2 1435 */ 1436 get port(): string; 1437 1438 /** 1439 * Gets and sets the port portion of the URL. 1440 * 1441 * @type { string } 1442 * @syscap SystemCapability.Utils.Lang 1443 * @crossplatform 1444 * @atomicservice 1445 * @since 20 1446 * @arkts 1.2 1447 */ 1448 set port(port: string); 1449 1450 /** 1451 * Gets and sets the protocol portion of the URL. 1452 * 1453 * @type { string } 1454 * @syscap SystemCapability.Utils.Lang 1455 * @crossplatform 1456 * @atomicservice 1457 * @since 20 1458 * @arkts 1.2 1459 */ 1460 get protocol(): string; 1461 1462 /** 1463 * Gets and sets the protocol portion of the URL. 1464 * 1465 * @type { string } 1466 * @syscap SystemCapability.Utils.Lang 1467 * @crossplatform 1468 * @atomicservice 1469 * @since 20 1470 * @arkts 1.2 1471 */ 1472 set protocol(protocol: string); 1473 1474 /** 1475 * Gets and sets the serialized query portion of the URL. 1476 * 1477 * @type { string } 1478 * @syscap SystemCapability.Utils.Lang 1479 * @crossplatform 1480 * @atomicservice 1481 * @since 20 1482 * @arkts 1.2 1483 */ 1484 get search(): string; 1485 1486 /** 1487 * Gets and sets the serialized query portion of the URL. 1488 * 1489 * @type { string } 1490 * @syscap SystemCapability.Utils.Lang 1491 * @crossplatform 1492 * @atomicservice 1493 * @since 20 1494 * @arkts 1.2 1495 */ 1496 set search(search: string); 1497 /** 1498 * Gets the URLParams object that represents the URL query parameter. 1499 * This property is read-only, but URLParams provides an object that can be used to change 1500 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1501 * 1502 * @type { URLParams } 1503 * @syscap SystemCapability.Utils.Lang 1504 * @crossplatform 1505 * @atomicservice 1506 * @since 20 1507 * @arkts 1.2 1508 */ 1509 get params(): URLParams; 1510 1511 /** 1512 * Gets and sets the username portion of the URL. 1513 * 1514 * @type { string } 1515 * @syscap SystemCapability.Utils.Lang 1516 * @crossplatform 1517 * @atomicservice 1518 * @since 20 1519 * @arkts 1.2 1520 */ 1521 get username(): string; 1522 1523 /** 1524 * Gets and sets the username portion of the URL. 1525 * 1526 * @type { string } 1527 * @syscap SystemCapability.Utils.Lang 1528 * @crossplatform 1529 * @atomicservice 1530 * @since 20 1531 * @arkts 1.2 1532 */ 1533 set username(username: string); 1534 1535 /** 1536 * Gets the URLSearchParams object that represents the URL query parameter. 1537 * This property is read-only, but URLSearchParams provides an object that can be used to change 1538 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1539 * 1540 * @syscap SystemCapability.Utils.Lang 1541 * @since 7 1542 * @deprecated since 9 1543 * @useinstead ohos.url.URL.params 1544 */ 1545 readonly searchParams: URLSearchParams; 1546 1547 /** 1548 * Gets the URLParams object that represents the URL query parameter. 1549 * This property is read-only, but URLParams provides an object that can be used to change 1550 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1551 * 1552 * @type { URLParams } 1553 * @syscap SystemCapability.Utils.Lang 1554 * @since 9 1555 */ 1556 /** 1557 * Gets the URLParams object that represents the URL query parameter. 1558 * This property is read-only, but URLParams provides an object that can be used to change 1559 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1560 * 1561 * @type { URLParams } 1562 * @syscap SystemCapability.Utils.Lang 1563 * @crossplatform 1564 * @since 10 1565 */ 1566 /** 1567 * Gets the URLParams object that represents the URL query parameter. 1568 * This property is read-only, but URLParams provides an object that can be used to change 1569 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1570 * 1571 * @type { URLParams } 1572 * @readonly 1573 * @syscap SystemCapability.Utils.Lang 1574 * @crossplatform 1575 * @atomicservice 1576 * @since 11 1577 */ 1578 readonly params: URLParams; 1579 1580 /** 1581 * Gets and sets the username portion of the URL. 1582 * 1583 * @type { string } 1584 * @syscap SystemCapability.Utils.Lang 1585 * @since 7 1586 */ 1587 /** 1588 * Gets and sets the username portion of the URL. 1589 * 1590 * @type { string } 1591 * @syscap SystemCapability.Utils.Lang 1592 * @crossplatform 1593 * @since 10 1594 */ 1595 /** 1596 * Gets and sets the username portion of the URL. 1597 * 1598 * @type { string } 1599 * @syscap SystemCapability.Utils.Lang 1600 * @crossplatform 1601 * @atomicservice 1602 * @since 11 1603 */ 1604 username: string; 1605 } 1606 1607 /** 1608 * The type of URL callback function. 1609 * 1610 * @typedef { function } UrlCbFn 1611 * @param { string } value - The value of the URL parameter. 1612 * @param { string } key - The key of the URL parameter. 1613 * @param { URLParams } searchParams - The URLParams object containing all parameters. 1614 * @returns { void } This callback does not return a value. 1615 * @syscap SystemCapability.Utils.Lang 1616 * @atomicservice 1617 * @since 20 1618 * @arkts 1.2 1619 */ 1620 type UrlCbFn = (value: string, key: string, searchParams: URLParams) => void; 1621} 1622export default url; 1623