• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 * The uri module provides utilities for URI resolution and parsing.
18 * @since 8
19 * @syscap SystemCapability.Utils.Lang
20 * @permission N/A
21 */
22declare namespace uri {
23
24    /**
25     * URI Represents a Uniform Resource Identifier (URI) reference.
26     * @name URI
27     * @since 8
28     * @syscap SystemCapability.Utils.Lang
29     */
30    class URI {
31        /**
32         * URI constructor, which is used to instantiate a URI object.
33         * uri: Constructs a URI by parsing a given string.
34         * @throws {BusinessError} 401 - if the input parameters are invalid.
35	 * @throws {BusinessError} 10200002 - Invalid uri string.
36         */
37        constructor(uri: string);
38
39        /**
40         * Returns the serialized URI as a string.
41         * @since 8
42         * @syscap SystemCapability.Utils.Lang
43         * @returns Returns the serialized URI as a string.
44         */
45        toString(): string;
46
47        /**
48         * Check whether this URI is equivalent to other URI objects.
49         * @since 8
50         * @deprecated since 9
51         * @useinstead ohos.uri.URI.equalsTo
52         * @syscap SystemCapability.Utils.Lang
53         * @param other URI object to be compared
54         * @returns boolean Tests whether this URI is equivalent to other URI objects.
55         */
56        equals(other: URI): boolean;
57
58        /**
59         * Check whether this URI is equivalent to other URI objects.
60         * @since 9
61         * @syscap SystemCapability.Utils.Lang
62         * @param other URI object to be compared
63         * @returns boolean Tests whether this URI is equivalent to other URI objects.
64         * @throws {BusinessError} 401 - The type of other must be URI.
65         */
66        equalsTo(other: URI): boolean;
67
68        /**
69         * Indicates whether this URI is an absolute URI.
70         * @since 8
71         * @syscap SystemCapability.Utils.Lang
72         * @returns boolean Indicates whether the URI is an absolute URI (whether the scheme component is defined).
73         */
74        checkIsAbsolute(): boolean;
75
76        /**
77         * Normalize the path of this URI.
78         * @since 8
79         * @syscap SystemCapability.Utils.Lang
80         * @returns URI Used to normalize the path of this URI and return a URI object whose path has been normalized.
81         */
82        normalize(): URI;
83
84        /**
85         * Gets the protocol part of the URI.
86         * @since 8
87         * @syscap SystemCapability.Utils.Lang
88         */
89        scheme: string;
90
91        /**
92         * Obtains the user information part of the URI.
93         * @since 8
94         * @syscap SystemCapability.Utils.Lang
95         */
96        userInfo: string;
97
98        /**
99         * Gets the hostname portion of the URI without a port.
100         * @since 8
101         * @syscap SystemCapability.Utils.Lang
102         */
103        host: string;
104
105        /**
106         * Gets the port portion of the URI.
107         * @since 8
108         * @syscap SystemCapability.Utils.Lang
109         */
110        port: string;
111
112        /**
113         * Gets the path portion of the URI.
114         * @since 8
115         * @syscap SystemCapability.Utils.Lang
116         */
117        path: string;
118
119        /**
120         * Gets the query portion of the URI
121         * @since 8
122         * @syscap SystemCapability.Utils.Lang
123         */
124        query: string;
125
126        /**
127         * Gets the fragment part of the URI.
128         * @since 8
129         * @syscap SystemCapability.Utils.Lang
130         */
131        fragment: string;
132
133        /**
134         * Gets the decoding permission component part of this URI.
135         * @since 8
136         * @syscap SystemCapability.Utils.Lang
137         */
138        authority: string;
139
140        /**
141         * Gets the decoding scheme-specific part of the URI.
142         * @since 8
143         * @syscap SystemCapability.Utils.Lang
144         */
145        ssp: string;
146    }
147}
148export default uri;