semrush-api-client 0.1.0 → 0.1.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.
- package/README.md +1 -4
- package/package.json +1 -1
- package/dist/client/index.d.ts +0 -13
- package/dist/client/index.js +0 -29
- package/dist/domain/getDomainRank.d.ts +0 -9
- package/dist/domain/getDomainRank.js +0 -13
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -22
- package/dist/keyword/getPhrase.d.ts +0 -9
- package/dist/keyword/getPhrase.js +0 -12
- package/dist/type/general/database.d.ts +0 -1
- package/dist/type/general/database.js +0 -2
- package/dist/type/general/exportColumns.d.ts +0 -1
- package/dist/type/general/exportColumns.js +0 -2
package/README.md
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# semrush-api-client
|
|
2
|
-
|
|
3
|
-
[](https://github.com/RenKoya1/semrush-api-client/releases)
|
|
4
|
-
|
|
5
|
-
[](https://bundlephobia.com/package/semrush-api-client)
|
|
2
|
+
[](https://github.com//RenKoya1/semrush-api-client)
|
|
6
3
|
|
|
7
4
|
A Node.js/TypeScript client for accessing the SEMrush API easily.
|
|
8
5
|
|
package/package.json
CHANGED
package/dist/client/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { getDomainRank } from "../domain/getDomainRank";
|
|
2
|
-
import { getPhraseAll } from "../keyword/getPhrase";
|
|
3
|
-
export declare class SemrushAPIClient {
|
|
4
|
-
private client;
|
|
5
|
-
private api_key;
|
|
6
|
-
private BASE_URL;
|
|
7
|
-
constructor({ api_key }: {
|
|
8
|
-
api_key: string;
|
|
9
|
-
});
|
|
10
|
-
get<T>(url: string, params?: Record<string, any>): Promise<T>;
|
|
11
|
-
getDomainRank: typeof getDomainRank;
|
|
12
|
-
getPhrase: typeof getPhraseAll;
|
|
13
|
-
}
|
package/dist/client/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SemrushAPIClient = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const getDomainRank_1 = require("../domain/getDomainRank");
|
|
9
|
-
const getPhrase_1 = require("../keyword/getPhrase");
|
|
10
|
-
class SemrushAPIClient {
|
|
11
|
-
client;
|
|
12
|
-
api_key;
|
|
13
|
-
BASE_URL = "https://api.semrush.com/";
|
|
14
|
-
constructor({ api_key }) {
|
|
15
|
-
this.api_key = api_key;
|
|
16
|
-
this.client = axios_1.default.create({
|
|
17
|
-
baseURL: this.BASE_URL,
|
|
18
|
-
timeout: 5000,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
async get(url, params) {
|
|
22
|
-
const allParams = { ...params, key: this.api_key };
|
|
23
|
-
const response = await this.client.get(url, { params: allParams });
|
|
24
|
-
return response.data;
|
|
25
|
-
}
|
|
26
|
-
getDomainRank = getDomainRank_1.getDomainRank;
|
|
27
|
-
getPhrase = getPhrase_1.getPhraseAll;
|
|
28
|
-
}
|
|
29
|
-
exports.SemrushAPIClient = SemrushAPIClient;
|
|
@@ -1,9 +0,0 @@
|
|
|
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>;
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./client";
|
package/dist/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
21
|
-
dotenv_1.default.config();
|
|
22
|
-
__exportStar(require("./client"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SemrushAPIClient } from "../client";
|
|
2
|
-
import { Database } from "../type/general/database";
|
|
3
|
-
type KeywordExportColumns = "Dt" | "Db" | "Ph" | "Nq" | "Cp" | "Co" | "Nr" | "In" | "Kd";
|
|
4
|
-
export declare function getPhraseAll(this: SemrushAPIClient, { phrase, export_columns, database, }: {
|
|
5
|
-
phrase: string;
|
|
6
|
-
export_columns?: KeywordExportColumns[];
|
|
7
|
-
database?: Database;
|
|
8
|
-
}): Promise<string>;
|
|
9
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPhraseAll = getPhraseAll;
|
|
4
|
-
async function getPhraseAll({ phrase, export_columns = ["Dt", "Db", "Ph", "Nq", "Cp", "Co", "Nr"], database = "us", }) {
|
|
5
|
-
const params = {
|
|
6
|
-
type: "phrase_all",
|
|
7
|
-
export_columns: export_columns.join(","),
|
|
8
|
-
phrase,
|
|
9
|
-
database,
|
|
10
|
-
};
|
|
11
|
-
return this.get("", params);
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Database = "us" | "uk" | "ca" | "ru" | "de" | "fr" | "es" | "it" | "br" | "au" | "ar" | "be" | "ch" | "dk" | "fi" | "hk" | "ie" | "il" | "mx" | "nl" | "no" | "pl" | "se" | "sg" | "tr" | "jp" | "in" | "hu" | "af" | "al" | "dz" | "ao" | "am" | "at" | "az" | "bh" | "bd" | "by" | "bz" | "bo" | "ba" | "bw" | "bn" | "bg" | "cv" | "kh" | "cm" | "cl" | "co" | "cr" | "hr" | "cy" | "cz" | "cd" | "do" | "ec" | "eg" | "sv" | "ee" | "et" | "ge" | "gh" | "gr" | "gt" | "gy" | "ht" | "hn" | "is" | "id" | "jm" | "jo" | "kz" | "kw" | "lv" | "lb" | "lt" | "lu" | "mg" | "my" | "mt" | "mu" | "md" | "mn" | "me" | "ma" | "mz" | "na" | "np" | "nz" | "ni" | "ng" | "om" | "py" | "pe" | "ph" | "pt" | "ro" | "sa" | "sn" | "rs" | "sk" | "si" | "za" | "kr" | "lk" | "th" | "bs" | "tt" | "tn" | "ua" | "ae" | "uy" | "ve" | "vn" | "zm" | "zw" | "ly" | "mobile-us" | "mobile-uk" | "mobile-ca" | "mobile-de" | "mobile-fr" | "mobile-es" | "mobile-it" | "mobile-br" | "mobile-au" | "mobile-dk" | "mobile-mx" | "mobile-nl" | "mobile-se" | "mobile-tr" | "mobile-in" | "mobile-id" | "mobile-il" | "il-ext" | "tr-ext" | "dk-ext" | "no-ext" | "se-ext" | "fi-ext" | "ch-ext" | "mobile-il-ext" | "pa" | "pk" | "tw" | "qa";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ExportColumns = "Db" | "Dt" | "Dn" | "Rk" | "Or" | "Ot" | "Oc" | "Ad" | "At" | "Ac" | "Sh" | "Sv" | "FKn" | "FPn" | "Sr" | "Srb" | "St" | "Stb" | "Sc" | "Srn" | "Srl";
|