@Path(value="/glossary")
@Produces(value={"application/xml","application/json","application/vnd.zanata.glossary+xml","application/vnd.zanata.glossary+json","application/octet-stream"})
@Consumes(value={"application/xml","application/json","application/vnd.zanata.glossary+xml","application/vnd.zanata.glossary+json"})
public interface GlossaryResource
Modifier and Type | Field and Description |
---|---|
static String |
GLOBAL_QUALIFIED_NAME
Qualified name for Global/default glossary
|
static int |
MAX_PAGE_SIZE
Maximum result for per page.
|
static String |
SERVICE_PATH |
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
deleteAllEntries(String qualifiedName)
Delete all entries in a glossary.
|
javax.ws.rs.core.Response |
deleteEntry(Long id,
String qualifiedName)
Delete a glossary entry.
|
javax.ws.rs.core.Response |
downloadFile(String fileType,
String locales,
String qualifiedName)
Download all glossary entries as a file
|
javax.ws.rs.core.Response |
getDetails(LocaleId locale,
List<Long> termIds)
Get the details for a set of glossary terms.
|
javax.ws.rs.core.Response |
getEntries(LocaleId srcLocale,
LocaleId transLocale,
int page,
int sizePerPage,
String filter,
String fields,
String qualifiedName)
Returns a subset of Glossary entries for the given source and translation
locale as indicated by the paging parameters.
|
javax.ws.rs.core.Response |
getInfo(String qualifiedName)
Return source locales available for all glossary entries
|
javax.ws.rs.core.Response |
getQualifiedName()
Return default global glossary qualifiedName
|
javax.ws.rs.core.Response |
post(List<GlossaryEntry> glossaryEntries,
String locale,
String qualifiedName)
Create or update glossary entries.
|
javax.ws.rs.core.Response |
search(LocaleId srcLocale,
LocaleId transLocale,
int maxResults,
String searchText,
String projectSlug)
Returns Glossary entries based on a fuzzy text search.
|
javax.ws.rs.core.Response |
upload(GlossaryFileUploadForm form)
Upload glossary file (currently supported formats: po, csv)
|
static final String SERVICE_PATH
static final int MAX_PAGE_SIZE
static final String GLOBAL_QUALIFIED_NAME
@GET @Path(value="/qualifiedName") @Produces(value={"application/vnd.zanata.glossary+xml","application/vnd.zanata.glossary+json","application/xml","application/json"}) javax.ws.rs.core.Response getQualifiedName()
@GET @Path(value="/info") @Produces(value={"application/vnd.zanata.glossary+xml","application/vnd.zanata.glossary+json","application/xml","application/json"}) javax.ws.rs.core.Response getInfo(@DefaultValue(value="global/default") @QueryParam(value="qualifiedName") String qualifiedName)
qualifiedName
- Qualified name of glossary, default to GLOBAL_QUALIFIED_NAME
@GET @Path(value="/entries") @Produces(value={"application/vnd.zanata.glossary+json","application/json"}) javax.ws.rs.core.Response getEntries(@DefaultValue(value="en-US") @QueryParam(value="srcLocale") LocaleId srcLocale, @QueryParam(value="transLocale") LocaleId transLocale, @DefaultValue(value="1") @QueryParam(value="page") int page, @DefaultValue(value="1000") @QueryParam(value="sizePerPage") int sizePerPage, @QueryParam(value="filter") String filter, @QueryParam(value="sort") String fields, @DefaultValue(value="global/default") @QueryParam(value="qualifiedName") String qualifiedName)
srcLocale
- Source locale - Required (default value: en-US).transLocale
- Translation localepage
- Current request page (default value: 1)sizePerPage
- Size of entry per page (default/max value: 1000)
MAX_PAGE_SIZE
filter
- String filter for source contentfields
- Fields to sort. Comma separated. e.g sort=desc,-part_of_speech
See GlossarySortField
qualifiedName
- Qualified name of glossary, default to GLOBAL_QUALIFIED_NAME
org.zanata.rest.dto.GlossaryEntry} for details on the result
list's contents.
@GET @Path(value="/search") @Produces(value={"application/vnd.zanata.glossary+json","application/json"}) javax.ws.rs.core.Response search(@DefaultValue(value="en-US") @QueryParam(value="srcLocale") LocaleId srcLocale, @CheckForNull @QueryParam(value="transLocale") LocaleId transLocale, @DefaultValue(value="20") @QueryParam(value="maxResults") int maxResults, @CheckForNull @QueryParam(value="searchText") String searchText, @CheckForNull @QueryParam(value="project") String projectSlug)
srcLocale
- Source localetransLocale
- Translation localemaxResults
- Maximum results for global and project queries. May return
up to double this number. Default: 20searchText
- Text containing terms to match in the search.projectSlug
- (optional) Project slug if a project glossary should be searched
in addition to the global glossary.org.zanata.rest.dto.GlossaryEntry} for details on the result
list's contents.
@GET @Path(value="/details/{locale}") @Produces(value={"application/vnd.zanata.glossary+json","application/json"}) javax.ws.rs.core.Response getDetails(@CheckForNull @PathParam(value="locale") LocaleId locale, @CheckForNull @QueryParam(value="termIds") List<Long> termIds)
locale
- include locale-specific detail for this localetermIds
- id for glossary terms in the default locale, found in
results of search(LocaleId, LocaleId, int, String, String)
@GET @Path(value="/file") @Produces(value="application/octet-stream") javax.ws.rs.core.Response downloadFile(@DefaultValue(value="csv") @QueryParam(value="fileType") String fileType, @QueryParam(value="locales") String locales, @DefaultValue(value="global/default") @QueryParam(value="qualifiedName") String qualifiedName)
fileType
- 'po' or 'csv' (case insensitive) are currently supportedlocales
- optional comma separated list of languages required.qualifiedName
- Qualified name of glossary, default to GLOBAL_QUALIFIED_NAME
@POST @Produces(value={"application/xml","application/json"}) @Consumes(value={"application/xml","application/json"}) @Path(value="/entries") javax.ws.rs.core.Response post(List<GlossaryEntry> glossaryEntries, @QueryParam(value="locale") String locale, @DefaultValue(value="global/default") @QueryParam(value="qualifiedName") String qualifiedName)
glossaryEntries
- The glossary entries to create/updatequalifiedName
- Qualified name of glossary, defaults to GLOBAL_QUALIFIED_NAME
locale
- Locale to which the given glossary entries belong@Consumes(value="multipart/form-data") @Produces(value="application/json") @POST javax.ws.rs.core.Response upload(GlossaryFileUploadForm form)
form
- Multi-part form with the following named parts: @DELETE @Produces(value="application/json") @Path(value="/entries/{id}") javax.ws.rs.core.Response deleteEntry(@PathParam(value="id") Long id, @DefaultValue(value="global/default") @QueryParam(value="qualifiedName") String qualifiedName)
id
- id for source glossary termqualifiedName
- Qualified name of glossary, defaults to GLOBAL_QUALIFIED_NAME
@DELETE javax.ws.rs.core.Response deleteAllEntries(@DefaultValue(value="global/default") @QueryParam(value="qualifiedName") String qualifiedName)
qualifiedName
- Qualified name of glossary, defaults to GLOBAL_QUALIFIED_NAME
Copyright © 2017 Zanata Project. All rights reserved.