-
Notifications
You must be signed in to change notification settings - Fork 68
feat: add support for File References API (list/get/add/delete) #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,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) { | ||
|
Comment on lines
+16
to
+19
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new methods should be documented according to the code style used for the rest of the project resources |
||
| 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); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.crowdin.client.filereferences.model; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| /** | ||
| * Request body for creating a new File Reference. | ||
| */ | ||
| @Data | ||
| public class AddFileReferenceRequest { | ||
| private String name; // Name of the reference | ||
| private String type; // Type of the reference (e.g., "file" or "asset") | ||
| private Long fileId; // ID of the file this reference points to | ||
| } | ||
|
Comment on lines
+5
to
+13
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow the project's code style for request models |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import com.crowdin.client.filereferences.model.AddFileReferenceRequest; | ||
|
|
||
| package com.crowdin.client.filereferences.model; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class FileReference { | ||
| private Long id; | ||
| private String name; | ||
| private String type; | ||
| private Long projectId; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a new API resource. Please follow the API docs structure and include the new methods in the
sourcefilesresource