Skip to content

Conversation

@santiagomed
Copy link
Collaborator

Changelog:

  1. Extended Functionality for Traceability:

    • Added a trace boolean to the MediaUploader struct, which allows for the inclusion of tracing information when sending requests.
    • Integrated the trace option into various function calls such as NewMediaUploader, NewMediaUploaderWithoutFile, ExecuteMediaUpload, and ExecuteMediaStatus to maintain consistency and functionality.
  2. API Endpoint Adjustments:

    • Modified the URL construction for media endpoint actions. The endpoints for initialize (/initialize), append (e.g., /{mediaID}/append), and finalize (/{mediaID}/finalize) now have well-defined paths instead of using a query-based command approach. This follows the recent media upload changes to the X API.
  3. Refactored Data Extraction:

    • Simplified media ID extraction and moved away from query string parameters to path components in the URL. This was applied across methods like ExtractMediaID and ExtractSegmentIndex.
    • Introduced the ExtractCommand function to discern the media upload command directly from the URL path instead of relying on query parameters.
  4. Tests Adjustments:

    • Updated test cases to reflect changes in endpoint paths and request handling, using the new URL format and JSON-based data structures.
    • Validated functionality through enhanced mock client tests to ensure consistent behavior across various media operations.

Important Note:

  • A TODO comment was added highlighting the need for refactoring to handle both JSON and multipart form data for append/one-shot media uploads. Current functionality primarily handles multipart requests, and a more unified approach that accommodates both data formats is still required.

Copy link

@amisra-work amisra-work left a comment

Choose a reason for hiding this comment

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

LFTM

Copy link
Contributor

@tapans tapans left a comment

Choose a reason for hiding this comment

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

thanks for teaching me GO. let's GO

@santiagomed santiagomed merged commit dd12833 into main May 8, 2025
2 checks passed
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.

4 participants