Skip to content

Instantly share code, notes, and snippets.

@eveporcello
Created September 23, 2022 00:34
Show Gist options
  • Save eveporcello/09109f82d5e4582a80bd8a8036414675 to your computer and use it in GitHub Desktop.
Save eveporcello/09109f82d5e4582a80bd8a8036414675 to your computer and use it in GitHub Desktop.
"""
The current rank of a counselor. Ranks are acheived
by interacting successfully with bad campers.
"""
enum Rank {
"The first level, or starting rank, for a camp counselor"
ALPHA
"The second level acheived as a camp counselor"
BETA
"The highest level of camp counselor or a counselor who is sick of camp and is ready to leave"
RELEASE_CANDIDATE
}
"""
A visual image containing a snapshot of real
life that doesn't quite capture really being in that moment.
"""
type Photo {
"A large full sized image"
full: String
"A smaller thumbnail image for lists"
thumb: String
}
"""
A passionate volunteer who has dedicated their summer
towards making a difference in a camper's life.
Or someone from egghead.io or the GraphQL community.
"""
type Counselor {
"A unique identifier for the counselor"
id: ID!
"The counselor's real full name"
name: String!
"A short bio describing stuff about the counselor"
bio: String
"The rank that this counselor has achieved"
rank: Rank
"A real picture of the counselor"
photo: Photo
"The counselor's real Twitter handle"
twitterHandle: String
"The counselor's real GitHub handle"
githubHandle: String
"The counselor's assigned cabin"
cabin: Cabin
}
"""
A cabin where campers and counselors stay during their
time at Camp Lambda. Cabins are named after animals that
might sneak into the cabin at any time.
"""
type Cabin {
"The name of the animal that sponsors this cabin."
animal: ID!
"A photo of the cabin"
photo: Photo
"A description of the cabin, its history, and its interests."
description: String
"The counselor in charge of law enforcement in this cabin."
counselor: Counselor!
"The campers that stay in this cabin."
campers: [Camper!]!
}
"""
A camp without campers is no camp at all. This type describes the most important part of camp: the `Camper`. Campers come from all over the place to have fun, make friends, and silently wish they were home watching TV.
"""
type Camper {
"A camper will have an email address that is their unique identifier in the system."
email: ID!
"The camper's name."
name: String
"A camper's photo"
photo: String
"The cabin where this person resides."
cabin: Cabin!
}
input CreateCamperInput {
"A `Camper`'s email address."
email: ID!
"A `Camper`'s full name."
name: String!
"A `Camper`'s password"
password: String!
}
type LogInPayload {
"The entire `Camper` object for the recently logged in individual."
camper: Camper
"The authorization token that can be used to run queries and mutations that require login."
token: String!
}
"""
The actions that a `Camper` can use to change their details.
"""
type CamperActions {
changeEmail(email: ID!): ChangedCamper!
changeName(name: String!): ChangedCamper!
}
"""
The response that is returned from a `changeAccount` mutation when a `Camper` changes details about themselves.
"""
type ChangedCamper {
camper: Camper
previous: Camper
}
"""
All of the queries available on the Camp Lambda API
"""
type Query {
"The total number of counselors at Camp Lambda."
totalCounselors("Allows for optional filtering by `Rank`" rank: Rank): Int!
"All data about every counselor at Camp Lambda. Allows for optional filtering by `Rank`"
allCounselors(
"Allows for optional filtering by `Rank`"
rank: Rank
): [Counselor!]!
"Finds an individual counselor using their id"
findCounselorById("id argument for filtering" id: ID!): Counselor!
"All data about every cabin at Camp Lambda."
allCabins: [Cabin!]!
"Finds an individual cabin using its animal id"
findCabinByAnimal(animal: ID!): Cabin!
"Returns the GitHub url that campers can use to obtain an authorization code from GitHub"
githubAuthUrl: String!
"Returns the currently logged in `Camper`"
me: Camper
}
"""
All of the queries available on the Camp Lambda API
"""
type Mutation {
"The mutation to create a camper at Camp Lambda."
createCamper(
"REQUIRED: Send `email`, `name`, and `password` as arguments"
input: CreateCamperInput!
): Camper!
"Logs in a `Camper`"
logIn(email: String!, password: String!): LogInPayload!
"Authorizes a Camper with GitHub"
githubAuth(code: String!): LogInPayload!
"The mutation that allows an authorized camper to change details about themselves like `email` and `name`"
changeAccount: CamperActions!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment