Skip to content
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

TypeScript RLC multipart documentation #1939

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,67 @@ public virtual Response Upload(MultipartRequest body, CancellationToken cancella
```

```typescript
// RLC models (multipart part descriptors)

export interface MultipartRequestIdPartDescriptor {
name: "id";
body: string;
}

export interface MultipartRequestAddressPartDescriptor {
name: "address";
body: Address;
}

export interface MultipartRequestProfileImagePartDescriptor {
name: "profileImage";
body: string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream | File;
filename?: string;
contentType?: string;
}

export interface MultipartRequestPicturesPartDescriptor {
name: "pictures";
body: string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream | File;
filename?: string;
contentType?: string;
}

export interface Address {
city: string;
}

export type MultipartRequest =
| FormData
| Array<
| MultipartRequestIdPartDescriptor
| MultipartRequestAddressPartDescriptor
| MultipartRequestProfileImagePartDescriptor
| MultipartRequestPicturesPartDescriptor
>;

// RLC parameters

export interface UploadBodyParam {
body: MultipartRequest;
}

export interface UploadMediaTypesParam {
contentType: "multipart/form-data";
}

export type UploadParameters = UploadMediaTypesParam & UploadBodyParam & RequestParameters;

// RLC operations

export interface Upload {
post(options: UploadParameters): StreamableMethod<Upload204Response>;
}

export interface Routes {
/** Resource for '/' has methods for the following verbs: post */
(path: "/"): Upload;
}
```

```java
Expand Down Expand Up @@ -120,7 +180,9 @@ def upload(
```

```typescript

// Not yet implemented. See issues:
// - RLC: https://github.com/Azure/autorest.typescript/issues/2568
// - Modular: https://github.com/Azure/autorest.typescript/issues/2422
```

```java
Expand Down
Loading