public function get_file_share_info($id) {
        // Attempt to fetch any existing shared link first.
        $data = $this->fetch_dropbox_data('sharing/list_shared_links', [
                'path'      => $id,
            ]);

        if (isset($data->links)) {
            $link = reset($data->links);
            if (isset($link->{".tag"}) && $link->{".tag"} === "file") {
                return $this->normalize_file_share_info($link);
            }
        }

        // No existing link available.
        // Create a new one.
        $link = $this->fetch_dropbox_data('sharing/create_shared_link_with_settings', [
                'path'      => $id,
                'settings'  => [
                    'requested_visibility'  => 'public',
                ],
            ]);

        if (isset($link->{".tag"}) && $link->{".tag"} === "file") {
            return $this->normalize_file_share_info($link);
        }

        // Some kind of error we don't know how to handle at this stage.
        return null;
    }
public function get_file_share_info($id) {
        // Attempt to fetch any existing shared link first.
        $data = $this->fetch_dropbox_data('sharing/list_shared_links', [
                'path'      => $id,
            ]);

        if (isset($data->links)) {
            $link = reset($data->links);
            if (isset($link->{".tag"}) && $link->{".tag"} === "file") {
                return $this->normalize_file_share_info($link);
            }
        }

        // No existing link available.
        // Create a new one.
        $link = $this->fetch_dropbox_data('sharing/create_shared_link_with_settings', [
                'path'      => $id,
                'settings'  => [
                    'requested_visibility'  => 'public',
                ],
            ]);

        if (isset($link->{".tag"}) && $link->{".tag"} === "file") {
            return $this->normalize_file_share_info($link);
        }

        // Some kind of error we don't know how to handle at this stage.
        return null;
    }
public function get_file_share_info ( $ id ) { // Attempt to fetch any existing shared link first. $ data = $ this -> fetch_dropbox_data ( 'sharing/list_shared_links' , [ 'path' => $ id , ] ) ; if ( isset ( $ data -> links ) ) { $ link = reset ( $ data -> links ) ; if ( isset ( $ link -> { ".tag" } ) && $ link -> { ".tag" } === "file" ) { return $ this -> normalize_file_share_info ( $ link ) ; } } // No existing link available. // Create a new one. $ link = $ this -> fetch_dropbox_data ( 'sharing/create_shared_link_with_settings' , [ 'path' => $ id , 'settings' => [ 'requested_visibility' => 'public' , ] , ] ) ; if ( isset ( $ link -> { ".tag" } ) && $ link -> { ".tag" } === "file" ) { return $ this -> normalize_file_share_info ( $ link ) ; } // Some kind of error we don't know how to handle at this stage. return null ; }
Fetch a valid public share link for the specified file.

@param   string      $id         The file path or file id of the file to fetch information for.
@return  object                  An object containing the id, path, size, and URL of the entry
Fetch a valid public share link for the specified file .