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 uri module provides utilities for URI resolution and parsing. 23 * 24 * @namespace uri 25 * @syscap SystemCapability.Utils.Lang 26 * @since 8 27 */ 28/** 29 * The uri module provides utilities for URI resolution and parsing. 30 * 31 * @namespace uri 32 * @syscap SystemCapability.Utils.Lang 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * The uri module provides utilities for URI resolution and parsing. 38 * 39 * @namespace uri 40 * @syscap SystemCapability.Utils.Lang 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45declare namespace uri { 46 /** 47 * URI Represents a Uniform Resource Identifier (URI) reference. 48 * 49 * @syscap SystemCapability.Utils.Lang 50 * @since 8 51 * @name URI 52 */ 53 /** 54 * URI Represents a Uniform Resource Identifier (URI) reference. 55 * 56 * @syscap SystemCapability.Utils.Lang 57 * @crossplatform 58 * @since 10 59 * @name URI 60 */ 61 /** 62 * URI Represents a Uniform Resource Identifier (URI) reference. 63 * 64 * @syscap SystemCapability.Utils.Lang 65 * @crossplatform 66 * @atomicservice 67 * @since 11 68 * @name URI 69 */ 70 class URI { 71 /** 72 * URI constructor, which is used to instantiate a URI object. 73 * uri: Constructs a URI by parsing a given string. 74 * 75 * @param { string } uri - uri uri 76 * @throws { BusinessError } 401 - if the input parameters are invalid. 77 * @throws { BusinessError } 10200002 - Invalid uri string. 78 * @syscap SystemCapability.Utils.Lang 79 * @since 8 80 */ 81 /** 82 * URI constructor, which is used to instantiate a URI object. 83 * uri: Constructs a URI by parsing a given string. 84 * 85 * @param { string } uri - uri uri 86 * @throws { BusinessError } 401 - if the input parameters are invalid. 87 * @throws { BusinessError } 10200002 - Invalid uri string. 88 * @syscap SystemCapability.Utils.Lang 89 * @crossplatform 90 * @since 10 91 */ 92 /** 93 * URI constructor, which is used to instantiate a URI object. 94 * uri: Constructs a URI by parsing a given string. 95 * 96 * @param { string } uri - uri uri 97 * @throws { BusinessError } 401 - if the input parameters are invalid. 98 * @throws { BusinessError } 10200002 - Invalid uri string. 99 * @syscap SystemCapability.Utils.Lang 100 * @crossplatform 101 * @atomicservice 102 * @since 11 103 */ 104 constructor(uri: string); 105 106 /** 107 * Returns the serialized URI as a string. 108 * 109 * @returns { string } Returns the serialized URI as a string. 110 * @syscap SystemCapability.Utils.Lang 111 * @since 8 112 */ 113 /** 114 * Returns the serialized URI as a string. 115 * 116 * @returns { string } Returns the serialized URI as a string. 117 * @syscap SystemCapability.Utils.Lang 118 * @crossplatform 119 * @since 10 120 */ 121 /** 122 * Returns the serialized URI as a string. 123 * 124 * @returns { string } Returns the serialized URI as a string. 125 * @syscap SystemCapability.Utils.Lang 126 * @crossplatform 127 * @atomicservice 128 * @since 11 129 */ 130 toString(): string; 131 132 /** 133 * Check whether this URI is equivalent to other URI objects. 134 * 135 * @param { URI } other - other other URI object to be compared 136 * @returns { boolean } boolean Tests whether this URI is equivalent to other URI objects. 137 * @syscap SystemCapability.Utils.Lang 138 * @since 8 139 * @deprecated since 9 140 * @useinstead ohos.uri.URI.equalsTo 141 */ 142 equals(other: URI): boolean; 143 144 /** 145 * Check whether this URI is equivalent to other URI objects. 146 * 147 * @param { URI } other - other other URI object to be compared 148 * @returns { boolean } boolean Tests whether this URI is equivalent to other URI objects. 149 * @throws { BusinessError } 401 - The type of other must be URI. 150 * @syscap SystemCapability.Utils.Lang 151 * @since 9 152 */ 153 /** 154 * Check whether this URI is equivalent to other URI objects. 155 * 156 * @param { URI } other - other other URI object to be compared 157 * @returns { boolean } boolean Tests whether this URI is equivalent to other URI objects. 158 * @throws { BusinessError } 401 - The type of other must be URI. 159 * @syscap SystemCapability.Utils.Lang 160 * @crossplatform 161 * @since 10 162 */ 163 /** 164 * Check whether this URI is equivalent to other URI objects. 165 * 166 * @param { URI } other - other other URI object to be compared 167 * @returns { boolean } boolean Tests whether this URI is equivalent to other URI objects. 168 * @throws { BusinessError } 401 - The type of other must be URI. 169 * @syscap SystemCapability.Utils.Lang 170 * @crossplatform 171 * @atomicservice 172 * @since 11 173 */ 174 equalsTo(other: URI): boolean; 175 176 /** 177 * Indicates whether this URI is an absolute URI. 178 * 179 * @returns { boolean } boolean Indicates whether the URI is an absolute URI (whether the scheme component is defined). 180 * @syscap SystemCapability.Utils.Lang 181 * @since 8 182 */ 183 /** 184 * Indicates whether this URI is an absolute URI. 185 * 186 * @returns { boolean } boolean Indicates whether the URI is an absolute URI (whether the scheme component is defined). 187 * @syscap SystemCapability.Utils.Lang 188 * @crossplatform 189 * @since 10 190 */ 191 /** 192 * Indicates whether this URI is an absolute URI. 193 * 194 * @returns { boolean } boolean Indicates whether the URI is an absolute URI (whether the scheme component is defined). 195 * @syscap SystemCapability.Utils.Lang 196 * @crossplatform 197 * @atomicservice 198 * @since 11 199 */ 200 checkIsAbsolute(): boolean; 201 202 /** 203 * Normalize the path of this URI, It is not safe to call the normalize interface with URI. 204 * 205 * @returns { URI } URI Used to normalize the path of this URI and return a URI object whose path has been normalized. 206 * @syscap SystemCapability.Utils.Lang 207 * @since 8 208 */ 209 /** 210 * Normalize the path of this URI, It is not safe to call the normalize interface with URI. 211 * 212 * @returns { URI } URI Used to normalize the path of this URI and return a URI object whose path has been normalized. 213 * @syscap SystemCapability.Utils.Lang 214 * @crossplatform 215 * @since 10 216 */ 217 /** 218 * Normalize the path of this URI, It is not safe to call the normalize interface with URI. 219 * 220 * @returns { URI } URI Used to normalize the path of this URI and return a URI object whose path has been normalized. 221 * @syscap SystemCapability.Utils.Lang 222 * @crossplatform 223 * @atomicservice 224 * @since 11 225 */ 226 normalize(): URI; 227 228 /** 229 * Gets the protocol part of the URI. 230 * 231 * @syscap SystemCapability.Utils.Lang 232 * @since 8 233 */ 234 /** 235 * Gets the protocol part of the URI. 236 * 237 * @syscap SystemCapability.Utils.Lang 238 * @crossplatform 239 * @since 10 240 */ 241 /** 242 * Gets the protocol part of the URI. 243 * 244 * @syscap SystemCapability.Utils.Lang 245 * @crossplatform 246 * @atomicservice 247 * @since 11 248 */ 249 scheme: string; 250 251 /** 252 * Obtains the user information part of the URI. 253 * 254 * @syscap SystemCapability.Utils.Lang 255 * @since 8 256 */ 257 /** 258 * Obtains the user information part of the URI. 259 * 260 * @syscap SystemCapability.Utils.Lang 261 * @crossplatform 262 * @since 10 263 */ 264 /** 265 * Obtains the user information part of the URI. 266 * 267 * @syscap SystemCapability.Utils.Lang 268 * @crossplatform 269 * @atomicservice 270 * @since 11 271 */ 272 userInfo: string; 273 274 /** 275 * Gets the hostname portion of the URI without a port. 276 * 277 * @syscap SystemCapability.Utils.Lang 278 * @since 8 279 */ 280 /** 281 * Gets the hostname portion of the URI without a port. 282 * 283 * @syscap SystemCapability.Utils.Lang 284 * @crossplatform 285 * @since 10 286 */ 287 /** 288 * Gets the hostname portion of the URI without a port. 289 * 290 * @syscap SystemCapability.Utils.Lang 291 * @crossplatform 292 * @atomicservice 293 * @since 11 294 */ 295 host: string; 296 297 /** 298 * Gets the port portion of the URI. 299 * 300 * @syscap SystemCapability.Utils.Lang 301 * @since 8 302 */ 303 /** 304 * Gets the port portion of the URI. 305 * 306 * @syscap SystemCapability.Utils.Lang 307 * @crossplatform 308 * @since 10 309 */ 310 /** 311 * Gets the port portion of the URI. 312 * 313 * @syscap SystemCapability.Utils.Lang 314 * @crossplatform 315 * @atomicservice 316 * @since 11 317 */ 318 port: string; 319 320 /** 321 * Gets the path portion of the URI. 322 * 323 * @syscap SystemCapability.Utils.Lang 324 * @since 8 325 */ 326 /** 327 * Gets the path portion of the URI. 328 * 329 * @syscap SystemCapability.Utils.Lang 330 * @crossplatform 331 * @since 10 332 */ 333 /** 334 * Gets the path portion of the URI. 335 * 336 * @syscap SystemCapability.Utils.Lang 337 * @crossplatform 338 * @atomicservice 339 * @since 11 340 */ 341 path: string; 342 343 /** 344 * Gets the query portion of the URI 345 * 346 * @syscap SystemCapability.Utils.Lang 347 * @since 8 348 */ 349 /** 350 * Gets the query portion of the URI 351 * 352 * @syscap SystemCapability.Utils.Lang 353 * @crossplatform 354 * @since 10 355 */ 356 /** 357 * Gets the query portion of the URI 358 * 359 * @syscap SystemCapability.Utils.Lang 360 * @crossplatform 361 * @atomicservice 362 * @since 11 363 */ 364 query: string; 365 366 /** 367 * Gets the fragment part of the URI. 368 * 369 * @syscap SystemCapability.Utils.Lang 370 * @since 8 371 */ 372 /** 373 * Gets the fragment part of the URI. 374 * 375 * @syscap SystemCapability.Utils.Lang 376 * @crossplatform 377 * @since 10 378 */ 379 /** 380 * Gets the fragment part of the URI. 381 * 382 * @syscap SystemCapability.Utils.Lang 383 * @crossplatform 384 * @atomicservice 385 * @since 11 386 */ 387 fragment: string; 388 389 /** 390 * Gets the decoding permission component part of this URI. 391 * 392 * @syscap SystemCapability.Utils.Lang 393 * @since 8 394 */ 395 /** 396 * Gets the decoding permission component part of this URI. 397 * 398 * @syscap SystemCapability.Utils.Lang 399 * @crossplatform 400 * @since 10 401 */ 402 /** 403 * Gets the decoding permission component part of this URI. 404 * 405 * @syscap SystemCapability.Utils.Lang 406 * @crossplatform 407 * @atomicservice 408 * @since 11 409 */ 410 authority: string; 411 412 /** 413 * Gets the decoding scheme-specific part of the URI. 414 * 415 * @syscap SystemCapability.Utils.Lang 416 * @since 8 417 */ 418 /** 419 * Gets the decoding scheme-specific part of the URI. 420 * 421 * @syscap SystemCapability.Utils.Lang 422 * @crossplatform 423 * @since 10 424 */ 425 /** 426 * Gets the decoding scheme-specific part of the URI. 427 * 428 * @syscap SystemCapability.Utils.Lang 429 * @crossplatform 430 * @atomicservice 431 * @since 11 432 */ 433 ssp: string; 434 } 435} 436export default uri; 437