Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Text Analytics] Delete unused URL parsing helper #18357

Merged
merged 1 commit into from
Oct 26, 2021
Merged
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
1 change: 0 additions & 1 deletion sdk/textanalytics/ai-text-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
}
},
"browser": {
"./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js",
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
},
"scripts": {
Expand Down
25 changes: 0 additions & 25 deletions sdk/textanalytics/ai-text-analytics/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { RestError } from "@azure/core-rest-pipeline";
import { FullOperationResponse, OperationOptions, OperationSpec } from "@azure/core-client";
import { SpanStatusCode } from "@azure/core-tracing";
import { URL, URLSearchParams } from "./utils/url";
import { logger } from "./logger";
import { GeneratedClient, StringIndexType as GeneratedStringIndexType } from "./generated";
import { TextAnalyticsAction } from "./textAnalyticsAction";
Expand Down Expand Up @@ -186,30 +185,6 @@ export interface PageParam {
skip: number;
}

/**
* @internal
*/
export function nextLinkToTopAndSkip(nextLink: string): PageParam {
const url = new URL(nextLink);
const searchParams = new URLSearchParams(url.searchParams);
let top: number;
if (searchParams.has("$top")) {
top = parseInt(searchParams.get("$top")!);
} else {
throw new Error(`nextLink URL does not have the $top param: ${nextLink}`);
}
let skip: number;
if (searchParams.has("$skip")) {
skip = parseInt(searchParams.get("$skip")!);
} else {
throw new Error(`nextLink URL does not have the $skip param: ${nextLink}`);
}
return {
skip: skip,
top: top
};
}

/**
* @internal
*/
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions sdk/textanalytics/ai-text-analytics/src/utils/url.ts

This file was deleted.

11 changes: 1 addition & 10 deletions sdk/textanalytics/ai-text-analytics/test/internal/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { assert } from "chai";
import { parseActionError } from "../../src/analyzeActionsResult";
import { sortResponseIdObjects, nextLinkToTopAndSkip } from "../../src/util";
import { sortResponseIdObjects } from "../../src/util";

describe("util.sortByPreviousOrder", () => {
it("should sort outputs correctly", () => {
Expand All @@ -14,15 +14,6 @@ describe("util.sortByPreviousOrder", () => {
});
});

describe("util.nextLinkToTopAndSkip", () => {
it("should return top and skip correctly", () => {
const nextLink =
"https://somehost/text/analytics/v3.2-preview.1/entities/health/jobs/1ef2876d-a815-4927-9fc9-e6d5fbc6ce95?$skip=10&$top=5";
const result = nextLinkToTopAndSkip(nextLink);
assert.deepEqual(result, { skip: 10, top: 5 });
});
});

describe("AnalyzeActionsResult.parseActionError", () => {
it("parses entityRecognitionTasks pointer", () => {
const pointer = "#/tasks/entityRecognitionTasks/2";
Expand Down