client

package
v0.0.0-...-0cd80e9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2014 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//various constants
	URL string = "https://feelinsonice-hrd.appspot.com"

	SECRET              string = "iEk21fuwZApXlz93750dmW22pw389dPwOk"
	STATIC_TOKEN        string = "m198sOkJEn37DjqZ32lpRu76xmw288xSQ9"
	BLOB_ENCRYPTION_KEY string = "M02cnQ51Ji97vwT4"
	PATTERN             string = "0001110111101110001111010101111011010001001110011000110001000110"

	//media types
	IMAGE                        = 0
	VIDEO                        = 1
	VIDEO_NOAUDIO                = 2
	FRIEND_REQUEST               = 3
	FRIEND_REQUEST_IMAGE         = 4
	FRIEND_REQUEST_VIDEO         = 5
	FRIEND_REQUEST_VIDEO_NOAUDIO = 6

	//media states
	NONE       = -1
	SENT       = 0
	DELIVERED  = 1
	VIEWED     = 2
	SCREENSHOT = 3
)

Variables

This section is empty.

Functions

func ConvertValuesToMap

func ConvertValuesToMap(params url.Values) map[string]string

func CreateGetRequest

func CreateGetRequest(endpoint, auth_token string, params url.Values) (*http.Request, error)

func CreateMediaId

func CreateMediaId(username string) string

leaving this out for now, as it depended on an external lib, and I'm not using it yet

func CreatePostRequest

func CreatePostRequest(endpoint string, auth_token string, params url.Values) (*http.Request, error)

func CreateRequestToken

func CreateRequestToken(token, timestamp string) string

func DecodeBase64

func DecodeBase64(s string) []byte

func Decrypt

func Decrypt(ciphertext []byte) []byte

func DecryptStory

func DecryptStory(data []byte, key, iv string) []byte

func EncodeBase64

func EncodeBase64(b []byte) string

func Encrypt

func Encrypt(data []byte) []byte

func GetBlob

func GetBlob(snap_id string, user User) []byte

returns the image/video bytes after being decrypted

func GetStory

func GetStory(story_id, auth_token, media_key, media_iv string) []byte

func GetTimestamp

func GetTimestamp() string

func IsImage

func IsImage(data []byte) bool

func IsOverlay

func IsOverlay(data []byte) bool

func IsVideo

func IsVideo(data []byte) bool

func IsZip

func IsZip(data []byte) bool

not yet implemented

func Logout

func Logout(username, auth_token string) bool

func MakeGetRequest

func MakeGetRequest(endpoint string, auth_token string, params url.Values) (*http.Response, error)

func MakeRequest

func MakeRequest(endpoint string, auth_token string, params url.Values) (*http.Response, error)

func PKCS5Pad

func PKCS5Pad(data []byte) []byte

func PanicIfErr

func PanicIfErr(err error)

func Unzip

func Unzip(data []byte) [][]byte

some snap data is zipped up, which makes it hard to get at the solution is to save the data to disk, and then read it in with a zip reader, and then return the byte values for each thing in the zip usually there is an overlay (image) and contents(image or video) Note: zipped data is cleaned up after returning

Types

type Friend

type Friend struct {
	Name        string `json:"name"`
	DisplayName string `json:"display"`
}

type FriendStory

type FriendStory struct {
	Viewed  bool         `json:"viewed"`
	Stories StoryContent `json:"story"`
}

individual story object

type FriendStoryDict

type FriendStoryDict struct {
	Username      string        `json:"username"`
	FriendStories []FriendStory `json:"stories"`
}

User mapped to a list of that users available stories

type LoginResponse

type LoginResponse struct {
	Bests     []string `json:"bests"`
	Score     int      `json:"score"`
	Snaps     []Snap   `json:"snaps"`
	Friends   []Friend `json:"friends"`
	AuthToken string   `json:"auth_token"`
	Username  string   `json:"username"`
}

//////////////////////////////// Login Structs ////////////////////////////////

func GetUpdates

func GetUpdates(username, auth_token string) LoginResponse

similar to a login, but does not authenticate simply retreives the snap response

func Login

func Login(username, password string) LoginResponse

type Snap

type Snap struct {
	SnapId        string `json:"id"`
	ScreenName    string `json:"sn"`
	RecipientName string `json:"rp"`
	MediaType     int    `json:"m"`
	MediaState    int    `json:"st"`
	Unopened      uint64 `json:"t,omitempty"`
}

func (Snap) IsImage

func (s Snap) IsImage() bool

func (Snap) IsIncoming

func (s Snap) IsIncoming() bool

func (Snap) IsUnopened

func (s Snap) IsUnopened() bool

func (Snap) IsVideo

func (s Snap) IsVideo() bool

type StoryContent

type StoryContent struct {
	Id           string `json:"id"`
	Username     string `json:"username"`
	MediaId      string `json:"media_id"`
	MediaKey     string `json:"media_key"`
	MediaIv      string `json:"media_iv"`
	ThumbnailIv  string `json:"thumbnail_iv"`
	MediaType    int    `json:"media_type"`
	MediaUrl     string `json:"media_url"`
	ThumbnailUrl string `json:"thumbnail_url"`
}

inner content for a story

type StoryResponse

type StoryResponse struct {
	Friends []FriendStoryDict `json:"friend_stories"`
}

func GetStories

func GetStories(username, auth_token string) StoryResponse

type User

type User struct {
	Username      string        `form:"username" binding:"required"`
	Password      string        `form:"password" binding:"required"`
	AuthToken     string        `form:"auth_token"`
	FriendStories StoryResponse //store the last gotten story response
}

Jump to

Keyboard shortcuts

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