mobile

package
v1.0.0-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 30 Imported by: 0

README

@textile/go-mobile

banner


MIT License CircleCI

What is Textile?

Riding on IPFS and libp2p, Textile aims to provide a set of straightforward primitives for building decentralized mobile applications.

This repository contains pre-built binary bindings for running a Textile Photos node on iOS and Android. See textile-mobile for the Textile Photos iOS/Android app.

Install

yarn add @textile/go-mobile

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRepo

func InitRepo(config *InitConfig) error

InitRepo calls core InitRepo

func MigrateRepo

func MigrateRepo(config *MigrateConfig) error

MigrateRepo calls core MigrateRepo

func NewWallet

func NewWallet(wordCount int) (string, error)

NewWallet creates a brand new wallet and returns its recovery phrase

func WalletAccountAt

func WalletAccountAt(phrase string, index int, password string) (string, error)

WalletAccountAt derives the account at the given index

Types

type Callback

type Callback interface {
	Call(payload []byte, err error)
}

Callback is used for asyc methods (payload is a protobuf)

type Event

type Event struct {
	Name    string `json:"name"`
	Payload string `json:"payload"`
}

Message is a generic go -> bridge message structure

type ExternalInvite

type ExternalInvite struct {
	Id      string `json:"id"`
	Key     string `json:"key"`
	Inviter string `json:"inviter"`
}

ExternalInvite is a wrapper around an invite id and key

type FileData

type FileData struct {
	Url string `json:"url"`
}

FileData is a wrapper around a file data url

type InitConfig

type InitConfig struct {
	Seed      string
	RepoPath  string
	LogLevel  string
	LogToDisk bool
}

InitConfig is used to setup a textile node

type Messenger

type Messenger interface {
	Notify(event *Event)
}

Messenger is used to inform the bridge layer of new data waiting to be queried

type MigrateConfig

type MigrateConfig struct {
	RepoPath string
}

MigrateConfig is used to define options during a major migration

type Mobile

type Mobile struct {
	RepoPath string
	// contains filtered or unexported fields
}

Mobile is the name of the framework (must match package name)

func NewTextile

func NewTextile(config *RunConfig, messenger Messenger) (*Mobile, error)

Create a gomobile compatible wrapper around Textile

func (*Mobile) AcceptExternalThreadInvite

func (m *Mobile) AcceptExternalThreadInvite(id string, key string) (string, error)

AcceptExternalThreadInvite notifies the thread of a join

func (*Mobile) AcceptThreadInviteViaNotification

func (m *Mobile) AcceptThreadInviteViaNotification(id string) (string, error)

AcceptThreadInviteViaNotification call core AcceptThreadInviteViaNotification

func (*Mobile) AddContact

func (m *Mobile) AddContact(id string, address string, username string) error

AddContact calls core AddContact

func (*Mobile) AddExternalThreadInvite

func (m *Mobile) AddExternalThreadInvite(threadId string) (string, error)

AddExternalThreadInvite generates a new external invite link to a thread

func (*Mobile) AddPeerToThread

func (m *Mobile) AddPeerToThread(id string, threadId string) error

AddPeerToThread call thread AddPeer

func (*Mobile) AddSchema

func (m *Mobile) AddSchema(jsonstr string) (string, error)

AddSchema adds a new schema via schema mill

func (*Mobile) AddThread

func (m *Mobile) AddThread(key string, name string) (string, error)

AddThread adds a new thread with the given name

func (*Mobile) AddThreadComment

func (m *Mobile) AddThreadComment(blockId string, body string) (string, error)

AddThreadComment adds a comment targeted at the given block

func (*Mobile) AddThreadFiles

func (m *Mobile) AddThreadFiles(dir []byte, threadId string, caption string) (string, error)

AddThreadFiles adds a prepared file to a thread

func (*Mobile) AddThreadFilesByTarget

func (m *Mobile) AddThreadFilesByTarget(target string, threadId string, caption string) (string, error)

AddThreadFilesByTarget adds a prepared file to a thread by referencing its top level hash

func (*Mobile) AddThreadIgnore

func (m *Mobile) AddThreadIgnore(blockId string) (string, error)

AddThreadIgnore adds an ignore targeted at the given block and unpins any associated target data

func (*Mobile) AddThreadInvite

func (m *Mobile) AddThreadInvite(threadId string, inviteeId string) (string, error)

AddThreadInvite adds a new invite to a thread

func (*Mobile) AddThreadLike

func (m *Mobile) AddThreadLike(blockId string) (string, error)

AddThreadLike adds a like targeted at the given block

func (*Mobile) Address

func (m *Mobile) Address() string

Address returns account address

func (*Mobile) CafeSession

func (m *Mobile) CafeSession(peerId string) (string, error)

CafeSession calls core CafeSession

func (*Mobile) CafeSessions

func (m *Mobile) CafeSessions() (string, error)

CafeSessions calls core CafeSessions

func (*Mobile) CheckCafeMessages

func (m *Mobile) CheckCafeMessages() error

