Skip to content

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

@peombwa

Description

@peombwa

Given an OpenAPI operation that returns an application/octet-stream media type as the response:

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

# Feature request
$ContentInBytes = Get-PhotoContent -AsBytes
# Currently supported
Get-PhotoContent -OutFile "File_Path"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions