Skip to content

Rust SDK: Add file upload/download, streaming, and multi-part form support to Rust SDK generator #8828

@iamnamananand996

Description

@iamnamananand996

Which Fern component?

SDK Generator

How important is this?

P0 - Critical (Blocking work)

What's the feature?

Problem

The Rust SDK generator currently lacks comprehensive file handling capabilities, making it difficult for users to:

  • Upload files with proper metadata (filename, content type)
  • Download large files efficiently using streaming
  • Handle multi-part form data submissions
  • Work with binary data in a structured way

Proposed Solution

Enhance the Rust SDK generator to include:

1. File Upload Support

  • Create a File struct to handle file data with metadata
  • Support for filename and content-type specification
  • Integration with HTTP client for seamless uploads

2. Streaming Downloads

  • Implement FileStream for efficient large file downloads
  • Async streaming support to handle memory efficiently
  • Proper error handling for network and IO operations

3. Multi-part Form Data

  • Add ToFormText trait for form data conversion
  • Support for mixed content types in forms
  • Integration with reqwest's multipart functionality

4. Code Organization

  • Move template files to a "core" folder structure
  • Improve maintainability and discoverability of utilities

Acceptance Criteria

  • File upload functionality with metadata support
  • Streaming download capabilities for large files
  • Multi-part form data handling
  • All existing seed tests continue to pass
  • New template structure with "core" folder organization
  • Documentation and examples for new features

Additional Context

This enhancement will bring the Rust SDK generator to feature parity with other language generators for file handling scenarios, improving the
developer experience for APIs that involve file operations.

Any alternatives?

No response

Are you interested in contributing this feature?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions