hackgt-nfc 0.4.2

A portable Rust library for working with HackGT's NFC badges
Documentation
# From https://github.com/HackGT/checkin2/blob/master/api.graphql

schema {
  query: Query
  mutation: Mutation
  subscription: Subscription,
}

# The root mutation type, use it to change things
type Mutation {
  # Check-in or check-out a user by specifying the tag name.  Check-in when checkin is set to true; check-out when checkin is set to false
  check_in(user: ID!, tag: String!, checkin: Boolean!): UserAndTags
  # Add tag to all users
  add_tag(tag: String!, start: String, end: String, warnOnDuplicates: Boolean = false): Tag
}

# The root query type, use to query data
type Query {
  # Get a list of unique tags currently available to set.
  # set only_current to true to only get events that are currently happening based on their start/end times
  tags(only_current: Boolean): [Tag!]!
  # Retrieve user through a user ID or through the token passed to
  # Query. Leave id empty if you'd like to view the currently logged in
  # user.
  user(id: ID!): UserAndTags
  # All the users in the database, useful for polling for new user information.
  # This is paginated, n is the number of results, and pagination_token is the last ID
  # seen from the latest page retrieved, if you want the first page leave this out.
  users(pagination_token: ID, n: Int!, filter: UserFilter): [UserAndTags!]!
  # Search through a user's name and email through regex
  search_user_simple(search: String!, use_regex: Boolean = false, offset: Int!, n: Int!, filter: UserFilter): [UserAndTags!]!
  # All possible application question branches
  application_branches: [String!]!
  # All possible confirmation question branches
  confirmation_branches: [String!]!
  # All possible question branches from all types!
  question_branches: [String!]!
  # All possible question names, or names of question in a branch
  question_names(branch: String): [String!]
  # Counts of checked in users per tag.
  # Only includes tags that have at least one user checked in.
  tag_counts(tags: [String!]): [TagData]!
}

# The root subscription type, all subscribes go through here
type Subscription {
  tag_change: UserAndTags!
}

type UserAndTags {
  # Tags associated with a user
  tags: [TagState!]!
  # Registration info about the user
  user: User!
}

# Information about checkin tags
type Tag {
  # The unique name of the tag (not human label)
  name: String!
  # The start time of the event associated with the tag
  start: String
  # The end time of the event associated with the tag
  end: String
  # Whether to error on a repeated check in/out event for a user and this tag
  warnOnDuplicates: Boolean
}

# Record of checked in / checked out activity
type TagDetail {
  checked_in: Boolean!
  # Date when attendee was checked in or out
  checked_in_date: String!
  # The username of the admin that checked thte attendee in or out
  checked_in_by: String!
  # Whether, at the time this checkin attempt was made, the operation was successful.  If false, the check-in
  # attempt was rejected.  If true or the tag has warnOnDuplicates = true, the check-in request was accepted.
  checkin_success: Boolean!
}

type TagState {
  tag: Tag!
  checked_in: Boolean!
  # If the tag has warnOnDuplicates = false, then this will always return true.  Otherwise, true indicates a valid check-in
  # and false indicates a duplicate check-in event (e.g., trying to check-in a user for a tag they are already checked into).
  checkin_success: Boolean!
  # Date when the attendee was checked in
  checked_in_date: String!
  # The username of the admin that checked the attendee in
  checked_in_by: String!
  # Details object for the most recent successful check in/out
  last_successful_checkin: TagDetail
  # An array of previous checked in / checked out events
  details: [TagDetail]!
}

# NOTE: Type names that forward to registration must match the type names
# in the registration API itself for fragments to work currently.

# Registration info about the user
type User {
  # User ID, valid across the entire system
  id: ID!

  # User's full name
  name: String!
  # User's email
  email: String!
  # If the user's email is a verified email
  email_verified: Boolean!

  # If the user has applied to the event
  applied: Boolean!
  # If the user has been accepted to the event
  accepted: Boolean!
  # If the user has been accepted and notified of his or her acceptance
  accepted_and_notified: Boolean!
  # If the user has submitted a confirmation
  confirmed: Boolean!
  # A users assigned confirmation branch
  confirmationBranch: String

  # A users application phase answers
  # null if user has not filled out this phase
  application: Branch

  # A users confirmation phase answers
  # null if user has not filled out this phase
  confirmation: Branch

  # Get the answer to one of the questions asked of this user.
  # If branch is not given, find this question name in any branch.
  question(name: String!): FormItem

  # Get the answer to multiple questions asked of this user, userful
  # when the set of questions you want to receive is set by the user.
  questions(names: [String!]!): [FormItem!]!

  # What team, if any, is the user a part of?
  team: Team

  # ID used for pagination
  pagination_token: ID!
}

# Filter users by this criterea.
# A value means to filter by that value, no value
# means that filter will be ignored.
input UserFilter {
  # If the user has applied to the event
  applied: Boolean
  # If the user has been accepted to the event
  accepted: Boolean
  # If the user has indicated that he or she is attending
  confirmed: Boolean
  # The type of application a user filled out (e.g. Mentor, Participant)
  application_branch: String
  # The type of confirmation a user filled out (e.g. Needs Reimbursement)
  confirmation_branch: String
}

# A filled out form (application / confirmation form)
type Branch {
  # What type of application did the user fill out (mentor, participant, etc.)
  # when going through the form?
  type: String!
  # A key-value list of questions and answers from the confirmation application
  data: [FormItem!]!
  # Start of application as some RFC's date string
  start_time: String
  # Submit time of application as some RFC's date string
  submit_time: String
}

# Application teams
type Team {
  # ID of the Team
  id: ID!
}

# Entries to various forms (application, confirmation, etc.)
type FormItem {
  # Name of the question / form item
  name: String!
  # Type of form item (textbox, checkbox, phone no.)
  type: String!
  # Value (if just one string)
  value: String
  # Values (if many selections are applicable, like checkbox)
  values: [String]
  # File if type contains a file
  file: File
}

# Uploaded file
type File {
  # The original name of the uploaded file
  original_name: String!
  # The file's encoding
  encoding: String!
  # The file's mimetype
  mimetype: String!
  # The path to the file in S3
  path: String!
  # The size of the file in bytes
  size: Int!
}

# Aggregated count data for a tag
type TagData {
  name: String!
  # Count of checked in users
  count: Int!
}