Skip to content

Commit

Permalink
DIS-34 Updates to APIs to support Local ILL
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnoble73 committed Nov 21, 2024
1 parent dbdc774 commit c9f41b0
Show file tree
Hide file tree
Showing 6 changed files with 332 additions and 69 deletions.
232 changes: 205 additions & 27 deletions code/web/openapi/aspen_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "GPL v2",
"url": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt"
},
"description": "The API provided by Aspen Discovery for use in other applications, mobile apps, etc"
"description": "The API provided by Aspen Discovery for use in other applications, mobile apps, etc."
},
"servers": [
{
Expand Down Expand Up @@ -59,6 +59,42 @@
}
],
"paths": {
"/SystemAPI?method=getLocalIllForm": {
"get": {
"tags": ["SystemAPI"],
"summary": "Get Local ILL Form",
"description": "Returns information needed to display a Local ILL Form to the user.",
"parameters": [
{
"in" : "query",
"name": "formId",
"schema": {
"type": "integer"
},
"description": "The ID of the form to return information about",
"example": "1"
}
],
"responses" : {
"200" : {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LocalIllFormResult"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
}
}
},
"/UserAPI?method=isLoggedIn": {
"get": {
"tags": ["UserAPI"],
Expand Down Expand Up @@ -128,46 +164,188 @@
}
}
}
},
"/UserAPI?method=submitLocalIllRequest": {
"post" : {
"tags": ["UserAPI"],
"summary": "Submit Local ILL Request",
"description": "Submits a Local ILL Request for the user.",
"parameters": [
{
"in" : "query",
"name": "username",
"schema": {
"type": "string"
},
"description": "The username or barcode for the patron",
"example": "23025003575917"
},
{
"in" : "query",
"name": "password",
"schema": {
"type": "string"
},
"description": "The password or pin for the patron",
"example": "7604"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoginResult"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
}
}
}
},
"components": {
"responses": {
"BadRequest": {
"description": "Bad Request - Invalid method or parameters",
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "invalid_method"
}
"responses": {
"BadRequest": {
"description": "Bad Request - Invalid method or parameters",
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "invalid_method"
}
},
"Unauthorized": {
"description": "Unauthorized - Request requires authentication",
"type": "object",
"properties": {
"error": {
}
},
"Unauthorized": {
"description": "Unauthorized - Request requires authentication",
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "unauthorized_access"
}
}
},
"NotFound": {
"description": "The specified resource was not found.",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
},
"schemas": {
"BasicResult": {
"type": "object",
"properties": {
"result" : {
"type": "boolean"
}
}
},
"BasicAPIResult": {
"type": "object",
"properties": {
"result" : {
"success": {
"type": "boolean",
"description": "Whether the user method was successful or not",
"example": "true"
},
"message": {
"type": "string",
"description": "Additional information about why the method failed or information about the success suitable for display to the patron"
},
"title": {
"type": "string",
"example": "unauthorized_access"
"nullable": "true",
"description": "The title of the message for display to the patron"
}
}
},
"NotFound": {
"description": "The specified resource was not found.",
"type": "object",
"properties": {
"error": {
"type": "string"
}
},
"FormFieldResult": {
"type": "object",
"properties": {
"result" : {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "The type of field to display"
},
"property": {
"type": "string",
"description": "The property the field is representing. Should not be shown to the user"
},
"display": {
"type": "string",
"description": "Has values of show or hide to determine if the form should be shown to the user"
},
"label": {
"type": "string",
"description": "The label for the field"
},
"description" : {
"type": "string",
"description": "The description for the field, can be shown as a tooltip or under the field"
},
"required" : {
"type": "boolean",
"description": "Whether the field must be filled out by the patron"
}
}
}
}
},
"schemas": {
"BasicResult": {
"LocalIllFormResult": {
"type": "object",
"properties": {
"result" : {
"type": "boolean"
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the user method was successful or not",
"example": "true"
},
"message": {
"type": "string",
"description": "Additional information about why the method failed"
},
"title": {
"type": "string",
"nullable": "true",
"description": "The title of the form or error message"
},
"buttonLabel": {
"type": "string",
"nullable": "true",
"description": "The label to display for the submit button"
},
"buttonLabelProcessing": {
"type": "string",
"nullable": "true",
"description": "The label to display for the submit button while the request is being processed"
},
"fields": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FormFieldResult"
},
"nullable": "true",
"description": "An array of field information to be displayed"
}
}
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions code/web/release_notes/24.12.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

## Aspen Discovery Updates
// mark - Grove
### API Updates
- Add a new API to retrieve a LocalIllForm Configuration. (DIS-34) (*MDN*)
- Add a new API to submit a Local ILL request. (DIS-34) (*MDN*)

### Indexing Updates
- Add a new format for Tonies based on a publisher (260b, 264b, 710a) containing Boxine and a title (245a) containing Tonie. (*MDN*)
- Add a new format for Yoto based on a publisher (260b, 264b, 710a) containing Yoto and a title (245a) containing Yoto. (*MDN*)
Expand Down
68 changes: 67 additions & 1 deletion code/web/services/API/SystemAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function launch() {
'getBulkTranslations',
'getLanguages',
'getVdxForm',
'getLocalIllForm',
'getSelfCheckSettings',
'getSystemMessages',
'dismissSystemMessage',
Expand Down Expand Up @@ -912,7 +913,8 @@ function getDevelopmentPriorities(): array {
];
}

function getVdxForm() {
/** @noinspection PhpUnused */
function getVdxForm() : array {
$result = [
'success' => false,
'title' => 'Error',
Expand Down Expand Up @@ -994,6 +996,70 @@ function getVdxForm() {
return $result;
}

/** @noinspection PhpUnused */
function getLocalIllForm(): array {
$result = [
'success' => false,
'title' => 'Error',
'message' => 'Unable to load VDX form',
];

require_once ROOT_DIR . '/sys/InterlibraryLoan/LocalIllForm.php';

if (isset($_REQUEST['formId'])) {
$formId = $_REQUEST['formId'];
} else {
return [
'success' => false,
'title' => translate([
'text' => 'Invalid Configuration',
'isPublicFacing' => true,
]),
'message' => translate([
'text' => 'A LocalIll form id was not given.',
'isPublicFacing' => true,
]),
];
}

$localIllForm = new LocalIllForm();
$localIllForm->id = $formId;
if ($localIllForm->find(true)) {
$localIllFormFields = $localIllForm->getFormFieldsForApi();
$result = [
'success' => true,
'title' => translate([
'text' => 'Request Title',
'isPublicFacing' => true,
]),
'message' => '',
'buttonLabel' => translate([
'text' => 'Place Request',
'isPublicFacing' => true,
]),
'buttonLabelProcessing' => translate([
'text' => 'Placing Request',
'isPublicFacing' => true,
]),
'fields' => $localIllFormFields,
];
} else {
return [
'success' => false,
'title' => translate([
'text' => 'Invalid Configuration',
'isPublicFacing' => true,
]),
'message' => translate([
'text' => 'Unable to find the specified form.',
'isPublicFacing' => true,
]),
];
}

return $result;
}

public function getSelfCheckSettings(): array {
if (isset($_REQUEST['locationId'])) {
$location = new Location();
Expand Down
Loading

0 comments on commit c9f41b0

Please sign in to comment.