Profile

Read the signed-in user's profile and edit the Personal Details form and the profile picture.

All requests go to the gateway and need the authentication headers.

Get User Profile

Query · sso_userProfile

Reads the signed-in user's profile, wallet balances, service discounts, contacts and recovery options. AuthGate runs it once right after sign-in and stores the result in Redux; useRefreshProfile re-runs it with fetchPolicy: "network-only" (for example after a payment changes the balance).

Arguments

NameTypeRequiredDescription
mySabayIDIntNoNot sent by the app; without it the token's user is returned.

Variables

{}

Request

query SsoUserProfile {
  sso_userProfile {
    objectID
    userID
    givenName
    familyName
    dateOfBirth
    gender
    profilePicture
    walletStatus
    wallet {
      balance
      assetCode
    }
    serviceDiscounts {
      discountRate
      validUntil
      serviceCode
    }
    hasSecurityPassword
    gamertag
    status
    contacts {
      email
      phoneNumber1
      phoneNumber2
      phoneVerified
      emailVerified
    }
    recoveryOptions {
      name
      status
    }
  }
}

Response

Generated from the schema; values show field types.

{
  "data": {
    "sso_userProfile": {
      "objectID": "String!",
      "userID": "Int!",
      "givenName": "String!",
      "familyName": "String!",
      "dateOfBirth": "Int!",
      "gender": "String!",
      "profilePicture": "String!",
      "walletStatus": "Int",
      "wallet": [
        { "balance": "Float!", "assetCode": "String!" }
      ],
      "serviceDiscounts": [
        { "discountRate": "Float!", "validUntil": "Int", "serviceCode": "String!" }
      ],
      "hasSecurityPassword": "Boolean!",
      "gamertag": "String",
      "status": "Int!",
      "contacts": {
        "email": "String!",
        "phoneNumber1": "String!",
        "phoneNumber2": "String!",
        "phoneVerified": "Int",
        "emailVerified": "Int"
      },
      "recoveryOptions": [
        { "name": "String!", "status": "Boolean!" }
      ]
    }
  }
}

Update User Profile

Mutation · sso_updateUserProfile

Saves the Personal Details form (profile-tab.tsx).

Arguments

NameTypeRequiredDescription
inputsso_UpdateFieldProfile!YesThe fields to change

input

All fields are optional in the schema; the UI sends the first five.

FieldTypeRequiredDescription
givenNameStringNoRequired by the form.
familyNameStringNo
dateOfBirthIntNoUnix timestamp in seconds; the form converts its yyyy-MM-dd date with formatDateToUnix.
gendersso_ProfileGenderNomale | female
gamerTagStringNoLabelled Company/Organization in the UI and required by the form.
languagePreferenceStringNoNot sent by the UI.
profilePictureStringNoNot sent by the UI.
statusIntNoNot sent by the UI.
nationalIDStringNoNot sent by the UI.
phoneStringNoNot sent by the UI.
emailStringNoNot sent by the UI.
secondaryPhoneStringNoNot sent by the UI.
facebookStringNoNot sent by the UI.
SCDisplayCurrencysso_SCDisplayCurrencyTypeNoKHR | SC. Not sent by the UI.
typeIntNoNot sent by the UI.

Variables

{
  "input": {
    "givenName": "Sokha",
    "familyName": "Chan",
    "dateOfBirth": 631152000,
    "gender": "male",
    "gamerTag": "My Company"
  }
}

Request

mutation Sso_updateUserProfile($input: sso_UpdateFieldProfile!) {
  sso_updateUserProfile(input: $input) {
    userID
    objectID
    givenName
    familyName
    dateOfBirth
    gender
    gamertag
  }
}

Response

Generated from the schema; values show field types.

{
  "data": {
    "sso_updateUserProfile": {
      "userID": "Int!",
      "objectID": "String!",
      "givenName": "String!",
      "familyName": "String!",
      "dateOfBirth": "Int!",
      "gender": "String!",
      "gamertag": "String"
    }
  }
}

Update Profile Picture

Mutation · sso_updateUserProfilePicture

Points the profile at an image URL. It is sent to the gateway (the hook sets no media clientName).

Arguments

NameTypeRequiredDescription
profilePictureString!YesURL of the image.

Variables

{
  "profilePicture": "https://<media-host>/<path>/profile-<userID>.png"
}

Request

mutation uploadProfiePicture($profilePicture: String!) {
  sso_updateUserProfilePicture(profilePicture: $profilePicture)
}

Response

Generated from the schema; values show field types.

{
  "data": {
    "sso_updateUserProfilePicture": "String!"
  }
}