diff --git a/src/components/operations/operation-details/ko/runtime/operation-console.html b/src/components/operations/operation-details/ko/runtime/operation-console.html index fb47ea8e4..5ee721e99 100644 --- a/src/components/operations/operation-details/ko/runtime/operation-console.html +++ b/src/components/operations/operation-details/ko/runtime/operation-console.html @@ -87,6 +87,7 @@

Authorization

+
+

Parameters

diff --git a/src/components/operations/operation-details/ko/runtime/operation-console.ts b/src/components/operations/operation-details/ko/runtime/operation-console.ts index d12ebb71f..b26b15e3d 100644 --- a/src/components/operations/operation-details/ko/runtime/operation-console.ts +++ b/src/components/operations/operation-details/ko/runtime/operation-console.ts @@ -45,6 +45,7 @@ export class OperationConsole { public readonly responseHeadersString: ko.Observable; public readonly products: ko.Observable; public readonly selectedSubscriptionKey: ko.Observable; + public readonly subscriptionKeyRequired: ko.Observable; public readonly selectedLanguage: ko.Observable; public readonly selectedProduct: ko.Observable; public readonly requestError: ko.Observable; @@ -84,6 +85,7 @@ export class OperationConsole { this.consoleOperation = ko.observable(); this.secretsRevealed = ko.observable(); this.selectedSubscriptionKey = ko.observable(); + this.subscriptionKeyRequired = ko.observable(); this.working = ko.observable(true); this.sendingRequest = ko.observable(false); this.codeSample = ko.observable(); @@ -165,6 +167,7 @@ export class OperationConsole { this.responseStatusText(null); this.responseBody(null); this.selectedSubscriptionKey(null); + this.subscriptionKeyRequired(!!selectedApi.subscriptionRequired); this.selectedProduct(null); const operation = await this.apiService.getOperation(selectedOperation.id); @@ -193,7 +196,10 @@ export class OperationConsole { } await this.setupOAuth(); - await this.loadSubscriptionKeys(); + + if (selectedApi.subscriptionRequired) { + await this.loadSubscriptionKeys(); + } this.updateRequestSummary(); this.working(false); @@ -443,9 +449,7 @@ export class OperationConsole { break; case "binary": - const formData = new FormData(); - formData.append(request.binary().name, request.binary()); - payload = formData; + payload = await Utils.readFileAsByteArray(request.binary()); break; default: diff --git a/src/contracts/api.ts b/src/contracts/api.ts index 0283c2174..6b5b8924c 100644 --- a/src/contracts/api.ts +++ b/src/contracts/api.ts @@ -1,4 +1,3 @@ -import { OperationContract } from "./operation"; import { AuthenticationSettings } from "./authenticationSettings"; import { ArmResource } from "./armResource"; @@ -10,11 +9,34 @@ export interface ApiContract extends ArmResource { } export interface ApiProperties { + /** + * API name. Must be 1 to 300 characters long. + */ displayName?: string; + + /** + * Description of the API. May include HTML formatting tags. + */ description?: string; + + /** + * Indicates the Version identifier of the API if the API is versioned. + */ apiVersion?: string; + + /** + * Description of the API Version. + */ apiVersionDescription?: string; + + /** + * A resource identifier for the related API version set. + */ apiVersionSetId?: string; + + /** + * Version set details. + */ apiVersionSet?: { name: string, description: string, @@ -22,20 +44,58 @@ export interface ApiProperties { versionQueryName: string, versionHeaderName: string }; + + /** + * Describes the Revision of the Api. If no value is provided, default revision 1 is created. + */ apiRevision?: string; + + /** + * Description of the Api Revision. + */ apiRevisionDescription?: string; + + /** + * Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + */ serviceUrl?: string; + + /** + * Relative URL uniquely identifying this API and all of its resource paths within the API Management + * service instance. It is appended to the API endpoint base URL specified during the service instance + * creation to form a public URL for this API. + */ path?: string; + + /** + * Describes on which protocols the operations in this API can be invoked. + */ protocols?: string[]; - proxyAuth?: string; + + /** + * API Authentication Settings. + */ authenticationSettings?: AuthenticationSettings; + + /** + * Subscription key parameter names details. + */ subscriptionKeyParameterNames?: SubscriptionKeyParameterName; - urlSuffix?: string; - operations?: OperationContract[]; + + /** + * Type of API, e.g. "http" or "soap". + */ type?: string; + + /** + * Indicates if API revision is current api revision. + */ isCurrent?: boolean; - isOnline?: boolean; - subscriptionRequired?: boolean; + + /** + * Specifies whether an API or Product subscription is required for accessing the API. + */ + subscriptionRequired: boolean; } diff --git a/src/contracts/authenticationSettings.ts b/src/contracts/authenticationSettings.ts index 16d8baa4e..919792275 100644 --- a/src/contracts/authenticationSettings.ts +++ b/src/contracts/authenticationSettings.ts @@ -16,5 +16,4 @@ export interface OpenIdAuthenticationSettings { export interface AuthenticationSettings { oAuth2?: OAuth2AuthenticationSettings; openid?: OpenIdAuthenticationSettings; - subscriptionKeyRequired?: boolean; } \ No newline at end of file diff --git a/src/models/api.ts b/src/models/api.ts index 4482b2049..0c6b3add5 100644 --- a/src/models/api.ts +++ b/src/models/api.ts @@ -22,6 +22,9 @@ export class Api { */ public displayName?: string; + /** + * Display name of API that includes version. + */ public versionedDisplayName?: string; /** @@ -74,17 +77,26 @@ export class Api { */ public protocols?: string[]; + /** + * Subscription key parameter names details. + */ public subscriptionKeyParameterNames?: SubscriptionKeyParameterName; - public urlSuffix?: string; - /** * Determines type of API, e.g. "soap". */ public type?: string; + /** + * Information about associated authorization servers (OAuth 2 or OpenID Connect). + */ public authenticationSettings: AuthenticationSettings; + /** + * Specifies whether an API or Product subscription is required for accessing the API. + */ + public subscriptionRequired: boolean; + constructor(contract?: ApiContract) { if (contract.id) { this.id = Utils.getResourceName("apis", contract.id, "shortId"); @@ -98,12 +110,12 @@ export class Api { this.description = contract.properties.description; this.path = contract.properties.path; this.versionedPath = this.path; - this.urlSuffix = contract.properties.urlSuffix; this.apiVersion = contract.properties.apiVersion; this.apiRevision = contract.properties.apiRevision; this.subscriptionKeyParameterNames = contract.properties.subscriptionKeyParameterNames; this.type = contract.properties.type; this.authenticationSettings = contract.properties.authenticationSettings; + this.subscriptionRequired = contract.properties.subscriptionRequired; if (contract.properties.apiVersionSet) { const nestedVersionSet = contract.properties.apiVersionSet; diff --git a/src/utils.ts b/src/utils.ts index 692097b6b..a93a1e183 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -338,4 +338,16 @@ export class Utils { return utc; } + + public static readFileAsByteArray(file: File): Promise { + return new Promise(resolve => { + const reader = new FileReader(); + + reader.onload = (event: any) => { + resolve(event.target.result); + }; + + reader.readAsArrayBuffer(file); + }); + } } \ No newline at end of file