diff --git a/build.gradle b/build.gradle index 5b49288..70d6760 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,9 @@ buildscript { repositories { mavenCentral() + maven { + url = "https://plugins.gradle.org/m2/" + } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE") @@ -8,10 +11,8 @@ buildscript { } -group= 'opacapi' -version= '1.0-SNAPSHOT' - - +group = 'opacapi' +version = '1.0-SNAPSHOT' apply plugin: 'java' apply plugin: 'idea' @@ -19,9 +20,10 @@ apply plugin: 'application' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' + bootJar { - baseName = 'gs-rest-service' - version = '0.1.0' + baseName = 'opacapijar' + version = '0.1.0' } sourceCompatibility = 1.8 diff --git a/opa-capi_2018-06-11.json b/opa-capi_2018-06-11.json new file mode 100644 index 0000000..e2dc194 --- /dev/null +++ b/opa-capi_2018-06-11.json @@ -0,0 +1,360 @@ +{ + "_type": "export", + "__export_format": 3, + "__export_date": "2018-06-11T19:03:13.596Z", + "__export_source": "insomnia.desktop.app:v5.16.6", + "resources": [ + { + "_id": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "created": 1523906273142, + "description": "", + "modified": 1524509808495, + "name": "opa capi", + "parentId": null, + "_type": "workspace" + }, + { + "_id": "env_cae0228545934abc9571c9b5fddfe4cb", + "color": null, + "created": 1523906273161, + "data": {}, + "isPrivate": false, + "modified": 1523906273161, + "name": "New Environment", + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "_type": "environment" + }, + { + "_id": "jar_96e7c71079c7482d87e8128048a8afbf", + "cookies": [], + "created": 1523906273167, + "modified": 1523906273167, + "name": "Default Jar", + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "_type": "cookie_jar" + }, + { + "_id": "req_b9dd6647b52245be8ef462723f114e3a", + "authentication": {}, + "body": {}, + "created": 1523906306554, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906306554, + "method": "GET", + "modified": 1524511392532, + "name": "Libraries List", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries", + "_type": "request" + }, + { + "_id": "req_0c81bf7158d8447b9ee793c20353ace9", + "authentication": {}, + "body": {}, + "created": 1523906721363, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906279894, + "method": "GET", + "modified": 1525883415158, + "name": "SearchFields", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Berlin/searchFields", + "_type": "request" + }, + { + "_id": "req_7717838b882049558adec1b09d34a8d1", + "authentication": {}, + "body": {}, + "created": 1523906828005, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906266564, + "method": "GET", + "modified": 1524511801990, + "name": "Search by author", + "parameters": [ + { + "id": "pair_0e152baa94134831aff50bc8957fa5b4", + "name": "author", + "value": "Rowling" + }, + { + "id": "pair_d3be5a35675e41009b157ac79df61f7e", + "name": "", + "value": "" + } + ], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Oranienburg/search", + "_type": "request" + }, + { + "_id": "req_10eb52a2b4064742ba25457360e7fbcb", + "authentication": {}, + "body": {}, + "created": 1523907243379, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906259899, + "method": "GET", + "modified": 1528136047664, + "name": "Search by title", + "parameters": [ + { + "id": "pair_92cb685ac70e4c25946def87c2ee13c7", + "name": "title", + "value": "Liebe" + }, + { + "id": "pair_afea56fdda684a08b50f32e59e90c841", + "name": "", + "value": "" + } + ], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Berlin/search", + "_type": "request" + }, + { + "_id": "req_821c853d9ca946bda9c088f6160ddd10", + "authentication": {}, + "body": {}, + "created": 1524158853001, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906256566.5, + "method": "GET", + "modified": 1524511135851, + "name": "Search by author and title", + "parameters": [ + { + "id": "pair_ac50ecdc306c4b3ea2f2b8f3f3ab1d9d", + "name": "title", + "value": "Pippi" + }, + { + "id": "pair_ab10f7a09527462095e12f2ea2bb7728", + "name": "author", + "value": "Astrid" + } + ], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Oranienburg/search", + "_type": "request" + }, + { + "_id": "req_28e234b304104f16a36bb2b0131c1ee7", + "authentication": {}, + "body": {}, + "created": 1524158932032, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906254900.25, + "method": "GET", + "modified": 1526321928467, + "name": "get by isdn", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Pulheim/3257069480", + "_type": "request" + }, + { + "_id": "req_115c49f7c4224854bb91c597cc5537e7", + "authentication": {}, + "body": {}, + "created": 1524163247090, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906254067.125, + "method": "GET", + "modified": 1524511143340, + "name": "get by invalid isdn", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Erlangen/355677", + "_type": "request" + }, + { + "_id": "req_89ed096309224a5f8cb5d787ab52046f", + "authentication": {}, + "body": {}, + "created": 1524166564067, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906253650.5625, + "method": "GET", + "modified": 1524511147734, + "name": "get by isdn library invalid", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Atlantis/3551551677", + "_type": "request" + }, + { + "_id": "req_cccf20fcd15547a0b0403f3a2b3d5de9", + "authentication": {}, + "body": {}, + "created": 1528134651056, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906254483.6875, + "method": "GET", + "modified": 1528743338779, + "name": "catalog", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Berlin/catalog/search?term=3257069480&searchTerm=ISBN", + "_type": "request" + }, + { + "_id": "req_d4960470a94b4e59818f94ede2ec9c2a", + "authentication": {}, + "body": {}, + "created": 1528135837279, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906254275.4062, + "method": "GET", + "modified": 1528743417139, + "name": "record details", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Berlin_HU/record/HUB_UB_ALMA_DS21617352600002882", + "_type": "request" + }, + { + "_id": "req_18c90152c685446eb6d69983b310b4b2", + "authentication": {}, + "body": {}, + "created": 1528137912027, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906254171.2656, + "method": "GET", + "modified": 1528137979698, + "name": "get by id", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Berlin_HU/catalog/search?term=Liebe&searchTerm=Title", + "_type": "request" + }, + { + "_id": "req_c0a5e533ddc54ff3a175eb82ed6672f8", + "authentication": {}, + "body": {}, + "created": 1528140632694, + "description": "", + "headers": [], + "isPrivate": false, + "metaSortKey": -1523906254223.336, + "method": "GET", + "modified": 1528140652939, + "name": "availability", + "parameters": [], + "parentId": "wrk_1d0d432d776143abbd05c3b7e4aecb1c", + "settingDisableRenderRequestBody": false, + "settingEncodeUrl": true, + "settingRebuildPath": true, + "settingSendCookies": true, + "settingStoreCookies": true, + "url": "{{base_url}}/libraries/Berlin_HU/record/branches/HUB_UB_ALMA_DS21617352600002882", + "_type": "request" + }, + { + "_id": "env_a194485d42bb4f57922f39a19a753ab3", + "color": "#02cb00", + "created": 1524508747884, + "data": { + "base_url": "http://localhost:8080" + }, + "isPrivate": false, + "modified": 1524508953764, + "name": "Local", + "parentId": "env_cae0228545934abc9571c9b5fddfe4cb", + "_type": "environment" + }, + { + "_id": "env_caad4d933a334d46aeba6dfe240685ac", + "color": "#cb0200", + "created": 1524508754972, + "data": { + "base_url": "https://berlin.codefor.de" + }, + "isPrivate": false, + "modified": 1524508960610, + "name": "Live", + "parentId": "env_cae0228545934abc9571c9b5fddfe4cb", + "_type": "environment" + } + ] +} \ No newline at end of file diff --git a/src/main/java/de/codefor/opacapi/Application.java b/src/main/java/de/codefor/opacapi/Application.java index f83a21f..e9fc0a1 100644 --- a/src/main/java/de/codefor/opacapi/Application.java +++ b/src/main/java/de/codefor/opacapi/Application.java @@ -1,12 +1,13 @@ package de.codefor.opacapi; -import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import static org.springframework.boot.SpringApplication.run; + @SpringBootApplication public class Application { public static void main(String[] args) { - SpringApplication.run(Application.class, args); + run(Application.class, args); } } diff --git a/src/main/java/de/codefor/opacapi/RestAPI.java b/src/main/java/de/codefor/opacapi/RestAPI.java index c1f5b39..da60d7c 100644 --- a/src/main/java/de/codefor/opacapi/RestAPI.java +++ b/src/main/java/de/codefor/opacapi/RestAPI.java @@ -1,8 +1,7 @@ package de.codefor.opacapi; -import de.codefor.opacapi.entity.ISBN; -import de.codefor.opacapi.entity.MySearchField; -import de.codefor.opacapi.entity.SearchQueries; +import de.codefor.opacapi.entity.*; +import de.codefor.opacapi.exception.InvalidSearchTerm; import de.codefor.opacapi.exception.LibraryNotFound; import de.codefor.opacapi.exception.SearchFailed; import de.codefor.opacapi.result.MyResult; @@ -27,7 +26,9 @@ import java.io.IOException; import java.security.Security; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; @RestController public class RestAPI { @@ -120,7 +121,87 @@ public List searchFields(@PathVariable String libraryName) throws return searchFields; } - private OpacApi getOpacApi(@PathVariable String libraryName) { + + @RequestMapping(value = "/libraries/{libraryName}/catalog/search", + method = RequestMethod.GET, + produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, + consumes = MediaType.ALL_VALUE) + public CatalogSearchResults search(@PathVariable String libraryName, + @RequestParam() String term, + @RequestParam() String searchTerm) + throws IOException, JSONException, OpacApi.OpacErrorException { + + checkSearchTerm(searchTerm); + + Security.addProvider(new BouncyCastleProvider()); + + Map results = new HashMap<>(); + + OpacApi api = getOpacApi(libraryName); + + List searchQueries = new ArrayList<>(); + + if (searchTerm.equalsIgnoreCase("Title")) { + for (SearchField searchField : api.getSearchFields()) { + if (SearchField.Meaning.TITLE.equals(searchField.getMeaning())) { + searchQueries.add(new SearchQuery(searchField, term)); + } + } + } else if (searchTerm.equalsIgnoreCase("ISBN") | searchTerm.equalsIgnoreCase("ISBN13")) { + + for (SearchField searchField : api.getSearchFields()) { + if (SearchField.Meaning.ISBN.equals(searchField.getMeaning())) { + searchQueries.add(new SearchQuery(searchField, term)); + } + } + } + + results.put(libraryName, api.search(searchQueries)); + + return new CatalogSearchResults(results); + } + + + @RequestMapping(value = "/libraries/{libraryName}/record/{id}", + method = RequestMethod.GET, + produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, + consumes = MediaType.ALL_VALUE) + public RecordResult search(@PathVariable String libraryName, + @PathVariable() String id) + throws IOException, OpacApi.OpacErrorException { + + Security.addProvider(new BouncyCastleProvider()); + + OpacApi api = getOpacApi(libraryName); + + return new RecordResult(api.getResultById(id, null)); + } + + + // GET /record/branches/ + @RequestMapping(value = "/libraries/{libraryName}/record/branches/{id}", + method = RequestMethod.GET, + produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, + consumes = MediaType.ALL_VALUE) + public RecordAvailability getAvailibility(@PathVariable String libraryName, + @PathVariable() String id) + throws IOException, OpacApi.OpacErrorException { + + Security.addProvider(new BouncyCastleProvider()); + + OpacApi api = getOpacApi(libraryName); + + return new RecordAvailability(api.getResultById(id, null)); + } + + private void checkSearchTerm(String searchTerm) { + if (!searchTerm.equals("ISBN") && + !searchTerm.equals("ISBN13") && + !searchTerm.equals("Title")) + throw new InvalidSearchTerm(searchTerm); + } + + private OpacApi getOpacApi(String libraryName) { try { File file = new File("../opacapp-config-files/bibs/" + libraryName + ".json"); Library library = Library.fromJSON(libraryName, new JSONObject(readFile(file.getAbsolutePath()))); @@ -131,9 +212,24 @@ private OpacApi getOpacApi(@PathVariable String libraryName) { e.printStackTrace(); throw new LibraryNotFound(libraryName); } + } + + private List libraries(String nameOfCity) { + List libraries = new ArrayList<>(); + + File[] listOfFiles = new File("../opacapp-config-files/bibs").listFiles(); + + for (File file : listOfFiles) { + + String libraryName = file.getName().replace(".json", ""); + + libraries.add(libraryName); + } + return libraries; } + @RequestMapping(value = "/libraries", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, diff --git a/src/main/java/de/codefor/opacapi/entity/CatalogSearchResult.java b/src/main/java/de/codefor/opacapi/entity/CatalogSearchResult.java new file mode 100644 index 0000000..10ece90 --- /dev/null +++ b/src/main/java/de/codefor/opacapi/entity/CatalogSearchResult.java @@ -0,0 +1,31 @@ +package de.codefor.opacapi.entity; + +import de.geeksfactory.opacclient.objects.SearchResult; + +public class CatalogSearchResult { + + // id​: a unique identifier for which detailed record results can be requested + private String id; + private String infoHtml; + //format​: the format or binding, Examples including hardcover, ebook, kindle, audiobook, etc. + private String format; + + public CatalogSearchResult(String libraryName, SearchResult searchResult) { + this.id = searchResult.getId(); + this.infoHtml = searchResult.getInnerhtml(); + this.format = searchResult.getType().name(); + } + + + public String getId() { + return id; + } + + public String getFormat() { + return format; + } + + public String getInfoHtml() { + return infoHtml; + } +} diff --git a/src/main/java/de/codefor/opacapi/entity/CatalogSearchResults.java b/src/main/java/de/codefor/opacapi/entity/CatalogSearchResults.java new file mode 100644 index 0000000..2203892 --- /dev/null +++ b/src/main/java/de/codefor/opacapi/entity/CatalogSearchResults.java @@ -0,0 +1,27 @@ +package de.codefor.opacapi.entity; + +import de.geeksfactory.opacclient.objects.SearchRequestResult; +import de.geeksfactory.opacclient.objects.SearchResult; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class CatalogSearchResults { + + private List results= new ArrayList<>(); + + public CatalogSearchResults(Map searchResults) { + for(Map.Entry entrySet : searchResults.entrySet()){ + String libraryName = entrySet.getKey(); + for(SearchResult searchResult : entrySet.getValue().getResults()){ + results.add(new CatalogSearchResult(libraryName, searchResult)); + } + + } + } + + public List getResults() { + return results; + } +} diff --git a/src/main/java/de/codefor/opacapi/entity/RecordAvailability.java b/src/main/java/de/codefor/opacapi/entity/RecordAvailability.java new file mode 100644 index 0000000..04d5466 --- /dev/null +++ b/src/main/java/de/codefor/opacapi/entity/RecordAvailability.java @@ -0,0 +1,26 @@ +package de.codefor.opacapi.entity; + +import de.geeksfactory.opacclient.objects.Copy; +import de.geeksfactory.opacclient.objects.DetailedItem; + +import java.util.ArrayList; +import java.util.List; + +public class RecordAvailability { + private final List branches; + + + public RecordAvailability(DetailedItem result) { + List branches = new ArrayList<>(); + + for (Copy copy : result.getCopies()) { + if (copy.getStatus().equalsIgnoreCase("available")) //TODO + branches.add(copy.getBranch()); + } + this.branches = branches; + } + + public List getBranches() { + return branches; + } +} diff --git a/src/main/java/de/codefor/opacapi/entity/RecordDetails.java b/src/main/java/de/codefor/opacapi/entity/RecordDetails.java new file mode 100644 index 0000000..4d826d9 --- /dev/null +++ b/src/main/java/de/codefor/opacapi/entity/RecordDetails.java @@ -0,0 +1,28 @@ +package de.codefor.opacapi.entity; + +import java.util.List; + +public class RecordDetails { + + private int total_copies; + private int available_copies; + private List branches; + + public RecordDetails(int total_copies, int available_copies, List branches) { + this.total_copies = total_copies; + this.available_copies = available_copies; + this.branches = branches; + } + + public int getTotal_copies() { + return total_copies; + } + + public int getAvailable_copies() { + return available_copies; + } + + public List getBranches() { + return branches; + } +} diff --git a/src/main/java/de/codefor/opacapi/entity/RecordResult.java b/src/main/java/de/codefor/opacapi/entity/RecordResult.java new file mode 100644 index 0000000..ab029c3 --- /dev/null +++ b/src/main/java/de/codefor/opacapi/entity/RecordResult.java @@ -0,0 +1,34 @@ +package de.codefor.opacapi.entity; + +import de.geeksfactory.opacclient.objects.Copy; +import de.geeksfactory.opacclient.objects.DetailedItem; + +import java.util.ArrayList; +import java.util.List; + +public class RecordResult { + + private RecordDetails details; + + + public RecordResult(DetailedItem result) { + + + int total_copies = 0; + int available_copies = 0; + List branches = new ArrayList<>(); + + for (Copy copy : result.getCopies()) { + total_copies++; + if (copy.getStatus().equalsIgnoreCase("available")) available_copies++; //TODO + branches.add(copy.getBranch()); + } + details = new RecordDetails(total_copies, available_copies, branches); + + + } + + public RecordDetails getDetails() { + return details; + } +} diff --git a/src/main/java/de/codefor/opacapi/exception/InvalidSearchTerm.java b/src/main/java/de/codefor/opacapi/exception/InvalidSearchTerm.java new file mode 100644 index 0000000..11856f4 --- /dev/null +++ b/src/main/java/de/codefor/opacapi/exception/InvalidSearchTerm.java @@ -0,0 +1,12 @@ +package de.codefor.opacapi.exception; + + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Invalid search term") + +public class InvalidSearchTerm extends RuntimeException { + public InvalidSearchTerm(String searchTerm) { + } +} diff --git a/swagger.yaml b/swagger.yaml index 6242733..8905e88 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -20,13 +20,13 @@ paths: tags: - media_data summary: Search for media - libopac style - description: Search for media - strutured after libopac + description: Search for media - structured after libopac produces: - application/json parameters: - name: libraryName in: path - description: ID of of the library + description: ID of the library required: true type: string - name: title @@ -41,7 +41,7 @@ paths: type: string - name: isbn in: query - description: resolution of data + description: ISBN required: false type: string responses: @@ -51,18 +51,44 @@ paths: $ref: '#/definitions/RawResult' '400': description: Invalid tag value + '/libraries/{libraryName}/{isbn}': + get: + tags: + - media_data + summary: Retrieve information by ISBN10 or ISBN13 + description: Record Details Endpoint structured after libraryextension + produces: + - application/json + parameters: + - name: libraryName + in: path + description: ID of the library + required: true + type: string + - name: isbn + in: path + description: ISBN of the book + required: true + type: string + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/RecordDetails' + '400': + description: Invalid input '/libraries/{libraryName}/catalog/search': get: tags: - media_data summary: Search for media - libraryextension style - description: Search for media - strutured after libraryextension + description: Search for media - structured after libraryextension produces: - application/json parameters: - name: libraryName in: path - description: ID of of the library + description: ID of the library required: true type: string - name: searchTerm @@ -85,7 +111,58 @@ paths: schema: $ref: '#/definitions/StructuredResponse' '400': - description: Invalid tag value + description: Invalid input + '/libraries/{libraryName}/record/{id}': + get: + tags: + - media_data + summary: Retrieve book by id - libraryextension style + produces: + - application/json + parameters: + - name: libraryName + in: path + description: ID of the library + required: true + type: string + - name: id + in: path + description: ID of the media + required: true + type: string + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Details' + '400': + description: Invalid input + '/libraries/{libraryName}/record/branches/{id}': + get: + tags: + - media_data + summary: Availability Endpoint + produces: + - application/json + parameters: + - name: libraryName + in: path + description: ID of the library + required: true + type: string + - name: id + in: path + description: ID of the media + required: true + type: string + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Availability' + '400': + description: Invalid input + definitions: RawResult: @@ -120,4 +197,48 @@ definitions: infoHtml: type: string format: - type: string \ No newline at end of file + type: string + + Details: + type: object + properties: + details: + $ref: '#/definitions/Details1' + Details1: + type: object + properties: + total_copies: + type: integer + example: 1 + available_copies: + type: integer + example: 1 + branches: + type: array + items: + type: string + example: "ZB Grimm-Zentrum" + Availability: + type: object + properties: + branches: + type: array + items: + type: string + example: "ZB Grimm-Zentrum" + RecordDetail: + type: object + properties: + description: + type: string + example: Der Weg des Bogens
Coelho, Paulo
2017 + availability: + type: string + example: RESTRICTED + RecordDetails: + type: object + properties: + items: + type: array + items: + $ref: '#/definitions/RecordDetail'