Skip to content

Basic Command Word

checkHeaders

php
\FresnsCmdWord::plugin('Fresns')->checkHeaders();
Return Example
json
{
    "code": 0,
    "message": "ok",
    "data": {
        "appId": "qe12345",
        "platformId": 4,
        "version": "2.0.0",
        "deviceInfo": "",
        "langTag": "zh-Hans",
        "timezone": "+8",
        "contentFormat": "",
        "aid": "6a3bb3bc",
        "aidToken": "uoX1hk6SHUgB2MFGJwNx38dem9DA7Vsz",
        "uid": 782622,
        "uidToken": "PqBpwPLJgfd1sH0X5JffYFGxTSc8RW7c",
        "signature": "d5db4371a0c2d7e17009dea8d53ecf15a7ec07b9",
        "timestamp": 1626426833
    }
}

verifySign

php
\FresnsCmdWord::plugin('Fresns')->verifySign($wordBody);
Parameter NameTypeRequiredDescription
appIdStringrequiredApp ID
platformIdNumberrequiredPlatform ID (Key value of the platforms key name in the configuration table)
versionStringrequiredSemantic version number
timestampNumberrequiredSignature generation time (current Unix timestamp, accurate to seconds or milliseconds)
signatureStringrequiredRequest signature
aidStringoptionalAccount parameter (Account main table accounts->aid field)
aidTokenStringoptionalAccount identity credential
uidNumberoptionalUser parameter (User main table users->uid field)
uidTokenStringoptionalUser identity credential
verifyTypeNumberoptionalVerify session_keys->type, default to 1 if empty
verifyFskeyStringoptionalDedicated for type 3, verify associated plugin

verifyAccessToken

php
\FresnsCmdWord::plugin('Fresns')->verifyAccessToken($wordBody);
Parameter NameTypeRequiredDescription
accessTokenStringrequiredReference: Make Access Token
accountLoginBooleanoptionalWhether a login is required, if left empty, no login is required
userLoginBooleanoptionalWhether a user login is required, if left empty, no login is required
Return Example
json
{
    "code": 0,
    "message": "ok",
    "data": {
        "appId": "qe12345",
        "platformId": 4,
        "version": "2.0.0",
        "deviceInfo": "",
        "langTag": "zh-Hans",
        "timezone": "+8",
        "contentFormat": "",
        "aid": "6a3bb3bc",
        "aidToken": "uoX1hk6SHUgB2MFGJwNx38dem9DA7Vsz",
        "uid": 782622,
        "uidToken": "PqBpwPLJgfd1sH0X5JffYFGxTSc8RW7c",
        "signature": "d5db4371a0c2d7e17009dea8d53ecf15a7ec07b9",
        "timestamp": 1626426833
    }
}

ipInfo

php
\FresnsCmdWord::plugin('Fresns')->ipInfo($wordBody);
Parameter NameTypeRequiredDescription
ipv4StringrequiredIPv4 and IPv6 support

createSessionLog

php
\FresnsCmdWord::plugin('Fresns')->createSessionLog($wordBody);
Parameter NameTypeRequiredDescription
typeNumberrequiredLog Type
appIdStringoptionalKey App ID
platformIdNumberrequiredPlatform ID (Key value of the platforms key name in the configuration table)
versionStringrequiredSemantic version number, e.g., 2.0.0
langTagStringoptionalLanguage Tag
fskeyStringoptionalPlugin Fskey
actionNameStringrequiredFunction model name or interface path
For example, model name App\Models\Post
For example, interface path: /api/fresns/v1/account/auth-token
actionDescStringrequiredAction description, custom input content
actionStateNumberrequired1. Unknown or in progress / 2. Success / 3. Failure
actionIdStringoptionalFor example, if it is a publishing action, it represents the ID of the published content
Plugin behavior, this ID can query the corresponding plugin-side related information
aidStringoptionalAccount ID
uidNumberoptionalUser ID
deviceInfoObjectoptionalInteraction device information
deviceTokenStringoptionalInteraction device Token
For example, iOS Device Token or Android Device Token
Can be used for push notifications
loginTokenStringoptionalLogin Token
moreInfoObjectoptionalOther custom information

checkLoginToken

php
\FresnsCmdWord::plugin('Fresns')->checkLoginToken($wordBody);
Parameter NameTypeRequiredDescription
appIdStringrequiredApp ID
platformIdNumberrequiredPlatform ID (Key value of the platforms key name in the configuration table)
versionStringrequiredSemantic version number
loginTokenStringrequiredLogin Token
  • The login token is created by the createSessionLog command.

updateLoginToken

php
\FresnsCmdWord::plugin('Fresns')->updateLoginToken($wordBody);
Parameter NameTypeRequiredDescription
loginTokenStringrequiredLogin Token
uidNumberrequiredUser ID
pinStringoptionalUser PIN
Personal Identification Number
  • If the result status of the checkLoginToken command is 31604 or 31508, use
    • 31604 Users must enter a PIN
    • 31508 There are multiple users under account, you need to select one.
  • If you do not use this command word to update the token information, the token will not be effective.

sendCode

php
\FresnsCmdWord::plugin('Fresns')->sendCode($wordBody);
Parameter NameTypeRequiredDescription
typeNumberrequiredType: 1. Email verification code / 2. SMS verification code
templateIdNumberrequiredCode Template ID
langTagStringoptionalLanguage tag, empty to use the default language tag
accountStringrequiredAccount (email or pure phone number)
countryCallingCodeNumberoptionalInternational area code (phone number specific)

checkCode

php
\FresnsCmdWord::plugin('Fresns')->checkCode($wordBody);
Parameter NameTypeRequiredDescription
typeNumberrequiredType: 1. Email verification code / 2. SMS verification code
templateIdNumberrequiredCode Template ID
accountStringrequiredAccount (email or pure phone number)
countryCallingCodeNumberoptionalInternational area code (phone number specific)
verifyCodeStringrequiredVerify Code

updateOrCreateCallbackContent

php
\FresnsCmdWord::plugin('Fresns')->updateOrCreateCallbackContent($wordBody);
Parameter NameTypeRequiredDescription
fskeyStringrequiredPlugin Fskey
callbackKeyStringrequiredCallback Key
callbackTypeNumberoptionalReference
callbackContentArrayoptional
retentionDaysNumberoptionaldefault 1

getCallbackContent

php
\FresnsCmdWord::plugin('Fresns')->getCallbackContent($wordBody);
Parameter NameTypeRequiredDescription
fskeyStringrequiredPlugin Fskey
callbackKeyStringrequiredCallback Key
callbackTypeNumberoptionalCallback Type
timeoutNumberoptionalUnit: minutes
Get data in how many minutes
markAsUsedBooleanoptionaldefault false

Released under the Apache-2.0 License