semrush-api-client 0.1.4 → 0.1.6

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.
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # semrush-api-client
2
2
  [![Version badge](https://img.shields.io/github/v/release/RenKoya1/semrush-api-client?include_prereleases)](https://github.com//RenKoya1/semrush-api-client)
3
+ [![npm version](https://img.shields.io/npm/v/semrush-api-client)](https://www.npmjs.com/package/semrush-api-client)
3
4
 
4
5
  A Node.js/TypeScript client for accessing the SEMrush API easily.
5
6
 
@@ -1,7 +1,9 @@
1
- import { getDomainRank } from "../domain/getDomainRank";
1
+ import { getDomainOverview } from "../overview/getDomainOverview";
2
2
  import { getPhraseAll } from "../keyword/getPhrase";
3
3
  import { backlinksOverview } from "../backlinks/backlinksOverview";
4
4
  import { getRankDifference } from "../overview/getRankDifference";
5
+ import { getDomainOrganic } from "../domain/getDomainOrganic";
6
+ import { getSemrushRank } from "../overview/getSemrushRank";
5
7
  export declare class SemrushAPIClient {
6
8
  private client;
7
9
  private api_key;
@@ -12,8 +14,10 @@ export declare class SemrushAPIClient {
12
14
  });
13
15
  parseCsvToObjects(csvString: string, delimiter?: string): Record<string, string>[];
14
16
  get<T>(url: string, params?: Record<string, any>, outputObj?: boolean): Promise<T>;
15
- getDomainRank: typeof getDomainRank;
17
+ getDomainOverview: typeof getDomainOverview;
16
18
  getPhrase: typeof getPhraseAll;
17
19
  backlinksOverview: typeof backlinksOverview;
18
20
  getRankDifference: typeof getRankDifference;
21
+ getSemrushRank: typeof getSemrushRank;
22
+ getDomainOrganic: typeof getDomainOrganic;
19
23
  }
@@ -5,10 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SemrushAPIClient = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
- const getDomainRank_1 = require("../domain/getDomainRank");
8
+ const getDomainOverview_1 = require("../overview/getDomainOverview");
9
9
  const getPhrase_1 = require("../keyword/getPhrase");
10
10
  const backlinksOverview_1 = require("../backlinks/backlinksOverview");
11
11
  const getRankDifference_1 = require("../overview/getRankDifference");
12
+ const getDomainOrganic_1 = require("../domain/getDomainOrganic");
13
+ const getSemrushRank_1 = require("../overview/getSemrushRank");
12
14
  class SemrushAPIClient {
13
15
  client;
14
16
  api_key;
@@ -17,7 +19,7 @@ class SemrushAPIClient {
17
19
  constructor({ api_key }) {
18
20
  this.api_key = api_key;
19
21
  this.client = axios_1.default.create({
20
- timeout: 5000,
22
+ timeout: 10000,
21
23
  });
22
24
  }
23
25
  parseCsvToObjects(csvString, delimiter = ";") {
@@ -54,9 +56,11 @@ class SemrushAPIClient {
54
56
  }
55
57
  }
56
58
  }
57
- getDomainRank = getDomainRank_1.getDomainRank;
59
+ getDomainOverview = getDomainOverview_1.getDomainOverview;
58
60
  getPhrase = getPhrase_1.getPhraseAll;
59
61
  backlinksOverview = backlinksOverview_1.backlinksOverview;
60
62
  getRankDifference = getRankDifference_1.getRankDifference;
63
+ getSemrushRank = getSemrushRank_1.getSemrushRank;
64
+ getDomainOrganic = getDomainOrganic_1.getDomainOrganic;
61
65
  }
62
66
  exports.SemrushAPIClient = SemrushAPIClient;
@@ -0,0 +1,15 @@
1
+ import { SemrushAPIClient } from "../client";
2
+ import { Database } from "../type/general/database";
3
+ type ExportColumns = "Ph" | "Po" | "Pp" | "Pd" | "Nq" | "Cp" | "Ur" | "Tr" | "Tg" | "Tc" | "Co" | "Nr" | "Td" | "Kd" | "Fp" | "Fk" | "Ts" | "In" | "Pt";
4
+ type displayPostions = "new" | "lost" | "rise" | "fall";
5
+ type displayPositionType = "organic" | "all" | "serp_features";
6
+ export declare function getDomainOrganic(this: SemrushAPIClient, { domain, export_columns, database, displayPosition, displayPositionsType, display_limit, outputObj, }: {
7
+ domain: string;
8
+ export_columns?: ExportColumns[];
9
+ displayPosition?: displayPostions;
10
+ database?: Database;
11
+ outputObj?: boolean;
12
+ displayPositionsType?: displayPositionType;
13
+ display_limit?: number;
14
+ }): Promise<string>;
15
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDomainOrganic = getDomainOrganic;
4
+ async function getDomainOrganic({ domain, export_columns = [
5
+ "Ph",
6
+ "Po",
7
+ "Pp",
8
+ "Pd",
9
+ "Nq",
10
+ "Cp",
11
+ "Ur",
12
+ "Tr",
13
+ "Tc",
14
+ "Co",
15
+ "Nr",
16
+ "Td",
17
+ ], database = "us", displayPosition, displayPositionsType, display_limit = 1000, outputObj = true, }) {
18
+ const params = {
19
+ type: "domain_organic",
20
+ export_columns: export_columns.join(","),
21
+ domain,
22
+ database,
23
+ display_position: displayPosition,
24
+ display_positions_type: displayPositionsType,
25
+ display_limit,
26
+ };
27
+ return this.get(this.BASE_URL, params, outputObj);
28
+ }
@@ -1,7 +1,7 @@
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 getDomainRank(this: SemrushAPIClient, { domain, export_columns, database, display_limit, outputObj, }: {
4
+ export declare function getDomainOverview(this: SemrushAPIClient, { domain, export_columns, database, display_limit, outputObj, }: {
5
5
  domain: string;
6
6
  export_columns?: ExportColumns[];
7
7
  database?: Database;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
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, outputObj = true, // Default to true for output object
3
+ exports.getDomainOverview = getDomainOverview;
4
+ async function getDomainOverview({ domain, export_columns = ["Dn", "Or", "Rk", "Ot", "Oc"], database = "us", display_limit = 1000, outputObj = true, // Default to true for output object
5
5
  }) {
6
6
  const params = {
7
7
  type: "domain_ranks",
@@ -0,0 +1,10 @@
1
+ import { SemrushAPIClient } from "../client";
2
+ import { Database } from "../type/general/database";
3
+ type ExportColumns = "Dn" | "Rk" | "Or" | "Ot" | "Oc" | "Ad" | "At" | "Ac" | "Sr" | "St" | "Sc";
4
+ export declare function getSemrushRank(this: SemrushAPIClient, { export_columns, database, display_limit, outputObj, }: {
5
+ export_columns?: ExportColumns[];
6
+ database?: Database;
7
+ display_limit?: number;
8
+ outputObj?: boolean;
9
+ }): Promise<string>;
10
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSemrushRank = getSemrushRank;
4
+ async function getSemrushRank({ export_columns = ["Dn", "Rk", "Or", "Ot", "Oc", "Ad", "At", "Ac"], database = "us", display_limit = 1000, outputObj = true, }) {
5
+ const params = {
6
+ type: "rank",
7
+ export_columns: export_columns.join(","),
8
+ database,
9
+ display_limit,
10
+ };
11
+ return this.get(this.BASE_URL, params, outputObj);
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semrush-api-client",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",