This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Post SquareSpace form entry to TripleSeat Form API. | |
* | |
* 0a. SquareSpace is connected to the SquareSpace form sheet. | |
* 0b. When a user makes a form entry in SquareSpace it is sent to a Google Sheet | |
* | |
* 1. This is a special function that looks for rows in this GoogleSheet that have not been "sent". | |
* 2. This function then sends a POST request with the form data to TripleSeat. | |
* 3. Then this function updates "TripleSeat Status" field to "Sent" in each row that was sent to TripleSeat. | |
* 4. Create a trigger in this project to run this function every 5 minutes, add yourself for script failure notifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension Dictionary where Value: RangeReplaceableCollection { | |
public mutating func append(element: Value.Iterator.Element, toValueOfKey key: Key) -> Value? { | |
var value: Value = self[key] ?? Value() | |
value.append(element) | |
self[key] = value | |
return value | |
} | |
} |