Yurba.js / yurba.js / AppResource
Class: AppResource
App Tokens
createToken()
createToken(
publicKey,redirectUrl):Promise<AppToken>
Creates app token
Parameters
publicKey
string
App public key
redirectUrl
string
Redirect URL
Returns
Promise<AppToken>
AppToken Created app token
Since
1.0.0
Throws
If parameters are invalid
Example
const token = await rest.apps.createToken('public_key_here', 'https://example.com/callback');deleteToken()
deleteToken(
token):Promise<BaseOkay>
Deletes app token
Parameters
token
string
App token
Returns
Promise<BaseOkay>
BaseOkay Delete response
Since
1.0.0
Throws
If token is invalid
Example
await rest.apps.deleteToken('token_here');getToken()
getToken(
publicKey):Promise<AppToken>
Gets app token
Parameters
publicKey
string
App public key
Returns
Promise<AppToken>
AppToken object
Since
1.0.0
Throws
If public key is invalid
Example
const token = await rest.apps.getToken('public_key_here');getTokens()
getTokens(
publicKey):Promise<AppToken[]>
Gets app tokens
Parameters
publicKey
string
App public key
Returns
Promise<AppToken[]>
Array of AppToken objects
Since
1.0.0
Throws
If public key is invalid
Example
const tokens = await rest.apps.getTokens('public_key_here');getUser()
getUser(
token,secretKey):Promise<Author>
Gets user by app token
Parameters
token
string
App token
secretKey
string
App secret key
Returns
Promise<Author>
Author object
Since
1.0.0
Throws
If parameters are invalid
Example
const user = await rest.apps.getUser('token_here', 'secret_key_here');Apps Core
create()
create(
payload):Promise<App>
Creates a new app
Parameters
payload
CreateAppPayload App creation data
Returns
Promise<App>
App Created app
Since
1.0.0
Throws
If payload is invalid
Example
const app = await rest.apps.create({
name: 'My App',
redirectUrl: 'https://example.com/callback'
});delete()
delete(
appId):Promise<BaseOkay>
Deletes an app
Parameters
appId
number
App identifier
Returns
Promise<BaseOkay>
BaseOkay Delete response
Since
1.0.0
Throws
If app ID is invalid
Example
await rest.apps.delete(123);get()
get(
publicKey):Promise<App>
Gets an app by public key
Parameters
publicKey
string
App public key
Returns
Promise<App>
App object
Since
1.0.0
Throws
If public key is invalid or app not found
Example
const app = await rest.apps.get('public_key_here');getAll()
getAll():
Promise<App[]>
Gets all apps
Returns
Promise<App[]>
Array of App objects
Since
1.0.0
Throws
If apps cannot be retrieved
Example
const apps = await rest.apps.getAll();