BinaryNinja::Collaboration::RemoteFile Class Reference

Public Member Functions

 RemoteFile (BNRemoteFile *remoteFile)
 
Ref< ProjectFileGetCoreFile ()
 
Ref< RemoteProjectGetProject ()
 
Ref< RemoteFolderGetFolder ()
 
Ref< RemoteGetRemote ()
 
std::string GetUrl ()
 
std::string GetChatLogUrl ()
 
std::string GetUserPositionsUrl ()
 
std::string GetId ()
 
BNRemoteFileType GetType ()
 
int64_t GetCreated ()
 
std::string GetCreatedBy ()
 
int64_t GetLastModified ()
 
int64_t GetLastSnapshot ()
 
std::string GetLastSnapshotBy ()
 
std::string GetLastSnapshotName ()
 
std::string GetHash ()
 
std::string GetName ()
 
std::string GetDescription ()
 
std::string GetMetadata ()
 
uint64_t GetSize ()
 
bool HasPulledSnapshots ()
 
void SetName (const std::string &name)
 
void SetDescription (const std::string &description)
 
void SetFolder (const Ref< RemoteFolder > &folder)
 
void SetMetadata (const std::string &metadata)
 
std::vector< Ref< CollabSnapshot > > GetSnapshots ()
 Get all snapshots in the file. More...
 
Ref< CollabSnapshotGetSnapshotById (const std::string &id)
 Get a snapshot in the file by its id. More...
 
void PullSnapshots (std::function< bool(size_t, size_t)> progress={})
 Pull list of snapshots from the remote. More...
 
Ref< CollabSnapshotCreateSnapshot (std::string name, std::vector< uint8_t > contents, std::vector< uint8_t > analysisCacheContents, std::optional< std::vector< uint8_t > > fileContents, std::vector< std::string > parentIds, std::function< bool(size_t, size_t)> progress={})
 Create a new snapshot on the remote (and pull it) More...
 
void DeleteSnapshot (const Ref< CollabSnapshot > snapshot)
 Delete a snapshot from the remote. More...
 
std::vector< uint8_t > Download (std::function< bool(size_t, size_t)> progress={})
 Download the contents of a remote file. More...
 
Json::Value RequestUserPositions ()
 Get the current user positions for this file. More...
 
Json::Value RequestChatLog ()
 Get the current chat log for this file. More...
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNRemoteFile, BNNewRemoteFileReference, BNFreeRemoteFile >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNRemoteFileGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNRemoteFile, BNNewRemoteFileReference, BNFreeRemoteFile >
static BNRemoteFileGetObject (CoreRefCountObject *obj)
 
static BNRemoteFileGetObject (const CoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNRemoteFile, BNNewRemoteFileReference, BNFreeRemoteFile >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNRemoteFilem_object
 

Constructor & Destructor Documentation

◆ RemoteFile()

RemoteFile::RemoteFile ( BNRemoteFile remoteFile)

Member Function Documentation

◆ GetCoreFile()

Ref< ProjectFile > RemoteFile::GetCoreFile ( )

◆ GetProject()

Ref< RemoteProject > RemoteFile::GetProject ( )

◆ GetFolder()

Ref< RemoteFolder > RemoteFile::GetFolder ( )

◆ GetRemote()

Ref< Remote > RemoteFile::GetRemote ( )

◆ GetUrl()

std::string RemoteFile::GetUrl ( )

◆ GetChatLogUrl()

std::string RemoteFile::GetChatLogUrl ( )

◆ GetUserPositionsUrl()

std::string RemoteFile::GetUserPositionsUrl ( )

◆ GetId()

std::string RemoteFile::GetId ( )

◆ GetType()

BNRemoteFileType RemoteFile::GetType ( )

◆ GetCreated()

int64_t RemoteFile::GetCreated ( )

◆ GetCreatedBy()

std::string RemoteFile::GetCreatedBy ( )

◆ GetLastModified()

int64_t RemoteFile::GetLastModified ( )

◆ GetLastSnapshot()

int64_t RemoteFile::GetLastSnapshot ( )

◆ GetLastSnapshotBy()

std::string RemoteFile::GetLastSnapshotBy ( )

◆ GetLastSnapshotName()

std::string RemoteFile::GetLastSnapshotName ( )

◆ GetHash()

std::string RemoteFile::GetHash ( )

◆ GetName()

std::string RemoteFile::GetName ( )

◆ GetDescription()

std::string RemoteFile::GetDescription ( )

◆ GetMetadata()

std::string RemoteFile::GetMetadata ( )

◆ GetSize()

uint64_t RemoteFile::GetSize ( )

◆ HasPulledSnapshots()

bool RemoteFile::HasPulledSnapshots ( )

◆ SetName()

void RemoteFile::SetName ( const std::string &  name)

◆ SetDescription()

void RemoteFile::SetDescription ( const std::string &  description)

◆ SetFolder()

void RemoteFile::SetFolder ( const Ref< RemoteFolder > &  folder)

◆ SetMetadata()

void RemoteFile::SetMetadata ( const std::string &  metadata)

◆ GetSnapshots()

std::vector< Ref< CollabSnapshot > > RemoteFile::GetSnapshots ( )

Get all snapshots in the file.

Returns
All snapshops
Exceptions
RemoteExceptionif snapshots have not been pulled or if the remote is not connected

◆ GetSnapshotById()

Ref< CollabSnapshot > RemoteFile::GetSnapshotById ( const std::string &  id)

Get a snapshot in the file by its id.

Parameters
idCollabSnapshot's id
Returns
CollabSnapshot, or nullptr
Exceptions
RemoteExceptionIf snapshots have not been pulled or if the remote is not connected

◆ PullSnapshots()

void RemoteFile::PullSnapshots ( std::function< bool(size_t, size_t)>  progress = {})

Pull list of snapshots from the remote.

Necessary before calling GetSnapshots()

Parameters
progressFunction to call on progress updates
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected

◆ CreateSnapshot()

Ref< CollabSnapshot > RemoteFile::CreateSnapshot ( std::string  name,
std::vector< uint8_t >  contents,
std::vector< uint8_t >  analysisCacheContents,
std::optional< std::vector< uint8_t > >  fileContents,
std::vector< std::string >  parentIds,
std::function< bool(size_t, size_t)>  progress = {} 
)

Create a new snapshot on the remote (and pull it)

Parameters
nameCollabSnapshot name
parentIdsList of ids of parent snapshots (or empty if this is a root snapshot)
contentsCollabSnapshot contents
analysisCacheContentsAnalysis cache contents
fileContentsNew file contents (if contents changed)
progressFunction to call on progress updates
Returns
Reference to the created snapshot
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected

◆ DeleteSnapshot()

void RemoteFile::DeleteSnapshot ( const Ref< CollabSnapshot snapshot)

Delete a snapshot from the remote.

Parameters
snapshotPointer to snapshot to delete (will invalidate pointer)
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected

◆ Download()

std::vector< uint8_t > RemoteFile::Download ( std::function< bool(size_t, size_t)>  progress = {})

Download the contents of a remote file.

Parameters
progressFunction to call on progress updates
Returns
Contents of the file
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected

◆ RequestUserPositions()

Json::Value RemoteFile::RequestUserPositions ( )

Get the current user positions for this file.

Returns
User positions as json
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected

◆ RequestChatLog()

Json::Value RemoteFile::RequestChatLog ( )

Get the current chat log for this file.

Returns
Chat log as json
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected