Commit 35320b92 authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

addded endpoint for autocomplete ISO3 code

parent 2fa52e73
......@@ -16,6 +16,7 @@
package org.genesys.catalog.api.v0;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import org.genesys.catalog.exceptions.NotFoundElement;
......@@ -28,12 +29,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -108,4 +104,18 @@ public class GeoController {
throw new NotFoundElement("Code is not in valid format: 3-letter | 2-letter | numeric");
}
/**
* Autocomplete.
*
* @param text the text
* @return the list
* @throws IOException Signals that an I/O exception has occurred.
*/
@GetMapping(value = "/iso3166/autocomplete", produces = MediaType.APPLICATION_JSON_VALUE)
public List<VocabularyTerm> autocompleteGeoTerm(@RequestParam("c") final String text) throws IOException {
return vocabularyService.autocompleteTerms(ISO3166_3ALPHA, text);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment