forked from crowdin/crowdin-api-client-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileReferencesApi.java
More file actions
47 lines (40 loc) · 1.81 KB
/
FileReferencesApi.java
File metadata and controls
47 lines (40 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.crowdin.client.filereferences;
import com.crowdin.client.core.CrowdinApi;
import com.crowdin.client.core.model.ResponseList;
import com.crowdin.client.core.model.ResponseObject;
import com.crowdin.client.filereferences.model.FileReference;
import com.crowdin.client.filereferences.model.AddFileReferenceRequest;
import com.fasterxml.jackson.core.type.TypeReference;
public class FileReferencesApi extends CrowdinApi {
public FileReferencesApi(com.crowdin.client.core.model.Credentials credentials) {
super(credentials);
}
/**
* List File References
*/
public ResponseList<FileReference> listFileReferences(Long projectId) {
String url = String.format("%s/projects/%d/file-references", this.url, projectId);
return this.httpClient.get(url, new TypeReference<ResponseList<FileReference>>() {});
}
/**
* Get File Reference by ID
*/
public ResponseObject<FileReference> getFileReference(Long projectId, Long fileReferenceId) {
String url = String.format("%s/projects/%d/file-references/%d", this.url, projectId, fileReferenceId);
return this.httpClient.get(url, new TypeReference<ResponseObject<FileReference>>() {});
}
/**
* Add File Reference
*/
public ResponseObject<FileReference> addFileReference(Long projectId, AddFileReferenceRequest request) {
String url = String.format("%s/projects/%d/file-references", this.url, projectId);
return this.httpClient.post(url, request, new TypeReference<ResponseObject<FileReference>>() {});
}
/**
* Delete File Reference
*/
public void deleteFileReference(Long projectId, Long fileReferenceId) {
String url = String.format("%s/projects/%d/file-references/%d", this.url, projectId, fileReferenceId);
this.httpClient.delete(url);
}
}