Skip to content

Commit

Permalink
TypeScript RLC multipart documentation (Azure#1939)
Browse files Browse the repository at this point in the history
Document existing support for multipart in TypeScript RLC generation

---------

Co-authored-by: Yuchao Yan <[email protected]>
  • Loading branch information
2 people authored and markcowl committed Dec 5, 2024
1 parent a3b281e commit 375b6ec
Showing 1 changed file with 63 additions and 1 deletion.
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

0 comments on commit 375b6ec

Please sign in to comment.