• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (C) 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
16import {AsyncCallback, Callback} from "./basic";
17import wantConstant from "./@ohos.ability.wantConstant";
18
19/**
20 * Provides fileshare APIS
21 *
22 * @since 9
23 * @syscap SystemCapability.FileManagement.AppFileService
24 */
25declare namespace fileShare {
26
27    /**
28     * Provides grant uri permission for app
29     *
30     * @since 9
31     * @param {string} uri uri
32     * @param {string} bundleName bundleName
33     * @param {wantConstant.Flags} flag wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION or wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION
34     * @throws { BusinessError } 201 - Permission verification failed
35     * @throws { BusinessError } 202 - The caller is not a system application
36     * @throws { BusinessError } 401 - The input parameter is invalid
37     * @throws { BusinessError } 143000001 - IPC error
38     * @syscap SystemCapability.FileManagement.AppFileService
39     * @returns {void | Promise<void>} no callback return Promise otherwise return void
40     * @systemapi
41     */
42    function grantUriPermission(uri: string, bundleName: string, flag: wantConstant.Flags, callback: AsyncCallback<void>): void;
43    function grantUriPermission(uri: string, bundleName: string, flag: wantConstant.Flags): Promise<void>;
44}
45
46export default fileShare;
47