semrush-api-client 0.1.24 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/backlinks/backlinksOverview.d.ts +4 -3
  2. package/dist/backlinks/backlinksOverview.js +5 -4
  3. package/dist/backlinks/getAnchors.d.ts +6 -4
  4. package/dist/backlinks/getAnchors.js +7 -5
  5. package/dist/backlinks/getBacklinks.d.ts +7 -4
  6. package/dist/backlinks/getBacklinks.js +8 -5
  7. package/dist/backlinks/getIndexedPages.d.ts +6 -4
  8. package/dist/backlinks/getIndexedPages.js +7 -5
  9. package/dist/backlinks/getReferringDomains.d.ts +7 -4
  10. package/dist/backlinks/getReferringDomains.js +8 -5
  11. package/dist/client/index.d.ts +2 -1
  12. package/dist/client/index.js +1 -0
  13. package/dist/domain/getAdsCopies.d.ts +10 -3
  14. package/dist/domain/getAdsCopies.js +13 -3
  15. package/dist/domain/getDomainOrganicSearchKeywords.d.ts +12 -5
  16. package/dist/domain/getDomainOrganicSearchKeywords.js +14 -4
  17. package/dist/domain/getDomainOverview.d.ts +8 -4
  18. package/dist/domain/getDomainOverview.js +12 -5
  19. package/dist/domain/getDomainPaidSearchKeywords.d.ts +11 -4
  20. package/dist/domain/getDomainPaidSearchKeywords.js +14 -4
  21. package/dist/domain/getDomainRank.d.ts +9 -0
  22. package/dist/domain/getDomainRank.js +13 -0
  23. package/dist/keyword/getBroadMatchKeywords.d.ts +7 -3
  24. package/dist/keyword/getBroadMatchKeywords.js +7 -3
  25. package/dist/keyword/getKeywordDifficulty.d.ts +4 -2
  26. package/dist/keyword/getKeywordDifficulty.js +4 -3
  27. package/dist/keyword/getKeywordOrganic.d.ts +17 -0
  28. package/dist/keyword/getKeywordOrganic.js +18 -0
  29. package/dist/keyword/getKeywordOverview.d.ts +5 -2
  30. package/dist/keyword/getKeywordOverview.js +9 -3
  31. package/dist/keyword/getPhrase.d.ts +9 -0
  32. package/dist/keyword/getPhrase.js +12 -0
  33. package/dist/keyword/getPhraseQuestions.d.ts +7 -3
  34. package/dist/keyword/getPhraseQuestions.js +7 -3
  35. package/dist/keyword/getRelatedKeywords.d.ts +7 -3
  36. package/dist/keyword/getRelatedKeywords.js +8 -4
  37. package/dist/keyword/index.d.ts +1 -0
  38. package/dist/keyword/index.js +3 -1
  39. package/dist/overview/getRankDifference.d.ts +9 -3
  40. package/dist/overview/getRankDifference.js +13 -4
  41. package/dist/overview/getSemrushRank.d.ts +8 -3
  42. package/dist/overview/getSemrushRank.js +12 -3
  43. package/dist/trend/getTrafficSummary.d.ts +5 -2
  44. package/dist/trend/getTrafficSummary.js +10 -4
  45. package/dist/url/getUrlOrganicSearchKeywords.d.ts +9 -4
  46. package/dist/url/getUrlOrganicSearchKeywords.js +14 -5
  47. package/dist/url/getUrlOverview.d.ts +6 -5
  48. package/dist/url/getUrlOverview.js +11 -6
  49. package/dist/url/getUrlPaidSearchKeywords.d.ts +9 -4
  50. package/dist/url/getUrlPaidSearchKeywords.js +14 -5
  51. package/dist/utils/displayDateValidator.d.ts +1 -0
  52. package/dist/utils/displayDateValidator.js +9 -0
  53. package/package.json +3 -2
@@ -1,9 +1,10 @@
1
1
  import { SemrushAPIClient } from "../client";
2
2
  export type BacklinksTargetType = "root_domain" | "domain" | "url";
3
3
  export type BacklinkstExportColumns = "ascore" | "total" | "domains_num" | "urls_num" | "ips_num" | "ipclassc_num" | "follows_num" | "nofollows_num" | "sponsored_num" | "ugc_num" | "texts_num" | "images_num" | "forms_num" | "frames_num";
