mobile

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 16 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

This section is empty.

Types

type Annotation

type Annotation struct {
	Id       string    `json:"id"`
	Date     time.Time `json:"date"`
	AuthorId string    `json:"author_id"`
	Username string    `json:"username,omitempty"`
}

Annotation represents common annotation fields

type Comment

type Comment struct {
	Annotation
	Body string `json:"body"`
}

Comment is a simple wrapper around a comment block

type Contacts

type Contacts struct {
	Items []*wallet.Contact `json:"items"`
}

Contacts is a wrapper around a list of Contacts

type Device

type Device struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

Device is a simple meta data wrapper around a Device

type Devices

type Devices struct {
	Items []Device `json:"items"`
}

Devices is a wrapper around a list of Devices

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 ImageData

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

ImageData is a wrapper around an image data url

type Like

type Like struct {
	Annotation
}

Like is a simple wrapper around a like block

type Messenger

type Messenger interface {
	Notify(event *Event)
}

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

type Mobile

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

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

func NewNode

func NewNode(config *NodeConfig, messenger Messenger) (*Mobile, error)

Create a gomobile compatible wrapper around TextileNode

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) AddDevice

func (m *Mobile) AddDevice(name string, pubKey string) error

AddDevice calls core AddDevice

func (*Mobile) AddExternalThreadInvite

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

AddExternalThreadInvite generates a new external invite link to a thread

func (*Mobile) AddPhoto

func (m *Mobile) AddPhoto(path string) (string, error)

AddPhoto adds a photo by path

func (*Mobile) AddPhotoComment

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

AddPhotoComment adds an comment block targeted at the given block

func (*Mobile) AddPhotoLike

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

AddPhotoLike adds a like block targeted at the given block

func (*Mobile) AddPhotoToThread

func (m *Mobile) AddPhotoToThread(dataId string, key string, threadId string, caption string) (string, error)

SharePhoto adds an existing photo to a new thread

func (*Mobile) AddThread

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

AddThread adds a new thread with the given name

func (*Mobile) AddThreadInvite

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

AddThreadInvite adds a new invite to a thread

func (*Mobile) ContactThreads

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

ContactThreads calls core ContactThreads - id is a contact's peer id

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) Devices

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

Devices lists all devices

func (*Mobile) GetId

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

GetId calls core GetId

func (*Mobile) GetNotifications

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

GetNotifications call core GetNotifications

func (*Mobile) GetPeerProfile

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

GetPeerProfile uses a peer id to look up a profile

func (*Mobile) GetPhotoData

func (m *Mobile) GetPhotoData(id string, path string) (string, error)

GetPhotoData returns a data url of an image under a path

func (*Mobile) GetPhotoDataForMinWidth

func (m *Mobile) GetPhotoDataForMinWidth(id string, minWidth int) (string, error)

GetPhotoDataForSize returns a data url of an image at or above requested size, or the next best option

func (*Mobile) GetPhotoKey

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

GetPhotoKey calls core GetPhotoKey

func (*Mobile) GetPhotoMetadata

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

GetPhotoMetadata returns a meta data object for a photo

func (*Mobile) GetPhotos

func (m *Mobile) GetPhotos(offsetId string, limit int, threadId string) (string, error)

GetPhotos returns thread photo blocks with json encoding

func (*Mobile) GetProfile

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

GetProfile returns this peer's profile

func (*Mobile) GetPubKey

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

GetPubKey calls core GetPubKeyString

func (*Mobile) GetTokens

func (m *Mobile) GetTokens(forceRefresh bool) (string, error)

GetTokens calls core GetTokens

func (*Mobile) GetUsername

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

GetUsername calls core GetUsername

func (*Mobile) IgnorePhoto

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

IgnorePhoto is a semantic helper for mobile, just call IgnoreBlock

func (*Mobile) IgnorePhotoComment

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

IgnorePhotoComment is a semantic helper for mobile, just call IgnoreBlock

func (*Mobile) IgnorePhotoLike

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

IgnorePhotoLike is a semantic helper for mobile, just call IgnoreBlock

func (*Mobile) IsSignedIn

func (m *Mobile) IsSignedIn() bool

IsSignedIn calls core IsSignedIn

func (*Mobile) Overview

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

Overview calls core Overview

func (*Mobile) PhotoThreads

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

PhotoThreads call core PhotoThreads

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) RefreshMessages

func (m *Mobile) RefreshMessages() error

RefreshMessages run the message retriever

func (*Mobile) RemoveDevice

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

RemoveDevice call core RemoveDevice

func (*Mobile) RemoveThread

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

RemoveThread call core RemoveDevice

func (*Mobile) SetAvatarId

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

SetAvatarId calls core SetAvatarId

func (*Mobile) SharePhotoToThread

func (m *Mobile) SharePhotoToThread(dataId string, threadId string, caption string) (string, error)

SharePhoto adds an existing photo to a new thread

func (*Mobile) SignIn

func (m *Mobile) SignIn(username string, password string) error

SignIn build credentials and calls core SignIn

func (*Mobile) SignOut

func (m *Mobile) SignOut() error

SignOut calls core SignOut

func (*Mobile) SignUpWithEmail

func (m *Mobile) SignUpWithEmail(email string, username string, password string, referral string) error

SignUpWithEmail creates an email based registration and calls core signup

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) 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

type NodeConfig

type NodeConfig struct {
	RepoPath string
	CafeAddr string
	LogLevel string
	LogFiles bool
}

NodeConfig is used to configure the mobile node NOTE: logLevel is one of: CRITICAL ERROR WARNING NOTICE INFO DEBUG

type Notifications

type Notifications struct {
	Items []repo.Notification `json:"items"`
}

Notifications is a wrapper around a list of Notifications

type Photo

type Photo struct {
	Id       string              `json:"id"`
	BlockId  string              `json:"block_id"`
	Date     time.Time           `json:"date"`
	AuthorId string              `json:"author_id"`
	Caption  string              `json:"caption,omitempty"`
	Username string              `json:"username,omitempty"`
	Metadata *util.PhotoMetadata `json:"metadata,omitempty"`
	Comments []Comment           `json:"comments"`
	Likes    []Like              `json:"likes"`
}

Photo is a simple meta data wrapper around a photo block

type Photos

type Photos struct {
	Items []Photo `json:"items"`
}

Photos is a wrapper around a list of photos

type Thread

type Thread struct {
	Id    string `json:"id"`
	Name  string `json:"name"`
	Peers int    `json:"peers"`
}

Thread is a simple meta data wrapper around a Thread

type Threads

type Threads struct {
	Items []Thread `json:"items"`
}

Threads is a wrapper around a list of Threads

Jump to

Keyboard shortcuts

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