From aa145e1c3077caa4c3707824784397fb3440448a Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Wed, 30 Jun 2021 17:00:17 -0400 Subject: [PATCH] Create webqueue2api Package section and Getting Started docs --- .../webqueue2api Package/Getting Started.md | 56 +++++-------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/docs-src/webqueue2api Package/Getting Started.md b/docs-src/webqueue2api Package/Getting Started.md index fb4143f..69c6a0f 100644 --- a/docs-src/webqueue2api Package/Getting Started.md +++ b/docs-src/webqueue2api Package/Getting Started.md @@ -1,63 +1,33 @@ # Getting Started -The webqueue2api Package is the base of the [webqueue2 API](http://127.0.0.1:6061/ECN/webqueue2-api/api/Getting%20Started/). It consists of two primary parts: +The webqueue2api Package provides both a parser to read data from ECN's queue and allow for programatic data access as well as an WSGI application to serve the webqueue2 API. -- **Parser**: allows for the programtic access of data from the ECN queue system. -- **API**: exposes a [WSGI](https://wsgi.readthedocs.io/en/latest/what.html) compliant RESTful API. +The webqueue2api Package has the following structure: + +- `webqueue2api`: Contains global configuration and exports utilities/data classes. + - `parser`: Contains classes for reading data from queue text files and making it available via objects. + - `api`: Contains a WSGI application to host a RESTful API that relies on `parser`. ## Basic Usage -!!! example "Load a single Queue and show its Items." +!!! example "Load a queue and get the number of items in it." ```python import webqueue2api - - bidc_queue = webqueue2api.Queue("bidc") - print(bidc_queue.items) + ce_queue = webqueue2api.Queue("ce") + print( len( ce_queue.items ) ) ``` ```python # Expected Output - [ - "[bidc2] (nvatkar) Re: Un-Domain PC setup," - "[bidc4] (maswabey) Question re. Autodesk Fusion 360 upda...," - "[bidc3] (dgmc) Move a managed PC onto self managed," - "[bidc1] (nvatkar) BIDC iPad purchase and PAL access - m..." - ] + 29 ``` -!!! example "Load a single Item and see when it was last updated." +!!! example "Load an item and get its subject." ```python import webqueue2api - ce_1 = webqueue2api.Item("ce", 1) - print(ce_1.last_modified) - ``` - ```python - # Expected Output - "2021-06-04T11:01:00-0400" - ``` - -!!! example "Load all queues." - ```python - import webqueue2api - - all_queues = webqueue2api.load_queues() - - # Print random Queue name - print(all_queues[2].name) + print( len( ce_1.subject ) ) ``` ```python # Expected Output - "che" - ``` - -!!! example "See configuration settings." - ```python - import webqueue2api - - # All configuration settings. - print(webqueue2api.config.parser.queue_directory) - ``` - ```python - # Expected Output: - "/home/pier/e/queue/Mail" + "Re: Battery Replacement" ``` \ No newline at end of file