This file contains hidden or 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 {StatewizeClient} from "statewize-client-sdk"; | |
const sdk = new StatewizeClient(process.env.STW_TOKEN); | |
// Report an action, along with its state (start/finished/failed): | |
await sdk.reportEvent({ slug: `checkout-express`, type: 'finished', | |
// Optionally, add data attachments that will help you debug | |
attachments: [{ | |
type: 'object', // can be any object, file or text you like |
This file contains hidden or 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
const res = await sdk.executions.startExecutionSync({ | |
token: process.env.MY_FLOW_TOKEN, | |
entryPayload: {user: {id: 123, data: 'whatever-you-need'}} | |
}); |
This file contains hidden or 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
{ | |
"stw-v1": { | |
"deployment": { | |
"bundles": [ | |
{ | |
"bundleDir": "./build/functions", | |
"runtime": "nodejs12.x", | |
"token": "TUP5vJCp7aRvdwBPuqR1HSpZMYZ9kHh27kt35emNa8uk2WPJaDfgEXXBe33HyhhU", | |
"layout": [ | |
{ |
This file contains hidden or 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
{ | |
"stw-v1": { | |
"deployment": { | |
"bundles": [ | |
{ | |
"bundleDir": "./toDeploy", | |
"runtime": "nodejs12.x", | |
"token": "PzaJq1Vwzb1MDGeRrCFjdtZFvy3BwAyaqEjNbFthxGth4kE7wNeJ82Bq2JQ6YFYe", | |
"layout": [ | |
{ |
This file contains hidden or 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
const sdk = require('statewize-client-sdk'); | |
const execution = await sdk.executions.startExecutionSync({ | |
token: process.env.PROJECT_TOKEN, | |
entryPayload: {user: {id: 1234, otherParams: 'whatever-you-need'}} | |
}); |
This file contains hidden or 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
{ | |
"data": { | |
"id": "447890025715", | |
"type": "get_usage_currents", | |
"attributes": { | |
"plan": { | |
"code": "SM_SMALL", | |
"description": "2GB", | |
"autoRenew": true, | |
"start": "2020-10-06T01:00:02+01:00", |
This file contains hidden or 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
{ | |
"data": [ | |
{ | |
"id": "NEW_10GB_RETAIL", | |
"type": "package", | |
"attributes": { | |
"id": "NEW_10GB_RETAIL", | |
"description": "10GB Data add-on (Retail)", | |
"renewalPrice": 1500, | |
"name": "10GB Data add-on (Retail)", |
This file contains hidden or 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
{ | |
"plans": [ | |
{ | |
"currency": "GB", | |
"description": "5GB Data, Unlimited Text, Unlimited Voice", | |
"description_pre": "4GB of data", | |
"id": "NEW_RETAIL", | |
"name": "Retail Plan 2", | |
"price": 1000, | |
"type": "data", |
This file contains hidden or 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
config.middleware.use FayeRails::Middleware, mount: '/faye', engine: { type: Faye::Redis, host: ENV['REDIS_HOST'] }, :timeout => 25 |
This file contains hidden or 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
EM.run { | |
client = Faye::Client.new('http://localhost:3000/faye') | |
publication = client.publish('/foo', 'text' => 'Hello world') | |
publication.callback do | |
puts 'SUCCESS!' | |
EM.stop | |
end | |
publication.errback do |error| | |
puts "[PUBLISH FAILED]" | |
EM.stop |
NewerOlder