Skip to content

Conversation

@7uyash
Copy link

@7uyash 7uyash commented Oct 28, 2025

Fixes #240
This commit implements support for the new Crowdin API file reference endpoints, allowing users to manage asset file references in their Source Files workflow.

Added:

  • FileReference model with proper getters/setters
  • listReferences(), getReference(), addReference(), deleteReference() methods in FileApi
  • Comprehensive unit tests for all new functionality
  • Usage examples in EXAMPLES.md

API Endpoints Supported:

  • GET /projects/{projectId}/files/{fileId}/references
  • GET /projects/{projectId}/files/{fileId}/references/{referenceId}
  • POST /projects/{projectId}/files/{fileId}/references
  • DELETE /projects/{projectId}/files/{fileId}/references/{referenceId}

Features:

  • Complete CRUD operations for file references
  • Enterprise API compatibility
  • Full test coverage with proper mocking
  • Follows existing codebase patterns and conventions
  • No breaking changes - purely additive feature

Usage:

$references = $crowdin->file->listReferences($projectId, $fileId);
$reference = $crowdin->file->addReference($projectId, $fileId, [
    'name' => 'Asset Reference',
    'type' => 'image', 
    'url' => 'https://your-cdn.com/assets/image.png'
]);

EXAMPLES.md Outdated
print_r($tbxFile->getData());
```

## Manage file references
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File references are not something so common, there is no need in the dedicated example

@andrii-bodnar andrii-bodnar requested a review from Copilot October 28, 2025 20:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive support for managing file references in the Crowdin API client, enabling users to list, get, add, and delete file references for project files.

  • Introduces the FileReference model class with all necessary getters and setters
  • Adds four API methods to FileApi for complete file reference CRUD operations
  • Includes comprehensive test coverage for both the model and API methods
  • Updates documentation with practical examples for using the new functionality

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/CrowdinApiClient/Model/FileReference.php New model class representing a file reference with properties like id, projectId, fileId, name, type, url, and timestamps
src/CrowdinApiClient/Api/FileApi.php Adds four new methods: listReferences, getReference, addReference, and deleteReference for managing file references
tests/CrowdinApiClient/Model/FileReferenceTest.php Comprehensive unit tests for the FileReference model covering constructor initialization and setter methods
tests/CrowdinApiClient/Api/FileApiTest.php Integration tests for all four file reference API methods with proper mock responses
EXAMPLES.md Adds a complete example section demonstrating how to use the new file reference management features

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andrii-bodnar andrii-bodnar marked this pull request as draft November 12, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for new File References API

2 participants