This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import agent from '../structures/agent' | ||
|
||
const checkWaitlistStatus = async (profile, name) => { | ||
'use strict' | ||
|
||
const response = await agent( | ||
'/check_waitlist_status', | ||
{}, | ||
{ | ||
...profile, | ||
userId: '(null)' | ||
} | ||
) | ||
const data = await response.json() | ||
|
||
return data | ||
} | ||
|
||
export default checkWaitlistStatus | ||
|
||
export const specification = { | ||
is_onborading: Boolean, | ||
is_waitlisted: Boolean, | ||
success: Boolean | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { v4 as uuidv4 } from 'uuid' | ||
|
||
import agent from '../structures/agent' | ||
|
||
const recordActionTrails = async (profile, opts) => { | ||
'use strict' | ||
|
||
opts = opts || {} | ||
|
||
opts.type = opts.type || 'app_opened' | ||
opts.date = opts.date || Math.floor(Date.now() / 1000) + '.' + Math.random().toString(10).slice(-6) // NOTE: e.g. 1613453171.505264; | ||
opts.eventId = (opts.eventId || uuidv4()).toUpperCase() | ||
|
||
const response = await agent( | ||
'/record_action_trails', | ||
{ | ||
body: { | ||
action_trails: [ | ||
{ | ||
blob_data: { | ||
client_event_id: opts.eventId, | ||
client_time_recorded: opts.date | ||
}, | ||
client_event_id: opts.eventId, | ||
client_time_created: opts.date, | ||
trail_type: opts.type | ||
} | ||
] | ||
} | ||
}, | ||
profile | ||
) | ||
const data = await response.json() | ||
|
||
return data | ||
} | ||
|
||
export default recordActionTrails | ||
|
||
export const specification = { | ||
success: Boolean | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import agent from '../structures/agent' | ||
|
||
const updateName = async (profile, name) => { | ||
'use strict' | ||
|
||
const response = await agent( | ||
'/update_name', | ||
{ | ||
body: { | ||
name: name || null // NOTE: String in `${firstName} ${lastName}` format. | ||
} | ||
}, | ||
profile | ||
) | ||
const data = await response.json() | ||
|
||
return data | ||
} | ||
|
||
export default updateName | ||
|
||
export const specification = { | ||
error_message: String, | ||
success: Boolean | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import agent from '../structures/agent' | ||
|
||
const updateUsername = async (profile, name) => { | ||
'use strict' | ||
|
||
const response = await agent( | ||
'/update_username', | ||
{ | ||
body: { | ||
twitter_secret: null, | ||
twitter_token: null, | ||
username: name || null // NOTE: Max 16 character. | ||
} | ||
}, | ||
profile | ||
) | ||
const data = await response.json() | ||
|
||
return data | ||
} | ||
|
||
export default updateUsername | ||
|
||
export const specification = { | ||
error_message: String, | ||
success: Boolean | ||
} |