Skip to content

feat: add FileSDK module for file storage operations#143

Open
NianJiuZst wants to merge 1 commit into
MiniMax-AI:mainfrom
NianJiuZst:feat/sdk-file-module
Open

feat: add FileSDK module for file storage operations#143
NianJiuZst wants to merge 1 commit into
MiniMax-AI:mainfrom
NianJiuZst:feat/sdk-file-module

Conversation

@NianJiuZst
Copy link
Copy Markdown
Contributor

Summary

Closes #142

Adds a file property to MiniMaxSDK so SDK users can manage files in MiniMax storage without manually constructing HTTP requests.

Motivation

Every CLI resource has a corresponding SDK module — except file storage:

CLI command SDK method Status
mmx file upload sdk.file.upload() Added
mmx file list sdk.file.list() Added
mmx file delete sdk.file.delete() Added
(no CLI command) sdk.file.retrieve() Added

Usage

import { MiniMaxSDK } from 'mmx-cli/sdk';

const sdk = new MiniMaxSDK({ apiKey: 'sk-...', region: 'global' });

// Upload
const { file } = await sdk.file.upload('/path/to/doc.pdf', 'retrieval');

// List
const { files } = await sdk.file.list();

// Get metadata
const info = await sdk.file.retrieve(file.file_id);

// Delete
await sdk.file.delete(file.file_id);

Implementation

  • FileSDK extends Client and reuses existing file*Endpoint() functions and API types from the shared client layer
  • upload() mirrors the CLI's FormData construction and file existence validation
  • All four file endpoints (/v1/files, /v1/files/list, /v1/files/delete, /v1/files/retrieve) are covered

Files changed

File Change
src/sdk/file/index.ts New file — FileSDK class (70 lines)
src/sdk/index.ts +3 lines — import and expose file property
test/sdk/file.test.ts New file — file existence and upload smoke tests

Screenshots

Add a new `file` property to MiniMaxSDK that exposes:

- upload(filePath, purpose?) — upload a local file via multipart/form-data
- list()                   — list all files in storage
- delete(fileId)           — delete a file by ID
- retrieve(fileId)         — get file metadata and optional download URL

The module reuses existing endpoint definitions and API types from the
shared client layer. FormData construction and file existence checks
mirror the CLI's file upload command behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NianJiuZst NianJiuZst force-pushed the feat/sdk-file-module branch from 1e1c108 to 89b3d5c Compare May 12, 2026 18:03
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.

Missing FileSDK module in SDK

1 participant