Skip to content
Closed
Show file tree
Hide file tree
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
16 changes: 3 additions & 13 deletions sdk/commerce/arm-commerce/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
# Release History

## 4.0.0-beta.4 (2023-02-10)

## 4.0.0-beta.4 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

## 4.0.0-beta.3 (2022-11-17)

The package of @azure/arm-commerce is using our next generation design principles since version 4.0.0-beta.3, which contains breaking changes.
The package of @azure/arm-commerce is using our next generation design principles since version 4.0.0-beta.4, which contains breaking changes.

To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog).

Expand Down
2 changes: 1 addition & 1 deletion sdk/commerce/arm-commerce/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 Microsoft
Copyright (c) 2023 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions sdk/commerce/arm-commerce/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "d29e6eb4894005c52e67cb4b5ac3faf031113e7d",
"readme": "specification\\commerce\\resource-manager\\readme.md",
"autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\commerce\\resource-manager\\readme.md --use=@autorest/[email protected].3.20221108.1 --generate-sample=true",
"commit": "289ed254a0f9e94397afe3245ec048e368332eeb",
"readme": "specification/commerce/resource-manager/readme.md",
"autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/commerce/resource-manager/readme.md --use=@autorest/[email protected].5",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.4.2",
"use": "@autorest/[email protected].3.20221108.1"
"release_tool": "@azure-tools/js-sdk-release-tools@2.6.2",
"use": "@autorest/[email protected].5"
}
12 changes: 2 additions & 10 deletions sdk/commerce/arm-commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,5 @@
}
]
},
"autoPublish": true,
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-commerce?view=azure-node-preview"
}
}
"autoPublish": true
}
3 changes: 0 additions & 3 deletions sdk/commerce/arm-commerce/review/arm-commerce.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ export interface UsageAggregates {

// @public
export interface UsageAggregatesListNextOptionalParams extends coreClient.OperationOptions {
aggregationGranularity?: AggregationGranularity;
continuationToken?: string;
showDetails?: boolean;
}

// @public
Expand Down
9 changes: 1 addition & 8 deletions sdk/commerce/arm-commerce/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,7 @@ export type UsageAggregatesListResponse = UsageAggregationListResult;

/** Optional parameters. */
export interface UsageAggregatesListNextOptionalParams
extends coreClient.OperationOptions {
/** `True` returns usage data in instance-level detail, `false` causes server-side aggregation with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for website consumption. If you specify showDetails = false, the data will be aggregated as a single line item for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and usageEndTime). */
showDetails?: boolean;
/** `Daily` (default) returns the data in daily granularity, `Hourly` returns the data in hourly granularity. */
aggregationGranularity?: AggregationGranularity;
/** Used when a continuation token string is provided in the response body of the previous call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of the day/hour (based on the granularity) passed in. */
continuationToken?: string;
}
extends coreClient.OperationOptions {}

/** Contains response data for the listNext operation. */
export type UsageAggregatesListNextResponse = UsageAggregationListResult;
Expand Down
21 changes: 2 additions & 19 deletions sdk/commerce/arm-commerce/src/operations/usageAggregates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ export class UsageAggregatesImpl implements UsageAggregates {
yield page;
}
while (continuationToken) {
result = await this._listNext(
reportedStartTime,
reportedEndTime,
continuationToken,
options
);
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
Expand Down Expand Up @@ -133,19 +128,15 @@ export class UsageAggregatesImpl implements UsageAggregates {

/**
* ListNext
* @param reportedStartTime The start of the time range to retrieve data for.
* @param reportedEndTime The end of the time range to retrieve data for.
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
reportedStartTime: Date,
reportedEndTime: Date,
nextLink: string,
options?: UsageAggregatesListNextOptionalParams
): Promise<UsageAggregatesListNextResponse> {
return this.client.sendOperationRequest(
{ reportedStartTime, reportedEndTime, nextLink, options },
{ nextLink, options },
listNextOperationSpec
);
}
Expand Down Expand Up @@ -188,14 +179,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [
Parameters.reportedStartTime,
Parameters.reportedEndTime,
Parameters.showDetails,
Parameters.aggregationGranularity,
Parameters.continuationToken,
Parameters.apiVersion
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Expand Down
8 changes: 4 additions & 4 deletions sdk/commerce/arm-commerce/src/pagingHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export interface PageInfo {
const pageMap = new WeakMap<object, PageInfo>();

/**
* Given a result page from a pageable operation, returns a
* continuation token that can be used to begin paging from
* Given the last `.value` produced by the `byPage` iterator,
* returns a continuation token that can be used to begin paging from
* that point later.
* @param page A result object from calling .byPage() on a paged operation.
* @returns The continuation token that can be passed into byPage().
* @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
* @returns The continuation token that can be passed into byPage() during future calls.
*/
export function getContinuationToken(page: unknown): string | undefined {
if (typeof page !== "object" || page === null) {
Expand Down
43 changes: 43 additions & 0 deletions sdk/commerce/arm-commerce/test/sampleTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/

import {
Recorder,
RecorderStartOptions,
env
} from "@azure-tools/test-recorder";
import { assert } from "chai";
import { Context } from "mocha";

const replaceableVariables: Record<string, string> = {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
SUBSCRIPTION_ID: "azure_subscription_id"
};

const recorderOptions: RecorderStartOptions = {
envSetupForPlayback: replaceableVariables
};

describe("My test", () => {
let recorder: Recorder;

beforeEach(async function(this: Context) {
recorder = new Recorder(this.currentTest);
await recorder.start(recorderOptions);
});

afterEach(async function() {
await recorder.stop();
});

it("sample test", async function() {
console.log("Hi, I'm a test!");
});
});
10 changes: 2 additions & 8 deletions sdk/commerce/arm-commerce/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@
],
"declaration": true,
"outDir": "./dist-esm",
"importHelpers": true,
"paths": {
"@azure/arm-commerce": [
"./src/index"
]
}
"importHelpers": true
},
"include": [
"./src/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
"./test/**/*.ts"
],
"exclude": [
"node_modules"
Expand Down