-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created documentation for every api command.
* The documentation can be rendered into MAN pages or an HTML website through sphinx. * generate_apiclient_tarbell.sh utility added that creates a tarbell containing api_client.py, all of its dependencies, and rendered man pages that api_client.py automatically adds to its man path when it's told to go into shell mode.
- Loading branch information
John Sullivan
committed
Oct 31, 2012
1 parent
cb34468
commit 306681f
Showing
22 changed files
with
704 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
assignment_info | ||
=============== | ||
|
||
Gets all the properties of an assignment. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: assignment_info(id) | ||
|
||
:param id: The exact id of the assignment. | ||
|
||
Example Usage | ||
------------- | ||
|
||
>>> assignment_info 50907cca55c4481a5027103c | ||
--Logged in as jsull003@ucr.edu-- | ||
Properties of Assignment [id = 50907cca55c4481a5027103c, name = World Domination Domination]: | ||
for_class = 509066e855c448134f67b3e4 | ||
due_cutoff = 2012-12-01 23:59:59 | ||
name = World Domination Domination | ||
due = 2012-12-01 23:59:59 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class_info | ||
========== | ||
|
||
Lists all assignments for a class along with any other class info. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: class_info(for_class) | ||
|
||
:param for_class: A part of the name of the class or the class's id. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Here we will get all assignments for the class **CS 10**. | ||
|
||
>>> class_info "CS 10" | ||
--Logged in as jsull003@ucr.edu-- | ||
Class [id = 509066e855c448134f67b3e4, name = CS 10] has assignments: | ||
Assignment [id = 50907cca55c4481a5027103c, name = World Domination Domination] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
create_assignment | ||
================= | ||
|
||
Creates an assignment. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: create_assignment(name[, due, for_class, due_cutoff = ""]) | ||
|
||
:param name: The name of the assignment. | ||
|
||
:param due: The due date of the assignmet, ex: "10/20/2012 10:09:00". | ||
|
||
:param for_class: The class the assignment is fors. | ||
|
||
:param due_cutoff: The cutoff date of the assignment (same format as due). | ||
After the cutoff date, students won't even be able to | ||
submit at all. | ||
|
||
:raises RuntimeError: If you are not a teacher of for_class and not an | ||
admin. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Here we will create an assignment named **World Domination** due on | ||
**October 31, 2012 at 10:09 AM** for the class **CS 9000**. | ||
|
||
>>> create_assignment "World Domination" "10/31/2012 10:09:00" CS\ 9000 | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! Assignment [id = 50907cca55c4481a5027103c, name = World Domination] created. | ||
|
||
If we want students to not be able to submit at all after midnight of October | ||
31, we could instead do this. | ||
|
||
>>> create_assignment "World Domination" "10/31/2012 10:09:00" CS\ 9000 "10/31/2012 23:59:00" | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! Assignment [id = 50907db055c4481a5027103d, name = World Domination] created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
create_class | ||
============ | ||
|
||
Creates a class with the given name. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: create_class(name) | ||
|
||
:param name: The name of the class to create. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Here we will create a class **CS 9001**. | ||
|
||
>>> create_class CS\ 9001 | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! Class [id = 5090729955c448184a8ffabd, name = CS 9001] created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
create_user | ||
=========== | ||
|
||
Creates a user with the given credentials. Be very careful executing this | ||
API as the password may be momentarilly visible in a ps listing. Ensure you | ||
are in a secure terminal. | ||
|
||
Also, if the Galah webserver is not set up to use HTTPS, you should take | ||
effort to make sure you're on the same network as Galah, because **the | ||
password will be sent as plaintext**. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: create_user(email, password[, account_type = "student"]) | ||
|
||
:param email: The email the user will use to sign in. | ||
|
||
:param password: The users password, it will be immediately hashed. | ||
|
||
:param account_type: The account type. Current available options are | ||
student, teacher, or admin. Multiple account types are | ||
not legal. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Creating a student named **test@school.edu** with the password | ||
**gReatPassWord**. | ||
|
||
>>> create_user test@school.edu gReatPassWord | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! User [email = test@school.edu, account_type = student] created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
delete_assignment | ||
================= | ||
|
||
Deletes the given assignment. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: delete_assignment(id) | ||
|
||
:param id: The exact id of the user to delete. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Here we delete the assignment **World Domination Domination**. | ||
|
||
>>> delete_assignment 50907cca55c4481a5027103c | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! Assignment [id = 50907cca55c4481a5027103c, name = World Domination Domination] deleted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
delete_class | ||
============ | ||
|
||
Deletes a given class and all of its assignments. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: delete_class(to_delete) | ||
|
||
:param to_delete: The name, partial name, or ID of the class to delete. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Here we will delete the class **CS 9001**. | ||
|
||
>>> delete_class "CS 9001" | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! Class [id = 5090734255c448184a8ffabe, name = CS 9001] deleted, and all of its assignments: | ||
Assignment [id = 509073bf55c448184a8ffabf, name = World Domination] | ||
|
||
If we want to delete a class that shares its name with another, you have to | ||
reference the class by the ID. | ||
|
||
>>> delete_class Boring\ Class | ||
--Logged in as jsull003@ucr.edu-- | ||
An error occurred processing your request: 2 classes match your query of 'Boring Class', however, this API expects 1 class. Refine your query and try again. | ||
Class [id = 5090754855c4481920ca9325, name = Boring Class] | ||
Class [id = 5090769855c448196874a4ed, name = Boring Class] | ||
>>> delete_class 5090754855c4481920ca9325 | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! Class [id = 5090754855c4481920ca9325, name = Boring Class] deleted, and all of its assignments: | ||
(No assignments found) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
delete_user | ||
=========== | ||
|
||
Deletes the given user from existence. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: delete_user(email) | ||
|
||
:param email: The exact email of the user to delete. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Here we delete the user **test@test.edu**. Notice that there is no prompt or | ||
verification step! **So be careful!** | ||
|
||
>>> delete_user test@test.edu | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! User [email = test@test.edu, account_type = student] deleted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
drop_student (unassign_teacher) | ||
=============================== | ||
|
||
Drops a student (or un-enrolls) a student from a given class. May be used on | ||
teachers to un-assign them from classes. | ||
|
||
Both :func:`unassign_teacher` and :func:`drop_student` have the same | ||
functionality and in fact are aliases of eachother. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: drop_student(email, drop_from) | ||
|
||
:param email: The student's email. | ||
|
||
:param drop_from: The ID or name of the class to drop the student from. | ||
|
||
.. function:: unassign_teacher(email, drop_from) | ||
|
||
:param email: The teacher's email. | ||
|
||
:param drop_from: The ID or name of the class to unassign the teacher from. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Here we will unassign **teacher@ucr.edu** from **Woodshop 101**. Note that even | ||
though we are using :func:`unassign_teacher`, the result says "dropped." This is | ||
because :func:`unassign_teacher` just calls :func:`drop_student` behind the | ||
scenes. | ||
|
||
>>> unassign_teacher teacher@ucr.edu Woodshop | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! Dropped User [email = teacher@ucr.edu, account_type = teacher] from Class [id = 5090671655c448134f67b3e5, name = Woodshop 101]. | ||
|
||
For completeness, we will also drop the student **student@ucr.edu** from | ||
woodshop as well. The command is pretty much the same. | ||
|
||
>>> drop_student student@ucr.edu Woodshop | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! Dropped User [email = student@ucr.edu, account_type = student] from Class [id = 5090671655c448134f67b3e5, name = Woodshop 101]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
enroll_student (assign_teacher) | ||
=============================== | ||
|
||
Enrolls a student in a given class. May be used on teachers to assign them to | ||
classes. | ||
|
||
Both :func:`assign_teacher` and :func:`enroll_student` have the same | ||
functionality and in fact are aliases of eachother. | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: enroll_student(email, enroll_in) | ||
|
||
:param email: The student's email. | ||
|
||
:param enroll_in: Part of the name (case-insensitive) or the ID of the | ||
class to enroll the student in. | ||
|
||
.. function:: assign_teacher(email, enroll_in) | ||
|
||
:param email: The teacher's email. | ||
|
||
:param enroll_in: Part of the name (case-insensitive) or the ID of the | ||
class to assign the teacher to. | ||
|
||
Example Usage | ||
------------- | ||
|
||
Here we will assign **teacher@ucr.edu** to **Woodshop 101**. Note that even | ||
though we are using :func:`assign_teacher`, the result says "enrolled." This is | ||
because :func:`assign_teacher` just calls :func:`enroll_student` behind the | ||
scenes. | ||
|
||
>>> assign_teacher teacher@ucr.edu Woodshop | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! User [email = teacher@ucr.edu, account_type = teacher] enrolled in Class [id = 5090671655c448134f67b3e5, name = Woodshop 101]. | ||
|
||
For completeness, we will also enroll the student **student@ucr.edu** in | ||
woodshop as well. The command is pretty much the same. | ||
|
||
>>> enroll_student student@ucr.edu Woodshop | ||
--Logged in as jsull003@ucr.edu-- | ||
Success! User [email = student@ucr.edu, account_type = student] enrolled in Class [id = 5090671655c448134f67b3e5, name = Woodshop 101]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
find_class | ||
========== | ||
|
||
Finds a classes or classes that match the given query and displays | ||
information on them. Instructor will default to the current user, meaning | ||
by default only classes you are teaching will be displayed (this is not the | ||
case for admins). | ||
|
||
Reference | ||
--------- | ||
|
||
.. function:: find_class([name_contains = "", enrollee = ""]) | ||
|
||
:param name_contains: A part of (or the whole) name of the class. Case | ||
insensitive. | ||
|
||
:param enrollee: Someone enrolled in the class. Defaults to the current | ||
user (unless you are an admin). "any" may be specified | ||
to search all classes. | ||
|
||
Example Usage | ||
------------- | ||
|
||
When you call :func:`find_class` without parameters, all classes you are | ||
enrolled in/teaching are listed (unless you are an admin). | ||
|
||
>>> find_class | ||
find_class | ||
--Logged in as teacher@ucr.edu-- | ||
You are teaching 1 class(es) with '' in their name. | ||
Class [id = 5090634855c448134f67b3e3, name = CS 9000] | ||
|
||
If we would like to find all classes, you can specify **any** for enrollee. | ||
|
||
>>> find_class "" any | ||
--Logged in as teacher@ucr.edu-- | ||
Anyone is teaching 3 class(es) with '' in their name. | ||
Class [id = 5090634855c448134f67b3e3, name = CS 9000] | ||
Class [id = 509066e855c448134f67b3e4, name = CS 10] | ||
Class [id = 5090671655c448134f67b3e5, name = Woodshop 101] | ||
|
||
Finally, we can find all CS classes Galah knows about. | ||
|
||
>>> find_class CS any | ||
--Logged in as teacher@ucr.edu-- | ||
Anyone is teaching 2 class(es) with 'CS' in their name. | ||
Class [id = 5090634855c448134f67b3e3, name = CS 9000] | ||
Class [id = 509066e855c448134f67b3e4, name = CS 10] |
Oops, something went wrong.