Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/main/java/com/crowdin/client/glossaries/GlossariesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public ResponseList<SearchConcordance> searchConcordance(Long projectId, SearchC
}

/**
* Note: {@code userId} in the request is supported by Crowdin only (not by Crowdin Enterprise).
*
* @param request request object
* @return list of search results
* @see <ul>
Expand Down Expand Up @@ -125,12 +127,32 @@ public ResponseObject<Concept> getConcept(Long glossaryId, Long conceptId) throw
* <li><a href="https://developer.crowdin.com/api/v2/#operation/api.glossaries.concepts.put" target="_blank"><b>API Documentation</b></a></li>
* <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.glossaries.concepts.put" target="_blank"><b>Enterprise API Documentation</b></a></li>
* </ul>
* @deprecated sends the response model {@link Concept} (including read-only properties such as id, userId and
* dates) as the request body; use {@link #updateConceptWithRequest(Long, Long, UpdateConceptRequest)} instead
*/
@Deprecated
public ResponseObject<Concept> updateConcept(Long glossaryId, Long conceptId, Concept request) throws HttpException, HttpBadRequestException {
ConceptResponseObject conceptResponseObject = this.httpClient.put(this.url + "/glossaries/" + glossaryId + "/concepts/" + conceptId, request, new HttpRequestConfig(), ConceptResponseObject.class);
return ResponseObject.of(conceptResponseObject.getData());
}

/**
* Updates a concept using a request model that contains only the properties accepted by the API.
*
* @param glossaryId glossary identifier
* @param conceptId concept identifier
* @param request request object
* @return updated concept
* @see <ul>
* <li><a href="https://developer.crowdin.com/api/v2/#operation/api.glossaries.concepts.put" target="_blank"><b>API Documentation</b></a></li>
* <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.glossaries.concepts.put" target="_blank"><b>Enterprise API Documentation</b></a></li>
* </ul>
*/
public ResponseObject<Concept> updateConceptWithRequest(Long glossaryId, Long conceptId, UpdateConceptRequest request) throws HttpException, HttpBadRequestException {
ConceptResponseObject conceptResponseObject = this.httpClient.put(this.url + "/glossaries/" + glossaryId + "/concepts/" + conceptId, request, new HttpRequestConfig(), ConceptResponseObject.class);
return ResponseObject.of(conceptResponseObject.getData());
}

/**
* @param glossaryId glossary identifier
* @param conceptId concept identifier
Expand Down Expand Up @@ -181,6 +203,14 @@ public ResponseList<Glossary> listGlossaries(Long groupId, Integer limit, Intege
return listGlossaries(params);
}

/**
* @param params query params (groupId is Enterprise only, userId is Crowdin only)
* @return list of glossaries
* @see <ul>
* <li><a href="https://developer.crowdin.com/api/v2/#operation/api.glossaries.getMany" target="_blank"><b>API Documentation</b></a></li>
* <li><a href="https://developer.crowdin.com/enterprise/api/v2/#operation/api.glossaries.getMany" target="_blank"><b>Enterprise API Documentation</b></a></li>
* </ul>
*/
public ResponseList<Glossary> listGlossaries(ListGlossariesParams params) throws HttpException, HttpBadRequestException {
ListGlossariesParams query = Optional.ofNullable(params).orElse(new ListGlossariesParams());

Expand All @@ -191,6 +221,7 @@ public ResponseList<Glossary> listGlossaries(ListGlossariesParams params) throws
Map<String, Optional<Object>> queryParams = HttpRequestConfig.buildUrlParams(
"groupId", Optional.ofNullable(query.getGroupId()),
"userId", Optional.ofNullable(query.getUserId()),
"filter", Optional.ofNullable(query.getFilter()),
"limit", Optional.ofNullable(query.getLimit()),
"offset", Optional.ofNullable(query.getOffset()),
"orderBy", Optional.ofNullable(orderBy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ public class AddGlossaryRequest {
private String name;
private String languageId;
private Long groupId;
private Boolean isShared;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import lombok.Data;

import java.util.Map;

@Data
public class AddTermRequest {

Expand All @@ -17,4 +19,8 @@ public class AddTermRequest {
private Long conceptId;
@Deprecated
private Long translationOfTermId;
/**
* Enterprise only. Keys get via List Fields
*/
private Map<String, Object> fields;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.Date;
import java.util.List;
import java.util.Map;

@Data
public class Concept {
Expand All @@ -18,6 +19,10 @@ public class Concept {
private String url;
private String figure;
private List<ConceptLanguagesDetails> languagesDetails;
/**
* Enterprise only
*/
private Map<String, Object> fields;
private Date createdAt;
private Date updatedAt;

Expand Down
Loading
Loading