4
- export declare function getBacklinksOverview(this: SemrushAPIClient, { target, target_type, export_columns, outputObj, }: {
4
+ export declare function getBacklinksOverview(this: SemrushAPIClient, { target, targetType, exportColumns, exportEscape, outputObj, }: {
5
5
  target: string;
6
- target_type?: BacklinksTargetType;
7
- export_columns?: BacklinkstExportColumns[];
6
+ targetType?: BacklinksTargetType;
7
+ exportColumns?: BacklinkstExportColumns[];
8
+ exportEscape?: 1;
8
9
  outputObj?: boolean;
9
10
  }): Promise<Record<string, string>[]>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBacklinksOverview = getBacklinksOverview;
4
- async function getBacklinksOverview({ target, target_type = "domain", export_columns = [
4
+ async function getBacklinksOverview({ target, targetType = "domain", exportColumns = [
5
5
  "ascore",
6
6
  "total",
7
7
  "domains_num",
@@ -16,12 +16,13 @@ async function getBacklinksOverview({ target, target_type = "domain", export_col
16
16
  "images_num",
17
17
  "forms_num",
18
18
  "frames_num",
19
- ], outputObj = true, }) {
19
+ ], exportEscape, outputObj = true, }) {
20
20
  const params = {
21
21
  type: "backlinks_overview",
22
22
  target,
23
- target_type,
24
- export_columns: export_columns.join(","),
23
+ target_type: targetType,
24
+ export_columns: exportColumns.join(","),
25
+ export_escape: exportEscape,
25
26
  };
26
27
  return this.get(this.ANALYTICS_URL + "v1/", params, outputObj);
27
28
  }
@@ -2,11 +2,13 @@ import { SemrushAPIClient } from "../client";
2
2
  export type AnchorsTargetType = "root_domain" | "domain" | "url";
3
3
  export type AnchorsExportColumns = "anchor" | "domains_num" | "backlinks_num" | "first_seen" | "last_seen";
4
4
  export type DisplaySort = "page_ascore_asc" | "page_ascore_desc" | "domains_num_asc" | "domains_num_desc" | "backlinks_num_asc" | "backlinks_num_desc" | "first_seen_asc" | "first_seen_desc" | "last_seen_asc" | "last_seen_desc";
5
- export declare function getAnchors(this: SemrushAPIClient, { target, target_type, export_columns, displaySort, display_limit, outputObj, }: {
5
+ export declare function getAnchors(this: SemrushAPIClient, { target, targetType, exportColumns, displaySort, displayLimit, displayOffset, exportEscape, outputObj, }: {
6
6
  target: string;
7
- target_type?: AnchorsTargetType;
8
- export_columns?: AnchorsExportColumns[];
7
+ targetType?: AnchorsTargetType;
8
+ exportColumns?: AnchorsExportColumns[];
9
9
  displaySort?: DisplaySort;
10
+ displayLimit?: number;
11
+ displayOffset?: number;
12
+ exportEscape?: 1;
10
13
  outputObj?: boolean;
11
- display_limit?: number;
12
14
  }): Promise<Record<string, string>[]>;
@@ -1,20 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAnchors = getAnchors;
4
- async function getAnchors({ target, target_type = "domain", export_columns = [
4
+ async function getAnchors({ target, targetType = "domain", exportColumns = [
5
5
  "anchor",
6
6
  "domains_num",
7
7
  "backlinks_num",
8
8
  "first_seen",
9
9
  "last_seen",
10
- ], displaySort = "backlinks_num_desc", display_limit = 10, outputObj = true, }) {
10
+ ], displaySort = "backlinks_num_desc", displayLimit = 10, displayOffset, exportEscape, outputObj = true, }) {
11
11
  const params = {
12
12
  type: "backlinks_anchors",
13
13
  target,
14
- target_type,
14
+ target_type: targetType,
15
15
  display_sort: displaySort,
16
- display_limit,
17
- export_columns: export_columns.join(","),
16
+ display_limit: displayLimit,
17
+ display_offset: displayOffset,
18
+ export_escape: exportEscape,
19
+ export_columns: exportColumns.join(","),
18
20
  };
19
21
  return this.get(this.ANALYTICS_URL + "v1/", params, outputObj);
20
22
  }
@@ -2,11 +2,14 @@ import { SemrushAPIClient } from "../client";
2
2
  export type BacklinksTargetType = "root_domain" | "domain" | "url";
3
3
  export type BacklinkstExportColumns = "page_ascore" | "response_code" | "source_size" | "external_num" | "internal_num" | "redirect_url" | "source_url" | "source_title" | "image_url" | "target_url" | "target_title" | "anchor" | "image_alt" | "last_seen" | "first_seen" | "nofollow" | "form" | "frame" | "image" | "sitewide" | "newlink" | "lostlink";
4
4
  export type DisplaySort = "page_ascore_asc" | "page_ascore_desc" | "last_seen_asc" | "last_seen_desc" | "first_seen_asc" | "first_seen_desc";
5
- export declare function getBacklinks(this: SemrushAPIClient, { target, target_type, export_columns, displaySort, display_limit, outputObj, }: {
5
+ export declare function getBacklinks(this: SemrushAPIClient, { target, targetType, exportColumns, displaySort, displayLimit, displayOffset, displayFilter, exportEscape, outputObj, }: {
6
6
  target: string;
7
- target_type?: BacklinksTargetType;
8
- export_columns?: BacklinkstExportColumns[];
7
+ targetType?: BacklinksTargetType;
8
+ exportColumns?: BacklinkstExportColumns[];
9
9
  displaySort?: DisplaySort;
10
+ displayLimit?: number;
11
+ displayOffset?: number;
12
+ displayFilter?: string;
13
+ exportEscape?: 1;
10
14
  outputObj?: boolean;
11
- display_limit?: number;
12
15
  }): Promise<Record<string, string>[]>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBacklinks = getBacklinks;
4
- async function getBacklinks({ target, target_type = "domain", export_columns = [
4
+ async function getBacklinks({ target, targetType = "domain", exportColumns = [
5
5
  "page_ascore",
6
6
  "response_code",
7
7
  "source_size",
@@ -24,14 +24,17 @@ async function getBacklinks({ target, target_type = "domain", export_columns = [
24
24
  "sitewide",
25
25
  "newlink",
26
26
  "lostlink",
27
- ], displaySort = "page_ascore_desc", display_limit = 10, outputObj = true, }) {
27
+ ], displaySort = "page_ascore_desc", displayLimit = 10, displayOffset, displayFilter, exportEscape, outputObj = true, }) {
28
28
  const params = {
29
29
  type: "backlinks",
30
30
  target,
31
- target_type,
31
+ target_type: targetType,
32
32
  display_sort: displaySort,
33
- display_limit,
34
- export_columns: export_columns.join(","),
33
+ display_limit: displayLimit,
34
+ display_offset: displayOffset,
35
+ display_filter: displayFilter,
36
+ export_escape: exportEscape,
37
+ export_columns: exportColumns.join(","),
35
38
  };
36
39
  return this.get(this.ANALYTICS_URL + "v1/", params, outputObj);
37
40
  }
@@ -2,11 +2,13 @@ import { SemrushAPIClient } from "../client";
2
2
  export type IndexedPageTargetType = "root_domain" | "domain" | "url";
3
3
  export type ExportColumns = "source_url" | "source_title" | "response_code" | "backlinks_num" | "domains_num" | "last_seen" | "external_num" | "internal_num";
4
4
  export type DisplaySort = "backlinks_num_asc" | "backlinks_num_desc" | "domains_num_asc" | "domains_num_desc" | "last_seen_asc" | "last_seen_desc";
5
- export declare function getIndexedPages(this: SemrushAPIClient, { target, target_type, export_columns, displaySort, display_limit, outputObj, }: {
5
+ export declare function getIndexedPages(this: SemrushAPIClient, { target, targetType, exportColumns, displaySort, displayLimit, displayOffset, exportEscape, outputObj, }: {
6
6
  target: string;
7
- target_type?: IndexedPageTargetType;
8
- export_columns?: ExportColumns[];
7
+ targetType?: IndexedPageTargetType;
8
+ exportColumns?: ExportColumns[];
9
9
  displaySort?: DisplaySort;
10
+ displayLimit?: number;
11
+ displayOffset?: number;
12
+ exportEscape?: 1;
10
13
  outputObj?: boolean;
11
- display_limit?: number;
12
14
  }): Promise<Record<string, string>[]>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getIndexedPages = getIndexedPages;
4
- async function getIndexedPages({ target, target_type = "domain", export_columns = [
4
+ async function getIndexedPages({ target, targetType = "domain", exportColumns = [
5
5
  "source_url",
6
6
  "source_title",
7
7
  "response_code",
@@ -10,14 +10,16 @@ async function getIndexedPages({ target, target_type = "domain", export_columns
10
10
  "last_seen",
11
11
  "external_num",
12
12
  "internal_num",
13
- ], displaySort = "backlinks_num_desc", display_limit = 10, outputObj = true, }) {
13
+ ], displaySort = "backlinks_num_desc", displayLimit = 10, displayOffset, exportEscape, outputObj = true, }) {
14
14
  const params = {
15
15
  type: "backlinks_pages",
16
16
  target,
17
- target_type,
17
+ target_type: targetType,
18
18
  display_sort: displaySort,
19
- display_limit,
20
- export_columns: export_columns.join(","),
19
+ display_limit: displayLimit,
20
+ display_offset: displayOffset,
21
+ export_escape: exportEscape,
22
+ export_columns: exportColumns.join(","),
21
23
  };
22
24
  return this.get(this.ANALYTICS_URL + "v1/", params, outputObj);
23
25
  }
@@ -2,11 +2,14 @@ import { SemrushAPIClient } from "../client";
2
2
  export type TargetType = "root_domain" | "domain" | "url";
3
3
  export type ExportColumns = "domain_ascore" | "domain_score" | "domain" | "backlinks_num" | "domain_trust_score" | "ip" | "country" | "first_seen" | "last_seen";
4
4
  export type DisplaySort = "domain_ascore_asc" | "domain_ascore_desc" | "backlinks_num_asc" | "backlinks_num_desc" | "last_seen_asc" | "last_seen_desc" | "first_seen_asc" | "first_seen_desc";
5
- export declare function getReferringDomains(this: SemrushAPIClient, { target, target_type, export_columns, displaySort, display_limit, outputObj, }: {
5
+ export declare function getReferringDomains(this: SemrushAPIClient, { target, targetType, exportColumns, displaySort, displayLimit, displayOffset, displayFilter, exportEscape, outputObj, }: {
6
6
  target: string;
7
- target_type?: TargetType;
8
- export_columns?: ExportColumns[];
7
+ targetType?: TargetType;
8
+ exportColumns?: ExportColumns[];
9
9
  displaySort?: DisplaySort;
10
+ displayLimit?: number;
11
+ displayOffset?: number;
12
+ displayFilter?: string;
13
+ exportEscape?: 1;
10
14
  outputObj?: boolean;
11
- display_limit?: number;
12
15
  }): Promise<Record<string, string>[]>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getReferringDomains = getReferringDomains;
4
- async function getReferringDomains({ target, target_type = "domain", export_columns = [
4
+ async function getReferringDomains({ target, targetType = "domain", exportColumns = [
5
5
  "domain_ascore",
6
6
  "domain_score",
7
7
  "domain",
@@ -11,14 +11,17 @@ async function getReferringDomains({ target, target_type = "domain", export_colu
11
11
  "country",
12
12
  "first_seen",
13
13
  "last_seen",
14
- ], displaySort = "backlinks_num_desc", display_limit = 10, outputObj = true, }) {
14
+ ], displaySort = "backlinks_num_desc", displayLimit = 10, displayOffset, displayFilter, exportEscape, outputObj = true, }) {
15
15
  const params = {
16
16
  type: "backlinks_refdomains",
17
17
  target,
18
- target_type,
18
+ target_type: targetType,
19
19
  display_sort: displaySort,
20
- display_limit,
21
- export_columns: export_columns.join(","),
20
+ display_limit: displayLimit,
21
+ display_offset: displayOffset,
22
+ display_filter: displayFilter,
23
+ export_escape: exportEscape,
24
+ export_columns: exportColumns.join(","),
22
25
  };
23
26
  return this.get(this.ANALYTICS_URL + "v1/", params, outputObj);
24
27
  }
@@ -1,5 +1,5 @@
1
1
  import { getDomainOverview, getDomainOrganicSearchKeywords, getDomainPaidSearchKeywords, getAdsCopies } from "../domain";
2
- import { getKeywordOverview, getKeywordDifficulty, getRelatedKeywords, getPhraseQuestions, getBroadMatchKeywords } from "../keyword";
2
+ import { getKeywordOverview, getKeywordDifficulty, getRelatedKeywords, getPhraseQuestions, getBroadMatchKeywords, getKeywordOrganic } from "../keyword";
3
3
  import { getBacklinksOverview, getBacklinks, getAnchors, getIndexedPages, getReferringDomains } from "../backlinks";
4
4
  import { getRankDifference, getSemrushRank } from "../overview";
5
5
  import { getTrafficSummary } from "../trend";
@@ -23,6 +23,7 @@ export declare class SemrushAPIClient {
23
23
  getRelatedKeywords: typeof getRelatedKeywords;
24
24
  getPhraseQuestions: typeof getPhraseQuestions;
25
25
  getBroadMatchKeywords: typeof getBroadMatchKeywords;
26
+ getKeywordOrganic: typeof getKeywordOrganic;
26
27
  getBacklinksOverview: typeof getBacklinksOverview;
27
28
  getBacklinks: typeof getBacklinks;
28
29
  getAnchors: typeof getAnchors;
@@ -67,6 +67,7 @@ class SemrushAPIClient {
67
67
  getRelatedKeywords = keyword_1.getRelatedKeywords;
68
68
  getPhraseQuestions = keyword_1.getPhraseQuestions;
69
69
  getBroadMatchKeywords = keyword_1.getBroadMatchKeywords;
70
+ getKeywordOrganic = keyword_1.getKeywordOrganic;
70
71
  // Backlinks methods
71
72
  getBacklinksOverview = backlinks_1.getBacklinksOverview;
72
73
  getBacklinks = backlinks_1.getBacklinks;
@@ -1,11 +1,18 @@
1
1
  import { SemrushAPIClient } from "../client";
2
2
  import { Database } from "../type/general/database";
3
3
  type ExportColumns = "Tt" | "Ds" | "Vu" | "Ur" | "Pc" | "Un";
4
- export declare function getAdsCopies(this: SemrushAPIClient, { domain, export_columns, database, display_limit, outputObj, }: {
4
+ export type AdsCopiesDisplaySort = "tr_asc" | "tr_desc" | "tc_asc" | "tc_desc";
5
+ export declare function getAdsCopies(this: SemrushAPIClient, { domain, exportColumns, database, displayLimit, displayOffset, displaySort, displayFilter, displayDate, exportEscape, exportDecode, outputObj, }: {
5
6
  domain: string;
6
- export_columns?: ExportColumns[];
7
+ exportColumns?: ExportColumns[];
7
8
  database?: Database;
9
+ displayLimit?: number;
10
+ displayOffset?: number;
11
+ displaySort?: AdsCopiesDisplaySort;
12
+ displayFilter?: string;
13
+ displayDate?: string;
14
+ exportEscape?: 1;
15
+ exportDecode?: 0 | 1;
8
16
  outputObj?: boolean;
9
- display_limit?: number;
10
17
  }): Promise<Record<string, string>[]>;
11
18
  export {};
@@ -1,13 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAdsCopies = getAdsCopies;
4
- async function getAdsCopies({ domain, export_columns = ["Tt", "Ds", "Vu", "Ur", "Pc", "Un"], database = "us", display_limit = 10, outputObj = true, }) {
4
+ const displayDateValidator_1 = require("../utils/displayDateValidator");
5
+ async function getAdsCopies({ domain, exportColumns = ["Tt", "Ds", "Vu", "Ur", "Pc", "Un"], database = "us", displayLimit = 10, displayOffset, displaySort, displayFilter, displayDate, exportEscape, exportDecode, outputObj = true, }) {
6
+ if (displayDate && !(0, displayDateValidator_1.displayDateValidator)(displayDate)) {
7
+ throw new Error("Invalid displayDate format. Format: YYYYMM15");
8
+ }
5
9
  const params = {
6
10
  type: "domain_adwords_unique",
7
- export_columns: export_columns.join(","),
11
+ export_columns: exportColumns.join(","),
8
12
  domain,
9
13
  database,
10
- display_limit,
14
+ display_limit: displayLimit,
15
+ display_offset: displayOffset,
16
+ display_sort: displaySort,
17
+ display_filter: displayFilter,
18
+ display_date: displayDate,
19
+ export_escape: exportEscape,
20
+ export_decode: exportDecode,
11
21
  };
12
22
  return this.get(this.BASE_URL, params, outputObj);
13
23
  }
@@ -3,13 +3,20 @@ import { Database } from "../type/general/database";
3
3
  type ExportColumns = "Ph" | "Po" | "Pp" | "Pd" | "Nq" | "Cp" | "Ur" | "Tr" | "Tg" | "Tc" | "Co" | "Nr" | "Td" | "Kd" | "Fp" | "Fk" | "Ts" | "In" | "Pt";
4
4
  type displayPositions = "new" | "lost" | "rise" | "fall";
5
5
  type displayPositionType = "organic" | "all" | "serp_features";
6
- export declare function getDomainOrganicSearchKeywords(this: SemrushAPIClient, { domain, export_columns, database, displayPosition, displayPositionsType, display_limit, outputObj, }: {
6
+ export type DomainOrganicDisplaySort = "po_asc" | "po_desc" | "tr_asc" | "tr_desc" | "tc_asc" | "tc_desc" | "nq_asc" | "nq_desc" | "cp_asc" | "cp_desc" | "co_asc" | "co_desc" | "kd_asc" | "kd_desc";
7
+ export declare function getDomainOrganicSearchKeywords(this: SemrushAPIClient, { domain, exportColumns, database, displayPosition, displayPositionsType, displayLimit, displayOffset, displaySort, displayFilter, displayDate, exportEscape, exportDecode, outputObj, }: {
7
8
  domain: string;
8
- export_columns?: ExportColumns[];
9
- displayPosition?: displayPositions;
9
+ exportColumns?: ExportColumns[];
10
10
  database?: Database;
11
- outputObj?: boolean;
11
+ displayPosition?: displayPositions;
12
12
  displayPositionsType?: displayPositionType;
13
- display_limit?: number;
13
+ displayLimit?: number;
14
+ displayOffset?: number;
15
+ displaySort?: DomainOrganicDisplaySort;
16
+ displayFilter?: string;
17
+ displayDate?: string;
18
+ exportEscape?: 1;
19
+ exportDecode?: 0 | 1;
20
+ outputObj?: boolean;
14
21
  }): Promise<Record<string, string>[]>;
15
22
  export {};
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDomainOrganicSearchKeywords = getDomainOrganicSearchKeywords;
4
- async function getDomainOrganicSearchKeywords({ domain, export_columns = [
4
+ const displayDateValidator_1 = require("../utils/displayDateValidator");
5
+ async function getDomainOrganicSearchKeywords({ domain, exportColumns = [
5
6
  "Ph",
6
7
  "Po",
7
8
  "Pp",
@@ -14,15 +15,24 @@ async function getDomainOrganicSearchKeywords({ domain, export_columns = [
14
15
  "Co",
15
16
  "Nr",
16
17
  "Td",
17
- ], database = "us", displayPosition, displayPositionsType, display_limit = 10, outputObj = true, }) {
18
+ ], database = "us", displayPosition, displayPositionsType, displayLimit = 10, displayOffset, displaySort, displayFilter, displayDate, exportEscape, exportDecode, outputObj = true, }) {
19
+ if (displayDate && !(0, displayDateValidator_1.displayDateValidator)(displayDate)) {
20
+ throw new Error("Invalid displayDate format. Format: YYYYMM15");
21
+ }
18
22
  const params = {
19
23
  type: "domain_organic",
20
- export_columns: export_columns.join(","),
24
+ export_columns: exportColumns.join(","),
21
25
  domain,
22
26
  database,
23
27
  display_position: displayPosition,
24
28
  display_positions_type: displayPositionsType,
25
- display_limit,
29
+ display_limit: displayLimit,
30
+ display_offset: displayOffset,
31
+ display_sort: displaySort,
32
+ display_filter: displayFilter,
33
+ display_date: displayDate,
34
+ export_escape: exportEscape,
35
+ export_decode: exportDecode,
26
36
  };
27
37
  return this.get(this.BASE_URL, params, outputObj);
28
38
  }
@@ -1,11 +1,15 @@
1
1
  import { SemrushAPIClient } from "../client";
2
2
  import { Database } from "../type/general/database";
3
3
  import { ExportColumns } from "../type/general/exportColumns";
4
- export declare function getDomainOverview(this: SemrushAPIClient, { domain, export_columns, database, displayDate, display_limit, outputObj, }: {
4
+ export type DomainOverviewDisplaySort = "rk_asc" | "rk_desc" | "or_asc" | "or_desc" | "ot_asc" | "ot_desc" | "oc_asc" | "oc_desc" | "ad_asc" | "ad_desc" | "at_asc" | "at_desc" | "ac_asc" | "ac_desc";
5
+ export declare function getDomainOverview(this: SemrushAPIClient, { domain, exportColumns, database, displayDate, displayLimit, displayOffset, displaySort, exportEscape, outputObj, }: {
5
6
  domain: string;
6
- export_columns?: ExportColumns[];
7
+ exportColumns?: ExportColumns[];
7
8
  database?: Database;
8
- display_limit?: number;
9
- outputObj?: boolean;
10
9
  displayDate?: string;
10
+ displayLimit?: number;
11
+ displayOffset?: number;
12
+ displaySort?: DomainOverviewDisplaySort;
13
+ exportEscape?: 1;
14
+ outputObj?: boolean;
11
15
  }): Promise<Record<string, string>[]>;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDomainOverview = getDomainOverview;
4
- async function getDomainOverview({ domain, export_columns = [
4
+ const displayDateValidator_1 = require("../utils/displayDateValidator");
5
+ async function getDomainOverview({ domain, exportColumns = [
5
6
  "Db",
6
7
  "Dt",
7
8
  "Dn",
@@ -23,14 +24,20 @@ async function getDomainOverview({ domain, export_columns = [
23
24
  "Sc",
24
25
  "Srn",
25
26
  "Srl",
26
- ], database = "us", displayDate, display_limit = 10, outputObj = true, }) {
27
+ ], database = "us", displayDate, displayLimit = 10, displayOffset, displaySort, exportEscape, outputObj = true, }) {
28
+ if (displayDate && !(0, displayDateValidator_1.displayDateValidator)(displayDate)) {
29
+ throw new Error("Invalid displayDate format. Format: YYYYMM15");
30
+ }
27
31
  const params = {
28
32
  type: "domain_ranks",
29
- export_columns: export_columns.join(","),
33
+ export_columns: exportColumns.join(","),
30
34
  domain,
31
35
  database,
32
- displayDate: displayDate,
33
- display_limit,
36
+ display_date: displayDate,
37
+ display_limit: displayLimit,
38
+ display_offset: displayOffset,
39
+ display_sort: displaySort,
40
+ export_escape: exportEscape,
34
41
  };
35
42
  return this.get(this.BASE_URL, params, outputObj);
36
43
  }
@@ -2,12 +2,19 @@ import { SemrushAPIClient } from "../client";
2
2
  import { Database } from "../type/general/database";
3
3
  type ExportColumns = "Ph" | "Po" | "Pp" | "Pd" | "Ab" | "Nq" | "Cp" | "Ur" | "Tr" | "Tg" | "Tc" | "Co" | "Nr" | "Td" | "Tt" | "Ds" | "Vu" | "Ur" | "Ts" | "Un";
4
4
  type displayPositions = "new" | "lost" | "rise" | "fall";
5
- export declare function getDomainPaidSearchKeywords(this: SemrushAPIClient, { domain, export_columns, database, displayPosition, display_limit, outputObj, }: {
5
+ export type DomainPaidDisplaySort = "po_asc" | "po_desc" | "tr_asc" | "tr_desc" | "tc_asc" | "tc_desc" | "nq_asc" | "nq_desc" | "cp_asc" | "cp_desc" | "co_asc" | "co_desc";
6
+ export declare function getDomainPaidSearchKeywords(this: SemrushAPIClient, { domain, exportColumns, database, displayPosition, displayLimit, displayOffset, displaySort, displayFilter, displayDate, exportEscape, exportDecode, outputObj, }: {
6
7
  domain: string;
7
- export_columns?: ExportColumns[];
8
- displayPosition?: displayPositions;
8
+ exportColumns?: ExportColumns[];
9
9
  database?: Database;
10
+ displayPosition?: displayPositions;
11
+ displayLimit?: number;
12
+ displayOffset?: number;
13
+ displaySort?: DomainPaidDisplaySort;
14
+ displayFilter?: string;
15
+ displayDate?: string;
16
+ exportEscape?: 1;
17
+ exportDecode?: 0 | 1;
10
18
  outputObj?: boolean;
11
- display_limit?: number;
12
19
  }): Promise<Record<string, string>[]>;
13
20
  export {};
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDomainPaidSearchKeywords = getDomainPaidSearchKeywords;
4
- async function getDomainPaidSearchKeywords({ domain, export_columns = [
4
+ const displayDateValidator_1 = require("../utils/displayDateValidator");
5
+ async function getDomainPaidSearchKeywords({ domain, exportColumns = [
5
6
  "Ph",
6
7
  "Po",
7
8
  "Pp",
@@ -14,14 +15,23 @@ async function getDomainPaidSearchKeywords({ domain, export_columns = [
14
15
  "Co",
15
16
  "Nr",
16
17
  "Td",
17
- ], database = "us", displayPosition, display_limit = 1000, outputObj = true, }) {
18
+ ], database = "us", displayPosition, displayLimit = 1000, displayOffset, displaySort, displayFilter, displayDate, exportEscape, exportDecode, outputObj = true, }) {
19
+ if (displayDate && !(0, displayDateValidator_1.displayDateValidator)(displayDate)) {
20
+ throw new Error("Invalid displayDate format. Format: YYYYMM15");
21
+ }
18
22
  const params = {
19
23
  type: "domain_adwords",
20
- export_columns: export_columns.join(","),
24
+ export_columns: exportColumns.join(","),
21
25
  domain,
22
26
  database,
23
27
  display_position: displayPosition,
24
- display_limit,
28
+ display_limit: displayLimit,
29
+ display_offset: displayOffset,
30
+ display_sort: displaySort,
31
+ display_filter: displayFilter,
32
+ display_date: displayDate,
33
+ export_escape: exportEscape,
34
+ export_decode: exportDecode,
25
35
  };
26
36
  return this.get(this.BASE_URL, params, outputObj);
27
37
  }
@@ -0,0 +1,9 @@
1
+ import { SemrushAPIClient } from "../client";
2
+ import { Database } from "../type/general/database";
3
+ import { ExportColumns } from "../type/general/exportColumns";
4
+ export declare function getDomainRank(this: SemrushAPIClient, { domain, export_columns, database, display_limit, }: {
5
+ domain: string;
6
+ export_columns?: ExportColumns[];
7
+ database?: Database;
8
+ display_limit?: number;
9
+ }): Promise<string>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDomainRank = getDomainRank;
4
+ async function getDomainRank({ domain, export_columns = ["Dn", "Or", "Rk", "Ot", "Oc"], database = "us", display_limit = 1000, }) {
5
+ const params = {
6
+ type: "domain_ranks",
7
+ export_columns: export_columns.join(","),
8
+ domain,
9
+ database,
10
+ display_limit,
11
+ };
12
+ return this.get("", params);
13
+ }
@@ -2,11 +2,15 @@ import { SemrushAPIClient } from "../client";
2
2
  import { Database } from "../type/general/database";
3
3
  export type ExportColumns = "Ph" | "Nq" | "Cp" | "Co" | "Nr" | "Td" | "Fk" | "In" | "Kd";
4
4
  export type DisplaySort = "nq_asc" | "nq_desc" | "cp_asc" | "cp_desc" | "co_asc" | "co_desc" | "nr_asc" | "nr_desc" | "kd_asc" | "kd_desc";
5
- export declare function getBroadMatchKeywords(this: SemrushAPIClient, { phrase, export_columns, database, displaySort, display_limit, outputObj, }: {
5
+ export declare function getBroadMatchKeywords(this: SemrushAPIClient, { phrase, exportColumns, database, displaySort, displayLimit, displayOffset, displayFilter, exportEscape, exportDecode, outputObj, }: {
6
6
  phrase: string;
7
7
  database?: Database;
8
- export_columns?: ExportColumns[];
8
+ exportColumns?: ExportColumns[];
9
9
  displaySort?: DisplaySort;
10
+ displayLimit?: number;
11
+ displayOffset?: number;
12
+ displayFilter?: string;
13
+ exportEscape?: 1;
14
+ exportDecode?: 0 | 1;
10
15
  outputObj?: boolean;
11
- display_limit?: number;
12
16
  }): Promise<Record<string, string>[]>;
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBroadMatchKeywords = getBroadMatchKeywords;
4
- async function getBroadMatchKeywords({ phrase, export_columns = ["Ph", "Nq", "Cp", "Co", "Nr", "Td", "In", "Kd"], database = "us", displaySort = "nq_desc", display_limit = 10, outputObj = true, }) {
4
+ async function getBroadMatchKeywords({ phrase, exportColumns = ["Ph", "Nq", "Cp", "Co", "Nr", "Td", "In", "Kd"], database = "us", displaySort = "nq_desc", displayLimit = 10, displayOffset, displayFilter, exportEscape, exportDecode, outputObj = true, }) {
5
5
  const params = {
6
6
  type: "phrase_fullsearch",
7
7
  phrase,
8
8
  database,
9
9
  display_sort: displaySort,
10
- display_limit,
11
- export_columns: export_columns.join(","),
10
+ display_limit: displayLimit,
11
+ display_offset: displayOffset,
12
+ display_filter: displayFilter,
13
+ export_escape: exportEscape,
14
+ export_decode: exportDecode,
15
+ export_columns: exportColumns.join(","),
12
16
  };
13
17
  return this.get(this.ANALYTICS_URL, params, outputObj);
14
18
  }
@@ -1,10 +1,12 @@
1
1
  import { SemrushAPIClient } from "../client";
2
2
  import { Database } from "../type/general/database";
3
3
  type ExportColumns = "Ph" | "Kd";
4
- export declare function getKeywordDifficulty(this: SemrushAPIClient, { phrases, export_columns, database, outputObj, }: {
4
+ export declare function getKeywordDifficulty(this: SemrushAPIClient, { phrases, exportColumns, database, exportEscape, exportDecode, outputObj, }: {
5
5
  phrases: string[];
6
- export_columns?: ExportColumns[];
6
+ exportColumns?: ExportColumns[];
7
7
  database?: Database;
8
+ exportEscape?: 1;
9
+ exportDecode?: 0 | 1;
8
10
  outputObj?: boolean;
9
11
  }): Promise<Record<string, string>[]>;
10
12
  export {};
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getKeywordDifficulty = getKeywordDifficulty;
4
- async function getKeywordDifficulty({ phrases, export_columns = ["Ph", "Kd"], database = "us", outputObj = true, // Default to true for output object
5
- }) {
4
+ async function getKeywordDifficulty({ phrases, exportColumns = ["Ph", "Kd"], database = "us", exportEscape, exportDecode, outputObj = true, }) {
6
5
  const params = {
7
6
  type: "phrase_kdi",
8
- export_columns: export_columns.join(","),
7
+ export_columns: exportColumns.join(","),
9
8
  phrase: phrases.join(";"),
10
9
  database,
10
+ export_escape: exportEscape,
11
+ export_decode: exportDecode,
11
12
  };
12
13
  return this.get(this.BASE_URL, params, outputObj);
13
14
  }
@@ -0,0 +1,17 @@
1
+ import { SemrushAPIClient } from "../client";
2
+ import { Database } from "../type/general/database";
3
+ type KeywordExportColumns = "Po" | "Pt" | "Dn" | "Ur" | "Fk" | "Fp" | "Fl";
4
+ export type KeywordOrganicDisplaySort = "po_asc" | "po_desc" | "tr_asc" | "tr_desc";
5
+ export declare function getKeywordOrganic(this: SemrushAPIClient, { phrase, exportColumns, database, displayLimit, displayOffset, displaySort, displayFilter, exportEscape, exportDecode, outputObj, }: {
6
+ phrase: string;
7
+ exportColumns?: KeywordExportColumns[];
8
+ database?: Database;
9
+ displayLimit?: number;
10
+ displayOffset?: number;
11
+ displaySort?: KeywordOrganicDisplaySort;
12
+ displayFilter?: string;
13
+ exportEscape?: 1;
14
+ exportDecode?: 0 | 1;
15
+ outputObj?: boolean;
16
+ }): Promise<Record<string, string>[]>;
17
+ export {};