LogoLogo
  • Platform Overview
  • 🗺️Guides
    • Getting Started
    • Users
      • Integrate the User SDK
      • Registration
      • Authentication
      • SDK Releases
      • API Reference
    • Entitlements
      • Administrative API
        • Integrating the Administrative API
        • Entitlement Definitions
        • Managing Entitlements Sets
        • Managing Entitlements Sequences
        • Managing User Entitlements
        • API Schema
      • End-user API
        • Integrate the Entitlements SDK
        • Redeeming Entitlements
        • Retrieving Entitlements
        • SDK Releases
        • API Reference
    • Sudos
      • Integrate the Sudo Profiles SDK
      • Sudo Entitlements
      • Manage Sudos
      • SDK Releases
      • API Reference
    • Telephony
      • Integrate the Telephony SDK
      • Manage Phone Numbers
      • Text Messaging
      • Voice Calling
      • Telephony Simulator
      • SDK Releases
      • API Reference
    • Email
      • Integrate the Email SDK
      • Email Entitlements
      • Manage Email Addresses
      • Sending & Receiving Email
      • Manage Email Folders
      • Draft Email Messages
      • Manage Email Address Blocklists
      • Email Address Public Information
      • Pagination
      • Caching
      • Configuration Data
      • Email Notifications
      • SDK Releases
      • API Reference
    • Decentralized Identity
      • Edge Agent
        • Relay SDK
          • Integrate the Relay SDK
          • Relay Entitlements
          • Manage Relay Postboxes
          • Manage Relay Messages
          • Receiving Messages
          • SDK Releases
        • Edge Agent SDK
          • Integrate the Edge Agent SDK
          • Agent Management
          • Manage Wallets
          • Establishing Connections
          • Manage Connections
          • Messaging
          • Manage DIDs
          • Accepting New Credentials
          • Manage Credentials
          • Present Credentials for Verification
          • Utilize Alternative Cryptography Providers
          • SDK Releases
          • Standards and Protocols
      • Cloud Agent
        • Cloud Agent Admin API
          • Integrate the Cloud Agent Admin API
          • Aries Interop Profile (AIP)
            • Connection Exchanges
            • Credential Exchanges
            • Proof Exchanges
          • Connections
          • Basic Messages
          • Credentials
            • Anoncreds Credentials
              • Schemas
              • Credential Definitions
            • W3C Credentials
          • Audit Logs
          • API Schema
          • Error Codes
          • Standards and Protocols
    • Virtual Cards
      • Integrate the Virtual Cards SDK
      • Virtual Cards Entitlements
      • Virtual Cards Transaction Velocity Constraints
      • Key Management
      • Manage Funding Sources
      • Manage Virtual Cards
      • Manage Transactions
      • Configuration Data
      • Pagination
      • Caching
      • SDK Releases
      • API Reference
    • Virtual Cards Simulator
      • Integrate the Virtual Cards Simulator SDK
      • Simulate Authorizations
      • Simulate Debits
      • Simulate Refunds
      • Simulate Reversals
      • Merchants and Currencies
      • SDK Releases
      • API Reference
    • Virtual Private Network
      • Integrate the VPN SDK
      • VPN Entitlements
      • Manage Servers
      • Manage Connection
      • Observe VPN Related Events
      • SDK Releases
      • API Reference
      • Frequently Asked Questions
    • Secure ID Verification
      • Integrate the Secure ID Verification SDK
      • List Supported Countries
      • Verify an Identity
      • Check Secure ID Verification Status
      • Use the Secure ID Verification Simulator
      • SDK Releases
      • API Reference
    • Password Manager
      • Integrate the Password Manager SDK
      • Accessing the Password Manager
      • Managing Password Vaults
      • Managing Password Vault Items
      • Vault Import and Export
      • Password Utilities
      • Password Manager Entitlements
      • Password Vault Security
      • SDK Releases
      • API Reference
    • Ad/Tracker Blocker
      • Integrate the Ad/Tracker Blocker SDK
      • Manage Rulesets
      • Blocking Ads and Trackers
      • Manage Exceptions
      • SDK Releases
      • API Reference
    • Site Reputation
      • Integrate the Site Reputation SDK
      • Use the Site Reputation SDK
      • SDK Releases
      • API Reference
  • 💡Concepts
    • Sudo Digital Identities
  • 🧱Development
    • Versioning
  • 🏢Administration
    • Admin Console Roles
  • ❓Get Help
    • Request a Demo
    • Report an Issue
Powered by GitBook
On this page
  • Common Entitlements Sets Types
  • Add a New Entitlements Set
  • Possible Errors
  • Get an Entitlements Set
  • Possible Errors
  • List all Entitlements Sets
  • Possible Errors
  • Update an Existing Entitlements Set
  • Possible Errors
  • Remove an Entitlements Set
  • Possible Errors
  1. Guides
  2. Entitlements
  3. Administrative API

Managing Entitlements Sets

Administrative APIs for managing entitlements sets

The standard create, read, update and delete management operations are performed by calling the addEntitlementsSet, getEntitlementsSet or listEntitlementsSets, setEntitlementsSet, and removeEntitlementsSet APIs respectively.

Common Entitlements Sets Types

# An entitlement
type Entitlement {
  # Name of the entitlement
  name: String!

  # Optional description of the entitlement
  description: String

  # Value of the entitlement. Type Float to allow for values
  # values larger than possible with Int. Value is a
  # positive integer.
  value: Float!
}

# A set of entitlements
type EntitlementsSet {
  # Time of initial creation of an entitlements set in milliseconds
  # since epoch. Number is integral, float type provides sufficient
  # precision.
  createdAtEpochMs: Float!

  # Time of most recent update of an entitlements set in milliseconds
  # since epoch. Number is integral, float type provides sufficient
  # precision.
  updatedAtEpochMs: Float!

  # Version of the entitlements set. Incremented each time an update is made.
  version: Int!

  # Name of the entitlements set.
  name: String!

  # Optional description of the entitlements set.
  description: String

  # Entitlements conferred by this entitlements set.
  entitlements: [Entitlement!]!
}

Add a New Entitlements Set

A new entitlements set can be added to the system by calling the addEntitlementsSet mutation.

# Input for the addEntitlementsSet mutation
input AddEntitlementsSetInput {
  name: String!
  description: String
  entitlements: [EntitlementInput!]!
}

type Mutation {
  # Adds an entitlement set
  addEntitlementsSet(
    input: AddEntitlementsSetInput!
  ): EntitlementsSet!
}

Possible Errors

  • InvalidEntitlementsError will be returned if an entitlement name is not a recognized entitlement.

  • ServiceError will be returned for internal errors.

Adding a new entitlements set using SDK.

do {
    let entitlementsSet = try await client.addEntitlementsSetWithName(
        name: "Premium user",
        description: "Entitlements set for premium users",
        entitlements: [Entitlement(name: "sudoplatform.sudo.max", description: "Max. Sudos", value: 3)]
    )
} catch {    
    // Handle error. An error may be thrown if the backend is unable perform
    // the operation due to invalid input, availability or security issues.
}
val entitlementsSet =
    client.addEntitlementsSet(
        "Premium user", 
        "Entitlements set for premium users",
        listOf(
            Entitlement("sudoplatform.sudo.max", "Max. Sudos", 3)
        )
    )
const input = {
  name: 'Premium user',
  description: 'Entitlements for premium users',
  entitlements: [
    {
      name: 'sudoplatform.sudo.max',
      description: 'Max. Sudos',
      value: 3,
    }
  ],
}
const entitlementsSet = await client.addEntitlementsSet(input)

Get an Entitlements Set

Call the getEntitlementsSet query to retrieve an entitlements set by name.

# Input for the getEntitlementsSet query
input GetEntitlementsSetInput {
  name: String!
}

type Query {
  # Gets an entitlement set.
  getEntitlementsSet(
    input: GetEntitlementsSetInput!
  ): EntitlementsSet
}

Possible Errors

  • ServiceError will be returned for internal errors.

Retrieving an entitlements set using SDK.

do {
    let entitlementsSet = try await client.getEntitlementsSetWithName(
        name: "Premium user",
    ) 
} catch let error {
    // Handle error. An error may be thrown if the backend is unable perform
    // the operation due to invalid input, availability or security issues.
}
val entitlementsSet =
    client.getEntitlementsSet(
        "Premium user"
    )
const input = {
  name: 'Premium user',
}
const entitlementsSet = await client.getEntitlementsSet(input)

List all Entitlements Sets

Call the listEntitlementsSet query to list all of the entitlements sets in the system. The results list is paginated with a page size of 10. To retrieve all results your application must implement the following algorithm.

1. Call listEntitlementsSet query with nextToken set to null
2. If nextToken in the returned EntitlementsSetsConnection is null, 
   there are no more results to retrieve
3. Call listEntitlementsSet query with nextToken set to the value
   returned from the previous call
4. Go to step 2
# Pagination connection for use when listing entitlements sets
type EntitlementsSetsConnection {
  items: [EntitlementsSet!]!
  nextToken: String
}

# Input for the listEntitlementsSets query
input ListEntitlementsSetsInput {
  token: String!
}

type Query {
# Retrieves all entitlements sets.
listEntitlementsSets(
  nextToken: String
): EntitlementsSetsConnection!
}

Possible Errors

  • ServiceError will be returned for internal errors.

Listing entitlements sets using SDK.

do {
    let listOutput = try await client.listEntitlementsSetsWithNextToken(
        nextToken: nil
    ) 
} catch {
    // Handle error. An error may be thrown if the backend is unable perform
    // the operation due to invalid input, availability or security issues.
}
val listOutput =
    client.listEntitlementsSets(
        null 
    )
const listOutput = await client.listEntitlementsSets()

Update an Existing Entitlements Set

Call the setEntitlementsSet mutation to update the contents of an existing entitlements set. The updated entitlements set is returned.

# Input representing an entitlement
input EntitlementInput {
  name: String!
  description: String
  value: Int!
}

# Input for the setEntitlementsSet mutation
input SetEntitlementsSetInput {
  name: String!
  description: String
  entitlements: [EntitlementInput!]!
}

type Mutation {
  # Change the entitlements conferred by an entitlements set.
  setEntitlementsSet(input: SetEntitlementsSetInput!): EntitlementsSet!
}

Possible Errors

  • InvalidEntitlementsError will be returned if an entitlement name is not a recognized entitlement.

  • ServiceError will be returned for internal errors.

Updating an entitlements set using SDK.

do {
    let entitlementsSet = try await client.setEntitlementsSetWithName(
        name: "Premium user",
        description: "Entitlements set for premium users",
        entitlements: [Entitlement(name: "sudoplatform.sudo.max", description: "Max. Sudos", value: 5)]
    ) 
} catch {
    // Handle error. An error may be thrown if the backend is unable perform
    // the operation due to invalid input, availability or security issues.
}    
val entitlementsSet =
    client.setEntitlementsSet(
        "Premium user", 
        "Entitlements set for premium users",
        listOf(
            Entitlement("sudoplatform.sudo.max", "Max. Sudos", 5)
        )
    )
const input = {
  name: 'Premium user',
  description: 'Entitlements for premium users',
  entitlements: [
    {
      name: 'sudoplatform.sudo.max',
      description: 'Max. Sudos',
      value: 3,
    }
  ],
}
const entitlementsSet = await client.setEntitlementsSet(input)

Remove an Entitlements Set

Call the removeEntitlementsSet mutation to remove an existing entitlements set by name. The removed entitlements set is returned on success. null is returned if the named entitlements set cannot be found.

# Input for the removeEntitlementsSet mutation
input RemoveEntitlementsSetInput {
  name: String!
}

type Mutation {
  # Remove an entitlements set. Any users configured against this
  # entitlements set will become unentitled.
  removeEntitlementsSet(input: RemoveEntitlementsSetInput!): EntitlementsSet
}

Possible Errors

  • EntitlementsSetInUseError will be returned if any entitlements sequences exist that reference the entitlements set

  • ServiceError will be returned for internal errors.

Removing an entitlements set using SDK.

do {
    let entitlementsSet = try await client.removeEntitlementsSetWithName(
        name: "Premium user"
    )
} catch {
    // Handle error. An error may be thrown if the backend is unable perform
    // the operation due to invalid input, availability or security issues.
} 
val entitlementsSet =
    client.removeEntitlementsSet(
        "Premium user"
    )
const input = {
  name: 'Premium user',
}
const entitlementsSet = await client.removeEntitlementsSet(input)

PreviousEntitlement DefinitionsNextManaging Entitlements Sequences

Last updated 28 days ago

🗺️