Skip to content
Snippets Groups Projects
Commit 994b32c2 authored by Jono Wenger's avatar Jono Wenger
Browse files

Fix bindings comments

parent 8e7459d5
No related branches found
No related tags found
3 merge requests!510Release,!419rewrote the health tracker to both consider if there are waiting rounds and...,!340Project/channels
...@@ -135,7 +135,8 @@ func NewChannelsManager(e2eID, udID int) (*ChannelsManager, error) { ...@@ -135,7 +135,8 @@ func NewChannelsManager(e2eID, udID int) (*ChannelsManager, error) {
} }
// NewChannelsManagerGoEventModel constructs a ChannelsManager. This is not // NewChannelsManagerGoEventModel constructs a ChannelsManager. This is not
// compatible with GoMobile Bindings because it receives the go event model // compatible with GoMobile Bindings because it receives the go event model.
//
// Parameters: // Parameters:
// - e2eID - The tracked e2e object ID. This can be retrieved using // - e2eID - The tracked e2e object ID. This can be retrieved using
// [E2e.GetID]. // [E2e.GetID].
...@@ -172,25 +173,29 @@ type ChannelGeneration struct { ...@@ -172,25 +173,29 @@ type ChannelGeneration struct {
PrivateKey string PrivateKey string
} }
// GenerateChannel is used to create a channel. This makes a new channel // GenerateChannel is used to create a channel. This makes a new channel of
// of which your are the admin. It is only for making new channels, not // which you are the admin. It is only for making new channels, not joining
// joining existing ones. // existing ones.
// it returns a prettyPrint of the channel and the private key //
// The name cannot be longer that ____ characters // It returns a pretty print of the channel and the private key.
// the description cannot be longer than ___ and can only use ______ characters //
// The name cannot be longer that ____ characters.
//
// the description cannot be longer than ___ and can only use ______ characters.
// //
// Parameters: // Parameters:
// - cmixID - The tracked cmix object ID. This can be retrieved using // - cmixID - The tracked cmix object ID. This can be retrieved using
// [Cmix.GetID]. // [Cmix.GetID].
// - name - the name of the new channel. The name cannot be longer than ____ // - name - The name of the new channel. The name cannot be longer than ____
// characters and must contain only _____ characters. It cannot be changed // characters and must contain only _____ characters. It cannot be changed
// once a channel is created. // once a channel is created.
// - description - The description of a channel. The description cannot be // - description - The description of a channel. The description cannot be
// longer than ____ characters and must contain only _____ characters. It // longer than ____ characters and must contain only _____ characters. It
// cannot be changed once a channel is created. // cannot be changed once a channel is created.
//
// Returns: // Returns:
// - []byte - ChannelGeneration describes a generated channel. it contains both // - []byte - ChannelGeneration describes a generated channel. It contains both
// the public channel info and the private key for the channel in PEM format // the public channel info and the private key for the channel in PEM format.
// fixme: document json // fixme: document json
func GenerateChannel(cmixID int, name, description string) ([]byte, error) { func GenerateChannel(cmixID int, name, description string) ([]byte, error) {
// Get cmix from singleton so its rng can be used // Get cmix from singleton so its rng can be used
...@@ -220,13 +225,14 @@ type ChannelInfo struct { ...@@ -220,13 +225,14 @@ type ChannelInfo struct {
ChannelID string ChannelID string
} }
// GetChannelInfo returns the info about a channel from its public description // GetChannelInfo returns the info about a channel from its public description.
// //
// Parameters: // Parameters:
// - prettyPrint - The pretty print of the channel. Of the format: // - prettyPrint - The pretty print of the channel.
// "<XXChannel-v1:Test Channel,description:This is a test channel,secrets:pn //
// 0kIs6P1pHvAe7u8kUyf33GYVKmkoCX9LhCtvKJZQI=,3A5eB5pzSHyxN09w1kOVrTIEr5Uy // The pretty print will be of the format:
// Bbzmmd9Ga5Dx0XA=,0,0,/zChIlLr2p3Vsm2X4+3TiFapoapaTi8EJIisJSqwfGc=>" // <XXChannel-v1:Test Channel,description:This is a test channel,secrets:pn0kIs6P1pHvAe7u8kUyf33GYVKmkoCX9LhCtvKJZQI=,3A5eB5pzSHyxN09w1kOVrTIEr5UyBbzmmd9Ga5Dx0XA=,0,0,/zChIlLr2p3Vsm2X4+3TiFapoapaTi8EJIisJSqwfGc=>
//
// Returns: // Returns:
// - []byte - ChannelInfo describes all relevant channel info. // - []byte - ChannelInfo describes all relevant channel info.
// fixme: document json // fixme: document json
...@@ -257,10 +263,11 @@ func getChannelInfo(prettyPrint string) (*cryptoBroadcast.Channel, []byte, error ...@@ -257,10 +263,11 @@ func getChannelInfo(prettyPrint string) (*cryptoBroadcast.Channel, []byte, error
// //
// Parameters: // Parameters:
// - channelPretty - A portable channel string. Should be received from // - channelPretty - A portable channel string. Should be received from
// another user or generated via GenerateChannel(). // another user or generated via GenerateChannel.
// "<XXChannel-v1:Test Channel,description:This is a test channel,secrets:pn //
// 0kIs6P1pHvAe7u8kUyf33GYVKmkoCX9LhCtvKJZQI=,3A5eB5pzSHyxN09w1kOVrTIEr5Uy // The pretty print will be of the format:
// Bbzmmd9Ga5Dx0XA=,0,0,/zChIlLr2p3Vsm2X4+3TiFapoapaTi8EJIisJSqwfGc=>" // <XXChannel-v1:Test Channel,description:This is a test channel,secrets:pn0kIs6P1pHvAe7u8kUyf33GYVKmkoCX9LhCtvKJZQI=,3A5eB5pzSHyxN09w1kOVrTIEr5UyBbzmmd9Ga5Dx0XA=,0,0,/zChIlLr2p3Vsm2X4+3TiFapoapaTi8EJIisJSqwfGc=>"
//
// Returns: // Returns:
// - []byte - ChannelInfo describes all relevant channel info. // - []byte - ChannelInfo describes all relevant channel info.
// fixme: document json // fixme: document json
...@@ -295,8 +302,7 @@ func (cm *ChannelsManager) GetChannels() ([]byte, error) { ...@@ -295,8 +302,7 @@ func (cm *ChannelsManager) GetChannels() ([]byte, error) {
// channel was not previously joined. // channel was not previously joined.
// //
// Parameters: // Parameters:
// - marshalledChanId - A JSON marshalled channel ID ([id.ID]). This may be // - marshalledChanId - A JSON marshalled channel ID ([id.ID]).
// retrieved using ChannelsManager.GetChannelId.
func (cm *ChannelsManager) LeaveChannel(marshalledChanId []byte) error { func (cm *ChannelsManager) LeaveChannel(marshalledChanId []byte) error {
// Unmarshal channel ID // Unmarshal channel ID
channelId, err := id.Unmarshal(marshalledChanId) channelId, err := id.Unmarshal(marshalledChanId)
...@@ -312,8 +318,7 @@ func (cm *ChannelsManager) LeaveChannel(marshalledChanId []byte) error { ...@@ -312,8 +318,7 @@ func (cm *ChannelsManager) LeaveChannel(marshalledChanId []byte) error {
// memory (~3 weeks) over the event model. // memory (~3 weeks) over the event model.
// //
// Parameters: // Parameters:
// - marshalledChanId - A JSON marshalled channel ID ([id.ID]). This may be // - marshalledChanId - A JSON marshalled channel ID ([id.ID]).
// retrieved using ChannelsManager.GetChannelId.
func (cm *ChannelsManager) ReplayChannel(marshalledChanId []byte) error { func (cm *ChannelsManager) ReplayChannel(marshalledChanId []byte) error {
// Unmarshal channel ID // Unmarshal channel ID
...@@ -354,8 +359,7 @@ type ChannelSendReport struct { ...@@ -354,8 +359,7 @@ type ChannelSendReport struct {
// on the use case. // on the use case.
// //
// Parameters: // Parameters:
// - marshalledChanId - A JSON marshalled channel ID ([id.ID]). This may be // - marshalledChanId - A JSON marshalled channel ID ([id.ID]).
// retrieved using ChannelsManager.GetChannelId.
// - messageType - The message type of the message. This will be a valid // - messageType - The message type of the message. This will be a valid
// [channels.MessageType]. // [channels.MessageType].
// - message - The contents of the message. This need not be of data type // - message - The contents of the message. This need not be of data type
...@@ -402,8 +406,7 @@ func (cm *ChannelsManager) SendGeneric(marshalledChanId []byte, ...@@ -402,8 +406,7 @@ func (cm *ChannelsManager) SendGeneric(marshalledChanId []byte,
// //
// Parameters: // Parameters:
// - adminPrivateKey - The PEM-encoded admin RSA private key. // - adminPrivateKey - The PEM-encoded admin RSA private key.
// - marshalledChanId - A JSON marshalled channel ID ([id.ID]). This may be // - marshalledChanId - A JSON marshalled channel ID ([id.ID]).
// retrieved using ChannelsManager.GetChannelId.
// - messageType - The message type of the message. This will be a valid // - messageType - The message type of the message. This will be a valid
// [channels.MessageType]. // [channels.MessageType].
// - message - The contents of the message. The message should be at most 510 // - message - The contents of the message. The message should be at most 510
...@@ -455,8 +458,7 @@ func (cm *ChannelsManager) SendAdminGeneric(adminPrivateKey, ...@@ -455,8 +458,7 @@ func (cm *ChannelsManager) SendAdminGeneric(adminPrivateKey,
// lasting forever if [channels.ValidForever] is used. // lasting forever if [channels.ValidForever] is used.
// //
// Parameters: // Parameters:
// - marshalledChanId - A JSON marshalled channel ID ([id.ID]). This may be // - marshalledChanId - A JSON marshalled channel ID ([id.ID]).
// retrieved using ChannelsManager.GetChannelId.
// - message - The contents of the message. The message should be at most 510 // - message - The contents of the message. The message should be at most 510
// bytes. This is expected to be Unicode, and thus a string data type is // bytes. This is expected to be Unicode, and thus a string data type is
// expected // expected
...@@ -502,8 +504,7 @@ func (cm *ChannelsManager) SendMessage(marshalledChanId []byte, ...@@ -502,8 +504,7 @@ func (cm *ChannelsManager) SendMessage(marshalledChanId []byte,
// lasting forever if ValidForever is used. // lasting forever if ValidForever is used.
// //
// Parameters: // Parameters:
// - marshalledChanId - A JSON marshalled channel ID ([id.ID]). This may be // - marshalledChanId - A JSON marshalled channel ID ([id.ID]).
// retrieved using ChannelsManager.GetChannelId.
// - message - The contents of the message. The message should be at most 510 // - message - The contents of the message. The message should be at most 510
// bytes. This is expected to be Unicode, and thus a string data type is // bytes. This is expected to be Unicode, and thus a string data type is
// expected. // expected.
...@@ -554,8 +555,7 @@ func (cm *ChannelsManager) SendReply(marshalledChanId []byte, ...@@ -554,8 +555,7 @@ func (cm *ChannelsManager) SendReply(marshalledChanId []byte,
// Users will drop the reaction if they do not recognize the reactTo message. // Users will drop the reaction if they do not recognize the reactTo message.
// //
// Parameters: // Parameters:
// - marshalledChanId - A JSON marshalled channel ID ([id.ID]). This may be // - marshalledChanId - A JSON marshalled channel ID ([id.ID]).
// retrieved using ChannelsManager.GetChannelId.
// - reaction - The user's reaction. This should be a single emoji with no // - reaction - The user's reaction. This should be a single emoji with no
// other characters. As such, a Unicode string is expected. // other characters. As such, a Unicode string is expected.
// - messageToReactTo - The marshalled [channel.MessageID] of the message you // - messageToReactTo - The marshalled [channel.MessageID] of the message you
......
...@@ -32,12 +32,12 @@ type FileTransfer struct { ...@@ -32,12 +32,12 @@ type FileTransfer struct {
// //
// Example JSON: // Example JSON:
// { // {
// "TransferID":"B4Z9cwU18beRoGbk5xBjbcd5Ryi9ZUFA2UBvi8FOHWo=", // "TransferID":"B4Z9cwU18beRoGbk5xBjbcd5Ryi9ZUFA2UBvi8FOHWo=",
// "SenderID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // "SenderID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD",
// "Preview":"aXQncyBtZSBhIHByZXZpZXc=", // "Preview":"aXQncyBtZSBhIHByZXZpZXc=",
// "Name":"testfile.txt", // "Name":"testfile.txt",
// "Type":"text file", // "Type":"text file",
// "Size":2048 // "Size":2048
// } // }
type ReceivedFile struct { type ReceivedFile struct {
TransferID []byte // ID of the file transfer TransferID []byte // ID of the file transfer
...@@ -51,10 +51,10 @@ type ReceivedFile struct { ...@@ -51,10 +51,10 @@ type ReceivedFile struct {
// FileSend is a public struct that contains the file contents and its name, // FileSend is a public struct that contains the file contents and its name,
// type, and preview. // type, and preview.
// { // {
// "Name":"testfile.txt", // "Name":"testfile.txt",
// "Type":"text file", // "Type":"text file",
// "Preview":"aXQncyBtZSBhIHByZXZpZXc=", // "Preview":"aXQncyBtZSBhIHByZXZpZXc=",
// "Contents":"VGhpcyBpcyB0aGUgZnVsbCBjb250ZW50cyBvZiB0aGUgZmlsZSBpbiBieXRlcw==" // "Contents":"VGhpcyBpcyB0aGUgZnVsbCBjb250ZW50cyBvZiB0aGUgZmlsZSBpbiBieXRlcw=="
// } // }
type FileSend struct { type FileSend struct {
Name string // Name of the file Name string // Name of the file
...@@ -68,10 +68,10 @@ type FileSend struct { ...@@ -68,10 +68,10 @@ type FileSend struct {
// //
// Example JSON: // Example JSON:
// { // {
// "Completed":false, // "Completed":false,
// "Transmitted":128, // "Transmitted":128,
// "Total":2048, // "Total":2048,
// "Err":null // "Err":null
// } // }
type Progress struct { type Progress struct {
Completed bool // Status of transfer (true if done) Completed bool // Status of transfer (true if done)
...@@ -182,8 +182,8 @@ func InitFileTransfer(e2eID int, receiveFileCallback ReceiveFileCallback, ...@@ -182,8 +182,8 @@ func InitFileTransfer(e2eID int, receiveFileCallback ReceiveFileCallback,
// - retry - number of retries allowed // - retry - number of retries allowed
// - callback - callback that reports file sending progress // - callback - callback that reports file sending progress
// - period - Duration (in ms) to wait between progress callbacks triggering. // - period - Duration (in ms) to wait between progress callbacks triggering.
// This value should depend on how frequently you want to receive // This value should depend on how frequently you want to receive updates,
// updates, and should be tuned to your implementation. // and should be tuned to your implementation.
// //
// Returns: // Returns:
// - []byte - unique file transfer ID // - []byte - unique file transfer ID
...@@ -270,8 +270,8 @@ func (f *FileTransfer) CloseSend(tidBytes []byte) error { ...@@ -270,8 +270,8 @@ func (f *FileTransfer) CloseSend(tidBytes []byte) error {
// - tidBytes - file transfer ID // - tidBytes - file transfer ID
// - callback - callback that reports file reception progress // - callback - callback that reports file reception progress
// - period - Duration (in ms) to wait between progress callbacks triggering. // - period - Duration (in ms) to wait between progress callbacks triggering.
// This value should depend on how frequently you want to receive // This value should depend on how frequently you want to receive updates,
// updates, and should be tuned to your implementation. // and should be tuned to your implementation.
func (f *FileTransfer) RegisterSentProgressCallback(tidBytes []byte, func (f *FileTransfer) RegisterSentProgressCallback(tidBytes []byte,
callback FileTransferSentProgressCallback, period int) error { callback FileTransferSentProgressCallback, period int) error {
cb := func(completed bool, arrived, total uint16, cb := func(completed bool, arrived, total uint16,
...@@ -300,8 +300,8 @@ func (f *FileTransfer) RegisterSentProgressCallback(tidBytes []byte, ...@@ -300,8 +300,8 @@ func (f *FileTransfer) RegisterSentProgressCallback(tidBytes []byte,
// - tidBytes - file transfer ID // - tidBytes - file transfer ID
// - callback - callback that reports file reception progress // - callback - callback that reports file reception progress
// - period - Duration (in ms) to wait between progress callbacks triggering. // - period - Duration (in ms) to wait between progress callbacks triggering.
// This value should depend on how frequently you want to receive // This value should depend on how frequently you want to receive updates,
// updates, and should be tuned to your implementation. // and should be tuned to your implementation.
func (f *FileTransfer) RegisterReceivedProgressCallback(tidBytes []byte, func (f *FileTransfer) RegisterReceivedProgressCallback(tidBytes []byte,
callback FileTransferReceiveProgressCallback, period int) error { callback FileTransferReceiveProgressCallback, period int) error {
cb := func(completed bool, received, total uint16, cb := func(completed bool, received, total uint16,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment