Skip to content

User Object

CoPokBl edited this page Nov 23, 2022 · 1 revision

User Object

The user object is how the API represents a user, it has their information including their email and username.

Example JSON Object

{
   "id":"90e2f0f8-a349-4c49-b5ad-48bb5e622f51",
   "username":"CoPokBl",
   "email":"support@serble.net",
   "verifiedEmail":true,
   "permLevel":2,
   "premiumLevel":10,
   "permString":null,
   "stripeCustomerId":"cus_Jh3p1C2BivdGZC",
   "authorizedApps":[
      {
         "appId":"d009ebce-4e72-4f66-e244-d87117e6077f",
         "scopes":"1000"
      },
      {
         "appId":"7117eca4-9ebc-b7e4-8bcf-651e009eb040",
         "scopes":"0010"
      }
   ]
}

Definitions

ID (string)

This is the user ID, this is how the API identifies all users and how all services should also identify their users.

Username (string)

This field specifies the Username of the user, this is a name selected by them and does not have very many limits so be careful of things like SQL injection.

Email (string)

This is the user's email, they do not have to provide an email and this field will be null if they don't. If you wish to make contact with the user, use this email.

Verified Email (boolean)

Whether or not the user has verified their email, if this is false then there is no way of knowing if the email actually belongs to this user.

Perm Level (int)

Defines the level of access the user has to Serble systems.
0: This means that the account is disabled
1: This means that the account is normal and has no special permissions or restrictions
2: This means that the account is owned by a Serble administrator and they can manage the API

Premium Level (int)

This specifies whether or not the account is subscribed to a Serble subscription.
0: The user is not currently subscribed to a product
10: The user is subscribed to Serble Premium

Perm String (Nullable string)

This is an old field that is no longer used. It is only there for backwards compatibility, it will always be null.

Stripe Customer ID (string)

The user's ID for Stripe. Stripe is the service that Serble uses to manage payments. This ID is used to manage the customer's payments and subscriptions.

Authorized Apps

This is a list of apps that are authorized to access aspects of a user's account.

The App Object

{
   "appId":"d009ebce-4e72-4f66-e244-d87117e6077f",
   "scopes":"1000"
}

appId: The ID of the app that was authorized
scopes: How much access was given to that app
See here for more information on OAuth

Scopes

The scope string is made up of numbers, you can think of it as an array of booleans, each number is either 0 for not allowed or 1 for allowed.

  1. Full Account Access
  2. File Hosting Access
  3. Account Information
  4. Control Of Authorized Appliations (Doesn't work anymore) If you only wanted the app to access account information then you would have the scope as 0010.
    If you wanted the app to have full access to an account then you would do 1111 or just have a 1 at the start.