diff --git a/client/api-docs/frequency-list.html b/client/api-docs/frequency-list.html index ad34759a..3f1c8835 100644 --- a/client/api-docs/frequency-list.html +++ b/client/api-docs/frequency-list.html @@ -139,14 +139,29 @@

Parameters

+

+ At least one of subcategory and alternateSubcategory must be specified; otherwise, an empty + array is returned. +

diff --git a/client/api-docs/query.html b/client/api-docs/query.html index be34cdba..05bdce56 100644 --- a/client/api-docs/query.html +++ b/client/api-docs/query.html @@ -186,6 +186,15 @@

Parameters

+
  • +
    + caseSensitive: boolean + default: false +
    +
    + Whether or not the search is case-sensitive. +
    +
  • exactPhrase: boolean @@ -261,10 +270,9 @@

    Parameters

    The categories to search for.
    • To pass multiple categories, separate values by a comma.
    • -
    • If undefined then all categories are allowed.
    • +
    • If undefined then all categories are allowed / match this field.
    • Can also be a string if there is only 1 category.
    • -
    • Take special care to ensure that the first letter of each word of the category is - capitalized.
    • +
    • Take special care to ensure that the first letter of each word of each category is capitalized.
  • @@ -274,20 +282,47 @@

    Parameters

    default: undefined
    - The subcategories to search for. + The subcategories to search for. All of the bullet points above apply here, plus:
      -
    • To pass multiple subcategories, separate values by a comma.
    • -
    • If undefined then all subcategories are allowed.
    • -
    • Can also be a string if there is only 1 subcategory.
    • -
    • Take special care to ensure that the first letter of each word of the subcategory is - capitalized.
    • -
    • This API endpoint does not check for consistency between categories and - subcategories.
    • -
    • For example, requesting the "History" and the "Biology" +
    • + This endpoint returns all questions that match both the categories AND + subcategories field. +
    • +
    • This API endpoint does not check for consistency between categories and subcategories.
    • +
    • For example, requesting the "History" category and the "Biology" and "Chemistry" subcategories will return no questions.
    +
  • +
    + alternateSubcategories: string | string[] + default: undefined +
    +
    + The alternate subcategories to search for. All of the bullet points above apply here, plus: +
      +
    • + This endpoint returns all questions that match the categories AND + subcategories AND alternateSubcategories fields. +
    • +
    • + This endpoint does not check for consistency between categories and subcategories and alternate + subcategories. +
    • +
    • + Categories or subcategories that do not have corresponding alternate subcategories can never be + excluded by specifying values for alternateSubcategories. +
    • +
    • + For example, requesting the "Science" category and the "Biology" + and "Other Science" subcategories and the "Math" alternate subcategory + will return questions in both Biology and Math, since Biology questions don't have alternate + subcategories. +
    • +
    +
    +
  • maxReturnLength: number diff --git a/client/api-docs/random-bonus.html b/client/api-docs/random-bonus.html index a1222204..a00a8d3d 100644 --- a/client/api-docs/random-bonus.html +++ b/client/api-docs/random-bonus.html @@ -155,38 +155,66 @@

    Parameters

  • - categories: string[] | string + categories: string | string[] default: undefined
    The categories to search for.
      -
    • If undefined then all categories are allowed.
    • +
    • To pass multiple categories, separate values by a comma.
    • +
    • If undefined then all categories are allowed / match this field.
    • Can also be a string if there is only 1 category.
    • -
    • Take special care to ensure that the first letter of each word of the category is - capitalized.
    • +
    • Take special care to ensure that the first letter of each word of each category is capitalized.
  • - subcategories: string[] | string + subcategories: string | string[] default: undefined
    - The subcategories to search for. + The subcategories to search for. All of the bullet points above apply here, plus:
      -
    • If undefined then all subcategories are allowed.
    • -
    • Can also be a string if there is only 1 subcategory.
    • -
    • Take special care to ensure that the first letter of each word of the subcategory is - capitalized.
    • -
    • This API endpoint does not check for consistency between categories and - subcategories.
    • -
    • For example, requesting the "History" and the "Biology" +
    • + This endpoint returns all questions that match both the categories AND + subcategories field. +
    • +
    • This API endpoint does not check for consistency between categories and subcategories.
    • +
    • For example, requesting the "History" category and the "Biology" and "Chemistry" subcategories will return no questions.
  • +
  • +
    + alternateSubcategories: string | string[] + default: undefined +
    +
    + The alternate subcategories to search for. All of the bullet points above apply here, plus: +
      +
    • + This endpoint returns all questions that match the categories AND + subcategories AND alternateSubcategories fields. +
    • +
    • + This endpoint does not check for consistency between categories and subcategories and alternate + subcategories. +
    • +
    • + Categories or subcategories that do not have corresponding alternate subcategories can never be + excluded by specifying values for alternateSubcategories. +
    • +
    • + For example, requesting the "Science" category and the "Biology" + and "Other Science" subcategories and the "Math" alternate subcategory + will return questions in both Biology and Math, since Biology questions don't have alternate + subcategories. +
    • +
    +
    +
  • number: number diff --git a/client/api-docs/random-tossup.html b/client/api-docs/random-tossup.html index 88476588..cb3da189 100644 --- a/client/api-docs/random-tossup.html +++ b/client/api-docs/random-tossup.html @@ -155,38 +155,66 @@

    Parameters

  • - categories: string[] | string + categories: string | string[] default: undefined
    The categories to search for.
      -
    • If undefined then all categories are allowed.
    • +
    • To pass multiple categories, separate values by a comma.
    • +
    • If undefined then all categories are allowed / match this field.
    • Can also be a string if there is only 1 category.
    • -
    • Take special care to ensure that the first letter of each word of the category is - capitalized.
    • +
    • Take special care to ensure that the first letter of each word of each category is capitalized.
  • - subcategories: string[] | string + subcategories: string | string[] default: undefined
    - The subcategories to search for. + The subcategories to search for. All of the bullet points above apply here, plus:
      -
    • If undefined then all subcategories are allowed.
    • -
    • Can also be a string if there is only 1 subcategory.
    • -
    • Take special care to ensure that the first letter of each word of the subcategory is - capitalized.
    • -
    • This API endpoint does not check for consistency between categories and - subcategories.
    • -
    • For example, requesting the "History" and the "Biology" +
    • + This endpoint returns all questions that match both the categories AND + subcategories field. +
    • +
    • This API endpoint does not check for consistency between categories and subcategories.
    • +
    • For example, requesting the "History" category and the "Biology" and "Chemistry" subcategories will return no questions.
  • +
  • +
    + alternateSubcategories: string | string[] + default: undefined +
    +
    + The alternate subcategories to search for. All of the bullet points above apply here, plus: +
      +
    • + This endpoint returns all questions that match the categories AND + subcategories AND alternateSubcategories fields. +
    • +
    • + This endpoint does not check for consistency between categories and subcategories and alternate + subcategories. +
    • +
    • + Categories or subcategories that do not have corresponding alternate subcategories can never be + excluded by specifying values for alternateSubcategories. +
    • +
    • + For example, requesting the "Science" category and the "Biology" + and "Other Science" subcategories and the "Math" alternate subcategory + will return questions in both Biology and Math, since Biology questions don't have alternate + subcategories. +
    • +
    +
    +
  • number: number diff --git a/client/api-docs/schemas.html b/client/api-docs/schemas/index.html similarity index 60% rename from client/api-docs/schemas.html rename to client/api-docs/schemas/index.html index 9ab44704..bb102027 100644 --- a/client/api-docs/schemas.html +++ b/client/api-docs/schemas/index.html @@ -139,7 +139,7 @@

    Object Schemas

    Tossup

    - +
    • @@ -151,18 +151,23 @@

      Tossup

      question: string
      -
      The question text.
      +
      The question text, formatted with HTML.
      +
    • +
    • +
      + question_sanitized: string +
      +
      The question text, unformatted.
    • answer: string - optional
      The answerline, formatted with HTML.
    • - answer: string + answer_sanitized: string
      The answerline, unformatted.
    • @@ -184,51 +189,91 @@

      Tossup

      optional
    - The alternate subcategory of the question. - Currently, this only exists on some literature questions, where it is the genre of the work. -
    -
  • -
  • -
    - packet: string -
    -
    The internal ID of the packet the question is from.
    -
  • -
  • -
    - packetName: string + The alternate subcategory of the question. This only exists for the following category: Literature; and for the + following subcategories: Other Science, Other Fine Arts, Social Science.
    -
    The name of the packet the question is from.
  • - set: string + packet: object
    -
    The internal ID of the set the question is from.
    -
  • -
  • -
    - setName: string -
    -
    The name of the set the question is from.
    -
  • -
  • -
    - setYear: number -
    -
    The year the question is from.
    +
    A JavaScript object with the following properties of the packet the tossup is from:
    +
      +
    • +
      + _id: string +
      +
      + The internal ID of the packet. +
      +
    • +
    • +
      + name: string +
      +
      + The name of the packet. +
      +
    • +
    • +
      + number: number +
      +
      + The packet number of the packet. Always a nonnegative integer. +
      +
    • +
  • - packetNumber: number + set: object
    -
    The packet number of the packet the question is from. Always a positive integer.
    +
    A JavaScript object with the following properties of the set the tossup is from:
    +
      +
    • +
      + _id: string +
      +
      + The internal ID of the set. +
      +
    • +
    • +
      + name: string +
      +
      + The name of the set. +
      +
    • +
    • +
      + year: number +
      +
      + The year associated with the set. This always corresponds to the first four characters of the + set name. +
      +
    • +
    • +
      + standard: boolean +
      +
      + Whether or not the set has a "standard" format. This generally means anything that's designed for use + at an academic quizbowl tournament, even if it does not have a full distribution. See the packet + list for a complete list of what sets are considered standard. +
      +
    • +
  • - questionNumber: number + number: number
    -
    The question number of the question in the packet. Always a positive integer.
    +
    The question number of the tossup in the packet. Always a nonnegative integer.
  • @@ -254,7 +299,7 @@

    Tossup

    Bonus

    - +
    • @@ -266,90 +311,144 @@

      Bonus

      leadin: string
      -
      The leadin of the bonus.
      +
      The leadin of the bonus, formatted with HTML.
    • - parts: [string, string, string] + leadin_sanitized: string
      -
      The parts of the bonus.
      +
      The leadin of the bonus, unformatted.
    • - answers: [string, string, string] - optional + parts: string[]
      -
      The answerlines, formatted with HTML.
      +
      The parts of the bonus, formatted with HTML.
    • - answers: [string, string, string] + parts_sanitized: string[]
      -
      The answerlines, unformatted.
      +
      The parts of the bonus, unformatted. This always has length equal to parts.
    • - category: string + answers: string[]
      -
      The category of the question.
      -
    • -
    • - subcategory: string + The answerlines, formatted with HTML. This should have the same length as parts, but a few bonuses + have errors where this is not the case.
      -
      The subcategory of the question.
    • - alternate_subcategory: string - optional -
      -
      - The alternate subcategory of the question. - Currently, this only exists on some literature questions, where it is the genre of the work. + answers_sanitized: string[]
      +
      The answerlines, unformatted. This always has length equal to answers.
    • - packet: string + category: string
      -
      The internal ID of the packet the question is from.
      +
      The category of the question.
    • - packetName: string + subcategory: string
      -
      The name of the packet the question is from.
      +
      The subcategory of the question.
    • - set: string + alternate_subcategory: string + optional
      -
      The internal ID of the set the question is from.
      -
    • -
    • - setName: string + The alternate subcategory of the question. This only exists for the following category: Literature; and for the + following subcategories: Other Science, Other Fine Arts, Social Science.
      -
      The name of the set the question is from.
    • - setYear: number + packet: object
      -
      The year the question is from.
      +
      A JavaScript object with the following properties of the packet the bonus is from:
      +
        +
      • +
        + _id: string +
        +
        + The internal ID of the packet. +
        +
      • +
      • +
        + name: string +
        +
        + The name of the packet. +
        +
      • +
      • +
        + number: number +
        +
        + The packet number of the packet. Always a nonnegative integer. +
        +
      • +
    • - packetNumber: number + set: object
      -
      The packet number of the packet the question is from. Always a positive integer.
      +
      A JavaScript object with the following properties of the set the bonus is from:
      +
        +
      • +
        + _id: string +
        +
        + The internal ID of the set. +
        +
      • +
      • +
        + name: string +
        +
        + The name of the set. +
        +
      • +
      • +
        + year: number +
        +
        + The year associated with the set. This always corresponds to the first four characters of the + set name. +
        +
      • +
      • +
        + standard: boolean +
        +
        + Whether or not the set has a "standard" format. This generally means anything that's designed for use + at an academic quizbowl tournament, even if it does not have a full distribution. See the packet + list for a complete list of what sets are considered standard. +
        +
      • +
    • - questionNumber: number + number: number
      -
      The question number of the question in the packet. Always a positive integer.
      +
      The question number of the bonus in the packet. Always a nonnegative integer.
    • @@ -373,30 +472,9 @@

      Bonus

    - + diff --git a/client/api-docs/schemas/index.js b/client/api-docs/schemas/index.js new file mode 100644 index 00000000..65031ea7 --- /dev/null +++ b/client/api-docs/schemas/index.js @@ -0,0 +1,23 @@ +function getTossupExample () { + fetch('/api/random-tossup') + .then(res => res.json()) + .then(data => data.tossups[0]) + .then(data => { + document.getElementById('tossupExample').innerText = JSON.stringify(data, null, 4); + }); +} + +function getBonusExample () { + fetch('/api/random-bonus') + .then(res => res.json()) + .then(data => data.bonuses[0]) + .then(data => { + document.getElementById('bonusExample').innerText = JSON.stringify(data, null, 4); + }); +} + +getTossupExample(); +getBonusExample(); + +document.getElementById('get-tossup-example').addEventListener('click', getTossupExample); +document.getElementById('get-bonus-example').addEventListener('click', getBonusExample);