aliza

package module
v0.0.0-...-c0dd161 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2016 License: MIT Imports: 22 Imported by: 0

README

Aliza

A Google APP Engine GO server to upload metadata with images.

Documentation

Index

Constants

View Source
const AppNamespace = "com.vernonsung.testquerygcs"
View Source
const BaseUrl = "/api/0.1/"
View Source
const GaeProjectNumber = "492596673998"
View Source
const GcmApiKey = "AIzaSyBgH4A9CdPgc-Kh54j5TLgKl7x3YCGBtOU"
View Source
const GcmGroupURL = "https://android.googleapis.com/gcm/notification"

GCM server

View Source
const GcmURL = "https://gcm-http.googleapis.com/gcm/send"

GCM server

View Source
const GroupKind = "Group"
View Source
const GroupRoot = "Group root"
View Source
const HttpHeaderInstanceId = "Instance-Id"

HTTP header

View Source
const InstanceIdVerificationUrl = "https://iid.googleapis.com/iid/info/"

GCM server

View Source
const ItemKind = "Item"
View Source
const ItemRoot = "Item Root"
View Source
const UserKind = "User"
View Source
const UserRoot = "User root"

Variables

This section is empty.

Functions

func JoinGroup

func JoinGroup(rw http.ResponseWriter, req *http.Request)

PUT ./groups" Success: 204 No Content Failure: 400 Bad Request, 403 Forbidden, 500 Internal Server Error

func LeaveGroup

func LeaveGroup(rw http.ResponseWriter, req *http.Request)

DELETE ./groups/xxx", xxx: Group name Header {"Instance-Id":"..."} Success returns 204 No Content Failure returns 400 Bad Request, 403 Forbidden, 500 Internal Server Error

func SendGroupMessage

func SendGroupMessage(rw http.ResponseWriter, req *http.Request)

Receive a message from an APP instance. Check it's instancd ID. Send the message to the gruop. POST ./group-messages" Success: 204 No Content Failure: 400 Bad Request, 403 Forbidden, 404 NotFound, 500 InternalError

func SendTopicMessage

func SendTopicMessage(rw http.ResponseWriter, req *http.Request)

Receive a message from an APP instance. Check it's instancd ID. Send the message to the topic. POST ./topic-messages" Success: 204 No Content Failure: 400 Bad Request, 403 Forbidden, 404 NotFound, 500 InternalError

func SendUserMessage

func SendUserMessage(rw http.ResponseWriter, req *http.Request)

Receive a message from an APP instance. Check it's instancd ID. Send the message back. POST ./user-messages" Success: 204 No Content Failure: 400 Bad Request, 403 Forbidden

func UpdateMyself

func UpdateMyself(rw http.ResponseWriter, req *http.Request)

PUT ./myself" Success: 200 OK Failure: 400 Bad Request

func VerifyRequest

func VerifyRequest(req *http.Request) (isValid bool)

Types

type Group

type Group struct {
	Name            string   `json:"name"`
	Owner           string   `json:"owner"`           // Instance ID
	Members         []string `json:"members"`         // Instance ID list
	NotificationKey string   `json:"notificationkey"` // GCM device group unique ID
}

Data structure got from datastore group kind

type GroupMessage

type GroupMessage struct {
	// To authentication
	InstanceId string `json:"instanceid"`
	// To the target user
	GroupName string `json:"groupname"`
	Message   string `json:"message"`
}

HTTP body of sending a message to a group

type GroupOperation

type GroupOperation struct {
	Operation             string   `json:"operation"`                  // "create", "add", "remove"
	Notification_key_name string   `json:"notification_key_name"`      // A unique group name in a Google project
	Notification_key      string   `json:"notification_key,omitempty"` // A unique key to identify a group
	Registration_ids      []string `json:"registration_ids"`           // APP registration tokens in the group
}

HTTP body to send to Google Cloud Messaging server to manage device groups

type GroupOperationResponse

type GroupOperationResponse struct {
	Notification_key string `json:"notification_key"` // A unique key to identify a group
	Error            string `json:"error"`            // Error message
}

HTTP body received from Google Cloud Messaging server

type GroupUser

type GroupUser struct {
	// To authentication
	InstanceId string `json:"instanceid"`
	// The group
	GroupName string `json:"groupname"`
}

HTTP body of joining or leaving group requests from users

type Item

type Item struct {
	Id         string    `json:"id"          datastore:"-"`
	Image      string    `json:"image"`
	Thumbnail  string    `json:"thumbnail"`
	People     int       `json:"people"`
	Attendant  int       `json:"attendant"`
	Latitude   float64   `json:"latitude"`
	Longitude  float64   `json:"longitude"`
	CreateTime time.Time `json:"createtime"`
	// Members are whom join this item. The first member is the item owner.
	// When the first member leaves, delete the item.
	Members []ItemMember `json:"members"`
	// Google Cloud Messaging group unique name and ID. Reference: https://developers.google.com/cloud-messaging/notifications
	GcmGroupName string `json:"gcmgroupname"`
	GcmGroupKey  string `json:"gcmgroupkey"`
}

type ItemMember

type ItemMember struct {
	UserKey     string `json:"userkey"`
	Attendant   int    `json:"attendant"`
	PhoneNumber string `json:"phonenumber,omitempty"`
	SkypeId     string `json:"skypeid,omitempty"`
}

type ItemUpdateNotification

type ItemUpdateNotification struct {
	Message       string `json:"message"`
	ItemId        string `json:"itemid"`
	RequestUserId string `json:"requestuserid"`
}

type TopicMessage

type TopicMessage struct {
	// To authentication
	InstanceId string `json:"instanceid"`
	// To the target user
	Topic   string `json:"topic"`
	Message string `json:"message"`
}

HTTP body of sending a message to a topic

type UpdateItemState

type UpdateItemState int

Update item state

type User

type User struct {
	InstanceId        string    `json:"instanceid"`
	RegistrationToken string    `json:"registrationtoken"`
	LastUpdateTime    time.Time `json:"lastupdatetime"`
}

Data structure got from datastore user kind

type UserMessage

type UserMessage struct {
	// To authentication
	InstanceId string `json:"instanceid"`
	// To the target user
	UserId  string `json:"userid"` // Datastore user kind key string
	Message string `json:"message"`
}

HTTP body of sending a message to a user

type UserRegistrationResponseBody

type UserRegistrationResponseBody struct {
	UserId string `json:"userid"`
}

HTTP response body to user registration

type UserRegistrationTokenAuthenticity

type UserRegistrationTokenAuthenticity struct {
	Application      string `json:"application"`
	AuthorizedEntity string `json:"authorizedEntity"`
}

HTTP response body from Google Instance ID authenticity service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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