CheckCafeMessages calls core CheckCafeMessages

func (*Mobile) Contact

func (m *Mobile) Contact(id string) (string, error)

Contact calls core Contact

func (*Mobile) ContactThreads

func (m *Mobile) ContactThreads(id string) (string, error)

ContactThreads calls core ContactThreads

func (*Mobile) ContactUsername

func (m *Mobile) ContactUsername(id string) string

ContactUsername calls core ContactUsername

func (*Mobile) Contacts

func (m *Mobile) Contacts() (string, error)

Contacts calls core Contacts

func (*Mobile) CountUnreadNotifications

func (m *Mobile) CountUnreadNotifications() int

CountUnreadNotifications calls core CountUnreadNotifications

func (*Mobile) DeregisterCafe

func (m *Mobile) DeregisterCafe(peerId string) error

DeegisterCafe calls core DeregisterCafe

func (*Mobile) FileData

func (m *Mobile) FileData(hash string) (string, error)

FileData returns a data url of a raw file under a path

func (*Mobile) IgnoreThreadInviteViaNotification

func (m *Mobile) IgnoreThreadInviteViaNotification(id string) error

IgnoreThreadInviteViaNotification call core IgnoreThreadInviteViaNotification

func (*Mobile) ImageFileDataForMinWidth

func (m *Mobile) ImageFileDataForMinWidth(pth string, minWidth int) (string, error)

ImageFileDataForMinWidth returns a data url of an image at or above requested size, or the next best option. Note: Now that consumers are in control of image sizes via schemas, handling this here doesn't feel right. We can eventually push this up to RN, Obj-C, Java. Note: pth is <target>/<index>, e.g., "Qm.../0"

func (*Mobile) Notifications

func (m *Mobile) Notifications(offset string, limit int) (string, error)

Notifications call core Notifications

func (*Mobile) OnlineCh

func (m *Mobile) OnlineCh() <-chan struct{}

OnlineCh returns core OnlineCh

func (*Mobile) Overview

func (m *Mobile) Overview() (string, error)

Overview calls core Overview

func (*Mobile) PeerId

func (m *Mobile) PeerId() (string, error)

PeerId returns the ipfs peer id

func (*Mobile) PeerProfile

func (m *Mobile) PeerProfile(peerId string) (string, error)

PeerProfile looks up a profile by id

func (*Mobile) PrepareFiles

func (m *Mobile) PrepareFiles(path string, threadId string) ([]byte, error)

PrepareFiles processes a file by path for a thread, but does NOT share it

func (*Mobile) PrepareFilesAsync

func (m *Mobile) PrepareFilesAsync(path string, threadId string, cb Callback)

PrepareFilesAsync is the async flavor of PrepareFiles

func (*Mobile) Profile

func (m *Mobile) Profile() (string, error)

Profile returns the local profile

func (*Mobile) ReadAllNotifications

func (m *Mobile) ReadAllNotifications() error

ReadAllNotifications calls core ReadAllNotifications

func (*Mobile) ReadNotification

func (m *Mobile) ReadNotification(id string) error

ReadNotification calls core ReadNotification

func (*Mobile) RefreshCafeSession

func (m *Mobile) RefreshCafeSession(peerId string) (string, error)

RefreshCafeSession calls core RefreshCafeSession

func (*Mobile) RegisterCafe

func (m *Mobile) RegisterCafe(peerId string) error

RegisterCafe calls core RegisterCafe

func (*Mobile) RemoveThread

func (m *Mobile) RemoveThread(id string) (string, error)

RemoveThread call core RemoveThread

func (*Mobile) Seed

func (m *Mobile) Seed() string

Seed returns account seed

func (*Mobile) SetAvatar

func (m *Mobile) SetAvatar(hash string) error

SetAvatar calls core SetAvatar

func (*Mobile) SetUsername

func (m *Mobile) SetUsername(username string) error

SetUsername calls core SetUsername

func (*Mobile) Start

func (m *Mobile) Start() error

Start the mobile node

func (*Mobile) Stop

func (m *Mobile) Stop() error

Stop the mobile node

func (*Mobile) ThreadFiles

func (m *Mobile) ThreadFiles(offset string, limit int, threadId string) (string, error)

ThreadFiles calls core ThreadFiles

func (*Mobile) ThreadInfo

func (m *Mobile) ThreadInfo(threadId string) (string, error)

ThreadInfo calls core ThreadInfo

func (*Mobile) Threads

func (m *Mobile) Threads() (string, error)

Threads lists all threads

func (*Mobile) Username

func (m *Mobile) Username() (string, error)

Username calls core Username

func (*Mobile) Version

func (m *Mobile) Version() string

Version returns core Version

type RunConfig

type RunConfig struct {
	RepoPath string
}

RunConfig is used to define run options for a mobile node

type WalletAccount

type WalletAccount struct {
	Seed    string `json:"seed"`
	Address string `json:"address"`
}

WalletAccount represents a derived account in a wallet

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL