Types
The most basic components of a GraphQL schema are object types, which just represent a kind of object you can fetch from our service, and what fields it has.
Every GraphQL service defines a set of types which completely describe the set of possible data you can query on that service. This page describes the types defined by the Guuru API.
Partner
Represents information about the partner to which the authentication token you are using corresponds to.
type Partner {
id: ID!
state: PartnerState
payouts: Payouts!
chats(
first: Int!
after: String
orderBy: ChatOrder
startDate: Timestamp
endDate: Timestamp
): ChatConnection!
experts(
first: Int!
after: String
orderBy: ExpertOrder
): ExpertConnection!
submissions(
filters: [SubmissionFilterType],
orderBy: SubmissionOrder,
first: Int,
after: String
): SubmissionsConnection!
}
type ChatOrder {
direction: OrderDirection!
field: ChatOrderField!
}
enum OrderDirection {
asc
desc
}
enum ChatOrderField {
id
}
type ChatConnection {
edges: [ChatEdge!]!
pageInfo: PageInfo!
}
type ChatEdge {
cursor: String!
node: Chat!
}
type Payouts {
experts(
first: Int!
after: String
period: Timestamp!
): ExpertConnection!
}
type ExpertConnection {
edges: [ExpertEdge!]!
pageInfo: PageInfo!
}
type ExpertEdge {
cursor: String!
node: Expert!
}
type PageInfo {
hasNextPage: Boolean!
endCursor: String
}
PartnerState
Represents the current runtime state of a Partner, which is a function of the configured settings and the current system state (e.g. number of experts online).
While settings are relatively static and only change when reconfigured by a Partner, the state is dynamic and depends on parameters that may change at any minute, like the number of experts available.
type PartnerState {
chat: PartnerStateChat
}
type PartnerStateChat {
isAvailable: Boolean!
}
- isAvailable: When
true
, the chat window should be shown and new chats can be created by end users. Otherwise, the chat window should not be displayed and new chats cannot be created.
Submission
Represents the submissions requests from experts to join the partner community.
type Submission implements Node {
id: ID!
createdAt: Timestamp
reviewedAt: Timestamp
verificationCode: String
expert: Expert
status: SubmissionStatus
}
enum SubmissionStatus {
pending
approved
rejected
}
Chat
Represents a conversation initiated by an end-user, and possibily answered by an expert.
The type
Timestamp
is represented by a positive integer which counts the number of milliseconds since the Unix Epoch (i.e. January 1, 1970).
The JSON
posting
accepts the following fields:
- type: String!
- text: String
- mimetype: String
- address: String
- filename: String
type Chat {
id: ID!
createdAt: Timestamp
acceptedAt: Timestamp
closedAt: Timestamp
ratedAt: Timestamp
isAssignedToAgent: Boolean
question: String
rating: Rating
status: ChatStatus
language: Language
expert: Expert
user: User
transfer: Transfer
category: Category
messages(
first: Int!
after: String
): MessageConnection!
}
enum Rating {
good
average
bad
}
enum ChatStatus {
created
assigned
open
closed
rated
handover
missed
}
input ChatMessageInput {
chatId: ID!
posting: JSON
}
type MessageConnection {
edges: [MessageEdge!]!
pageInfo: PageInfo!
}
type MessageEdge {
cursor: String!
node: Message!
}
type PageInfo {
hasNextPage: Boolean!
endCursor: String
}
Message
Represents a message in a chat.
The field
hideForUser
istrue
when the message is not intended to be displayed to the user (customer) asking the question. Conversely the fieldhideForExpert
istrue
when the message is not intended to be displayed to the expert answering the question.
interface Message {
hideForUser: Boolean!
hideForExpert: Boolean!
createdAt: Timestamp!
author: Author!
}
type AttachmentMessage implements Message {
attachment: Attachment!
hideForUser: Boolean!
hideForExpert: Boolean!
createdAt: Timestamp!
author: Author!
}
type Attachment {
mimetype: String
url: String
}
type TextMessage implements Message {
text: String
hideForUser: Boolean!
hideForExpert: Boolean!
createdAt: Timestamp!
author: Author!
}
union Author = ExpertAuthor | UserAuthor | BotAuthor
type ExpertAuthor {
name: String
email: String
photoUrl: String
}
type UserAuthor {
name: String
email: String
phone: String
}
type BotAuthor {
name: String
photoUrl: String
}
Category
Represents the category of the chat.
type Category {
id: ID!
name: String
}
Transfer
Represents the entity who received the chat when the expert transfered it.
type Transfer {
id: ID!
createdAt: Timestamp!
notificationSentAt: Timestamp
confirmedAt: Timestamp
reason: String
receiver: String
type: String
}
Expert
Represents an user answering to questions on behalf of a Partner. It can either be a guuru (an expert customer helping other customers) or an agent (a company representative on a partner payroll).
type Expert {
id: ID!
name: String
email: String
summary: String
balance: [Balance!]!
}
type Balance {
amount: Int!
currency: Currency!
}
Community
Represents a group of Guurus (an expert customer helping other customers) that are in a specific Partner.
Here's a practical example of what you can do with this: Guuru Community Page.
type Community implements Node @cacheControl(maxAge: 300){
id: ID!
experts(first: Int, after: String): CommunityExpertConnection! @cacheControl(maxAge: 300)
expert(expertId: ID!, partnerId: ID!): CommunityExpert @cacheControl(maxAge: 300)
}
type CommunityExpertEdge {
cursor: String!
node: CommunityExpert! @cacheControl(maxAge: 3600)
}
type CommunityExpertConnection {
edges: [CommunityExpertEdge!]! @cacheControl(maxAge: 3600)
pageInfo: PageInfo!
}
Community Expert
Represents a Guuru in a Community.
type CommunityExpert implements Node {
id: ID!
name: String!
photoUrl: String
bio: String
rating: Float
joinedAt: Timestamp
bestFeedbackComments: [FeedbackComment]! @cacheControl(maxAge: 3600)
}
type FeedbackComment {
comment: String
}
User
Represents an end-user asking questions.
type User {
id: ID!
name: String
email: String
phone: String
ipAddress: String
}