Azure / Azure/autorest.powershell

Feature Request: Add `-AsBytes` parameter to commands that return non-Json responses

Open
#996 0 comments 0 reactions 0 assignees View on GitHub
feature-request P2
Dominant language
C#
Stars
123
Forks
99
PR merge metrics
No merged PRs in 30d

Description

Given an OpenAPI operation that returns an `application/octet-stream` media type as the response:
``` yml
openapi: 3.0.1
info:
title: Me
description: Gets details about me!
version: 1.0.0
servers:
- url: https://test.azurewebsites.net/
paths:
'/me/photo/$value':
get:
tags:
- me.profilePhoto
summary: Get media content for the navigation property photo from users
operationId: Me_GetPhotoContent
responses:
'200':
description: Retrieved media content
content:
application/octet-stream:
schema:
type: string
format: binary
default:
$ref: '#/components/responses/error'
components:
responses:
error:
description: error
content:
application/json:
schema:
type: object
properties:
result:
type: string
```
We should generate an extra parameter set with `-AsBytes` parameter. This parameterSet should return the response content as byte array instead of downloading the file.

### Proposed Usage
``` Powershell
# Feature request
$ContentInBytes = Get-PhotoContent -AsBytes
# Currently supported
Get-PhotoContent -OutFile "File_Path"
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.