Skip to content

Instantly share code, notes, and snippets.

@sferoze
Last active October 26, 2015 20:58
Show Gist options
  • Save sferoze/b3ae48e5c266271d06d6 to your computer and use it in GitHub Desktop.
Save sferoze/b3ae48e5c266271d06d6 to your computer and use it in GitHub Desktop.
##### Rewards API #####
# CALL THIS METHOD TO SEARCH AND RECEIVE GET A LIST OF PRODUCTS ON AMAZON
amazonItemSearch: (keyword, category, page) ->
# Page value can be a number 1-10.
# Category has to be one of the categories available on the parent web
# Keyword is the search keyword
return [Object, Object, Object] # Will receive an array with objects as return value
# Description of the return object in the array
# Each field has further objects inside. Check out the entire object to find useful fields.
Object =
ASIN:
DetailPageURL:
ImageSets:
ItemAttributes:
ItemLinks:
LargeImage:
MediumImage:
OfferSummary:
Offers:
SmallImage:
# CALL THIS METHOD TO ADD A REWARD
childAddReward: (params) ->
# description of params you need to provide
params =
description: String
points: Number # only required if reward type is family
productInfo:# only required if reward type is online. These fields are available in the return object from searching amazon.
url: String
itemId: String
title: String
imageURL: String
amountCents: String
rewardType: String # allowedValues ['Family', 'Online']
addToWishlist: (rewardId) ->
removeFromWishlist: (rewardId) ->
##### Todo API ######
# CALL THIS METHOD TO ADD A TODO
childAddTodo: (params) ->
params =
description: String
timeOfDay: String # allowedValues: ['Anytime', 'Morning', 'Afternoon', 'Evening']
dueDate: Date-String
repeat: Boolean
rule: Object # required if repeat is true
# For the rrule. Please follow the https://jkbrzt.github.io/rrule/
# for freq use the number paired with which repeat you want
# 3 = RRule.DAILY
# 2 = RRule.WEEKLY
# 1 = RRule.MONTHLY
# 0 = RRule.YEARLY
# CALL THIS METHOD TO FIND OUT IF A TODO HAS A PREVIOUS APPROVAL AND FIND WHAT DATE THE PREVIOUS APPROVAL WAS ON.
previousTodoApproval: (todoId) ->
return ['True', '2015-10-13T04:25:55.278Z'] or ['False']
# You will need this method if you are editing a repeat todo
# If editing a repeat todo, use this method to find out if the repeat todo has a previous approval in the series.
# If so, let the user know that editing the series will only edit the series starting with the last approval.
# Let me know when you get here, I can provide more specifics.
# Will return an array with first spot being Boolean describing if the todo
# has previous approval
# The second spot will be the date of the previous approval if first spot is True
childEditTodo: (todoId, params) ->
# pass in the same params as described for addTodo. Must pass in all required params for addTodo.
childDeleteTodo: (todoId) ->
# pass in the todoId of the todo you want to remove.
##### Event API #####
# CALL THIS TO ADD AN EVENT
childAddEvent: (params) ->
# description of params to pass in
params =
description: String
location: String
notes: String
allDay: Boolean
repeat: Boolean
startDate: Date-String
endDate: Date-String
rule: Object # only required if repeat is true
childEditEvent: (eventId, params) ->
# pass in same params as in addEvent
childDeleteEvent: (eventId) ->
# pass in the eventId of the event you want to remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment