# Cookbook

Let's get started with a few common examples.

# Creating a Room

Let's start by creating a room!

In this example, we will use the createRoom mutation operation. You can find the whole list of mutation operations here (opens new window). The createRoom mutation operation takes in an input argument that follows the schema here (opens new window).

  • Request Parameters:
    • name*: Name of the room
    • description*: Description of the room
    • exitRoomLink: The URL that the user will be redirected to when they click on the exit room button.

* indicates a required field.

createRoom.graphql
mutation createRoom(
  $name: String!,
  $description: String!,
  $exitRoomLink: String
) {
  createRoom(data: {
    name: $name,
    description: $description,
    exitRoomLink: $exitRoomLink
  }) {
    id # Room ID
    name # Room name
  }
}

# Sending a Room Invitation

Now that we have set up our rooms, we can start to send out invitations to users via email. To do so, we will use the sendInvitation mutation operation, which takes in an input argument that follows the schema here (opens new window).

You can read more about how to do this in our step-by-step guide

sendInvitation.graphql
mutation sendInvitation(
  $locale: Locale!,
  $contactInfo: String!,
  $contactType: ContactType!,
  $contactFullName: String!,
  $organizationMemberRoleId: String!,
  $roomId: ID!
) {
  sendInvitation(data: {
    locale: $locale,
    contactInfo: $contactInfo,
    contactType: $contactType,
    contactFullName: $contactFullName,
    organizationMemberRoleId: $organizationMemberRoleId,
    roomId: $roomId 
  }) {
    id
    contactType
    contactFullName
  }
}

# Viewing organisation members

To view the organisation members in your organisation, we can fetch the members object under the Viewer object for query type operations. In this example, we can name the operation as retrieveOrganisationMembers. The input arguments for the query follows the schema here (opens new window). Afterwards, we can choose the fields to be returned via this schema (opens new window).

  • Request Parameters:
    • where: Specifies conditional input arguments to the query
    • orderBy: Specifies the sort order for the returned organisation members
    • skip: Specifies the initial number of organisation member records to skip over
    • after: A cursor reference (opens new window) to indicate at which position should the first record be returned. This is helpful for paginating queries.
    • before: Similar to after, this takes in a cursor string to indicate at which position should the last record be returned.
    • first: Grabs the first n organisation members
    • last: Grabs the last n organisation members

* indicates a required field.

organisationMembers.graphql
query retrieveOrganisationMembers($first: first, $orderBy: orderBy) {
  viewer {
    members { # Organisation members
      edges {
        node {
          displayName
          role { # Organisation member role
            name
          }
        }
      }
    }
  }
}

# Retrieving Billing information

Now that we have set up our rooms, let's see how we can retrieve billing records for our organisation. We will create a query operation called retrieveBilling. The input arguments for the query follows the schema here (opens new window). We can then specify the fields to be returned by referencing this schema (opens new window).

  • Request Parameters:
    • year*: The year of the billing record
    • month*: The month of the billing record

* indicates a required field.

billing.graphql
query retrieveBillng($year: year, $month: month) {
  viewer {
    billing(input: { year: $year, month: $month }) {
      id # Billing ID
      records { # Billing records
        date
        usages { # Billing record usages
          paidSec
          amount
        }
      }
    }
  }
}

# Providing a one-click access to the Room

We are almost done with setting up the integrations! For the last step, let's provide a one-click access between your application and ClassDo's virtual room.

ClassDo's API offers a seamless transition from your application and ClassDo's virtual room and vice-versa. It requires just 2 simple steps to link your application to ClassDo's virtual room:

  1. Create a room and specify the exitRoomLink.
  2. Add a link to your application that directs your users to https://app.classdo.com/classroom/<ROOM_ID>. ROOM_ID can be obtained from the id returned from the room mutation operation. This link allows users to enter the virtual room. Before doing so, they will also be able to test their devices.

That's not all! For a complete list of functionalities offerred by the API, please read the schema (opens new window).