Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@myinterview/global-api-sdk
Advanced tools
You can see the full typed documentation here.
This project requires NodeJS (version 14 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.
$ npm -v && node -v
6.14.15
v14.18.1
npm i @myinterview/global-api-sdk
:warning: Do not use this Node.js library in a front-end application. Doing so can expose your myInterview credentials to end-users as part of the bundled HTML/JavaScript sent to their browser.
import { GlobalApi } from '@myinterview/global-api-sdk';
GlobalApi.setConfig({
secret: 'yoursecret',
companyId: 'yourcompanyid',
accessKey: 'youraccesskey',
});
To use the SDK you have to set the configuration with the keys provided by myinterview prior use of the classes.
interface IApiResponseObj<T = any> {
statusCode: number;
errorCode: number;
statusReason: string;
callId: string;
data?: T;
time: Date | number;
}
IApiResponseObj
Type | Field | Description |
---|---|---|
number | statusCode | Status code of the response |
number | errorCode | Internal error code |
string | statusReason | Info message of the response |
string | callId | Internal call ID |
any | data | This field contain the data required based on the request |
Date / number | time | Timestamp |
This is the response object you will receive from the SDK the content of data will change based on your request.
interface IApiErrorObj {
errorMessage: string | ValidationError[];
errorDetails?: string;
statusCode: number;
errorCode: number;
statusReason: string;
callId?: string;
time: Date | number;
}
IApiResponseObj
Type | Field | Description |
---|---|---|
string | *errorMessage | Error message |
string | errorDetails | Error message details |
number | *statusCode | Status code of the response |
number | *errorCode | Internal error code |
string | *statusReason | Info message of the response |
string | *callId | Internal call ID |
Date / number | *time | Timestamp |
*required field |
This is the error response object you will receive from the SDK.
import { GAAnalytics } from '@myinterview/global-api-sdk';
const params = {
query: {
startDate: 1635776293000,
endDate: 1638109192000
}
}
const res: IApiResponseObj<{ watch_time: { video_id: string; time_watched: number }[] }> = await GAAnalytics.getVideoViewMinutesCount(params);
const analyticsData = res.data;
getVideoViewMinutesCount
Type | Field | Description |
---|---|---|
number | *startDate | Start Date in Epoch Time** milliseconds |
number | *endDate | End Date in Epoch Time** milliseconds |
*required field | ||
**if you need a timestamp converter, use this Website. |
const params = {
query: {
startDate: 1635776293000,
endDate: 1638109192000
}
}
const res: IApiResponseObj<{ videosGroupAndSumByDate: { date: string; videos_created: number }[] }> = await GAAnalytics.getVideoRecordedCount(params);
const analyticsData = res.data;
getVideoRecordedCount
Type | Field | Description |
---|---|---|
number | *startDate | Start Date in Epoch Time** milliseconds |
number | *endDate | End Date in Epoch Time** milliseconds |
*required field | ||
**if you need a timestamp converter, use this Website. |
getVideoViewMinutesCount
Type | Field | Description |
---|---|---|
number | *startDate | Start Date in Epoch Time** milliseconds |
number | *endDate | End Date in Epoch Time** milliseconds |
*required field | ||
**if you need a timestamp converter, use this Website. |
const params = {
query: {
startDate: 1635776293000,
endDate: 1638109192000
}
}
const res: IApiResponseObj<{
clicked: number;
started: number;
pending: number;
completed: number;
}> = await GAAnalytics.getCandidateStatusCount(params);
const analyticsData = res.data;
getCandidateStatusCount
Type | Field | Description |
---|---|---|
number | *startDate | Start Date in Epoch Time** milliseconds |
number | *endDate | End Date in Epoch Time** milliseconds |
*required field | ||
**if you need a timestamp converter, use this Website. |
import { GACandidates } from '@myinterview/global-api-sdk';
const res: IApiResponseObj<ICandidate> = await GACandidates.getCandidate('candidate_id');
const candidate = res.data;
const body = {
job_id: "job_id",
query: {
ids: ['candidate_id1', 'candidate_id2'],
email: 'email@email.com',
status: 'pending',
username: 'username',
skip: 0,
limit: 20,
}
};
const res: IApiResponseObj<ICandidate[]> = await GACandidates.getJobCandidates(body);
const candidates = res.data;
getJobCandidatesBody
Type | Field | Description |
---|---|---|
string | *job_id | ID of the job |
object | communication | Query object |
string array | query.ids | ids of candidates you need |
string | query.email | email of candidate you need |
string | query.status | status of the candidate enum (pending, clicked, completed, cancelled) |
string | query.username | username of candidate you need |
number | query.skip | Pagination |
number | query.limit | Pagination |
*required field |
const body = {
job_id: "job_id",
communication: false,
deadlineDate: "2021-10-20T08:42:59.537+00:00",
timezoneForInvite: "Australia/Sydney",
candidates: [{
username: "username",
email: "email@email.com",
jobTitle: "Job title",
}]
};
await GACandidates.createBulkCandidates(body);
createBulkCandidatesBody
Type | Field | Description |
---|---|---|
string | *job_id | ID of the job to connect the candidate |
boolean | communication | Flag to send mails with the creation |
Date / string / number | deadlineDate | Deadline date for the candidate/s |
string | timezoneForInvite | Timezone for the deadline |
Array of candidate object | *candidates | Array of candidate objects definition is above in the interface |
*required field |
This call will create one or more candidates and connect them to your Job.
const body = {
id: "candidate_id", // You have to provide the id of the candidate
username: "username",
email: "email@email.com",
jobTitle: "Job title",
};
await GACandidates.updateCandidate(body);
updateCandidateBody
Type | Field | Description |
---|---|---|
string | *id | ID of the candidate |
string | status | Status of the candidate |
string | username | Username of the candidate |
Date / string / number | deadline | Deadline date for the candidate/s |
string | timezoneForInvite | Timezone for the deadline |
*required field |
import { GACompanies } from '@myinterview/global-api-sdk';
const res: IApiResponseObj<ICompany> = await GACompanies.getCompanyInfo();
const companyInfo = res.data;
const res: IApiResponseObj<ITemplate[]> = await GACompanies.getCompanyTemplates();
const templates = res.data;
const body = [{
id: "template_id",
name: "template_name",
questions: [{
numOfRetakes: 1,
partDuration: 30,
question: "How are you today?"
}],
introVideo: 'youtube.com/watch'
},
{
id: "template_id",
name: "template_name",
questions: [{
numOfRetakes: 1,
partDuration: 30,
question: "How are you today?"
}],
introVideo: 'youtube.com/watch'
}]
await GACompanies.createCompanyTemplateBulk(body);
createCompanyTemplateBulkBody
Type | Field | Description |
---|---|---|
string | *id | ID of the company template |
boolean | hideQuestions | hideQuestions flag |
string | *name | Name of the template |
string | introVideo | Url of the introduction video on the application page |
Array of job questions | *questions | Array of job questions objects definition is above in the interface |
*required field |
import { GAJobs } from '@myinterview/global-api-sdk';
const res: IApiResponseObj<IJob[]> = await GAJobs.getJobs();
const jobs = res.data;
const ids: string[];
const res: IApiResponseObj<IJob[]> = await GAJobs.getJobsWithIds(ids);
const jobs = res.data;
const id: string;
const res: IApiResponseObj<IJob> = await GAJobs.getJob(id);
const job = res.data;
const body = {
title: "job_title",
language: 'en',
overlay: '#000000',
config: {
hideQuestions: true,
practice: true
},
jobDescription: 'jobDescription',
logo: "logo.url.com",
questions: [{
numOfRetakes: 1,
partDuration: 30,
question: "How are you today?"
}],
}
await GAJobs.createJob(body);
createJobBody
Type | Field | Description |
---|---|---|
string | *title | Title of the job |
string | language | Language of the job |
string | overlay | Overlay of the of the application page (Value in Color Hexa #000000) |
string | termsUrl | Url of the Terms of Service |
string | privacyUrl | Url of the Privacy |
string | backgroundImage | Background Image of the of the application page |
string | transcriptLanguage | Language of the transcript video |
Config Object | *config | Configuration object definition is above in the interface |
Date / string / number | deadlineDate | Deadline date for the job |
string | experience | experience of the job |
string | jobDescription | Job description |
string | logo | Logo |
Array of job questions | *questions | Array of job questions objects definition is above in the interface |
Array of string | skills | skills |
string | introVideo | introduction video for application page |
*required field |
const body = {
template_id: 'template_id',
title: "job_title",
language: 'en',
overlay: '#000000',
config: {
practice: true
},
jobDescription: 'jobDescription',
logo: "logo.url.com",
candidates: {
communication: true,
deadlineDate: "2021-10-20T08:42:59.537+00:00",
timezoneForInvite: "Australia/Sydney",
candidates: [{
username: "username",
email: "email@email.com",
}]
}
}
await GAJobs.createJobCandidatesWithTemplate(body);
createJobCandidatesWithTemplateBody
Type | Field | Description |
---|---|---|
string | *template_id | ID of the template |
string | title | Title of the job |
string | language | Language of the job |
string | overlay | Overlay of the of the application page (Value in Color Hexa #000000) |
string | termsUrl | Url of the Terms of Service |
string | privacyUrl | Url of the Privacy |
string | backgroundImage | Background Image of the of the application page |
string | transcriptLanguage | Language of the transcript video |
Config Object | config | Configuration object definition is above in the interface |
Date / string / number | deadlineDate | Deadline date for the job |
string | experience | experience of the job |
string | jobDescription | Job description |
string | logo | Logo |
Array of string | skills | skills |
string | introVideo | introduction video for application page |
*required field |
const body = {
job_id: 'job_id',
title: "job_title",
language: 'en',
overlay: '#000000',
config: {
hideQuestions: true,
practice: true
},
jobDescription: 'jobDescription',
logo: "logo.url.com",
questions: [{
numOfRetakes: 1,
partDuration: 30,
question: "How are you today?"
}],
}
await GAJobs.updateJob(body);
updateJobBody
Type | Field | Description |
---|---|---|
string | *job_id | ID of the job |
string | title | Title of the job |
string | language | Language of the job |
string | overlay | Overlay of the of the application page (Value in Color Hexa #000000) |
string | termsUrl | Url of the Terms of Service |
string | privacyUrl | Url of the Privacy |
string | backgroundImage | Background Image of the of the application page |
string | transcriptLanguage | Language of the transcript video |
Config Object | config | Configuration object definition is above in the interface |
Date / string / number | deadlineDate | Deadline date for the job |
string | experience | experience of the job |
string | jobDescription | Job description |
string | logo | Logo |
Array of job questions | questions | Array of job questions objects definition is above in the interface |
Array of string | skills | skills |
string | introVideo | introduction video for application page |
*required field |
import { GAVideos } from '@myinterview/global-api-sdk';
const id: string;
const res: IApiResponseObj<IVideo> = await GAVideos.getVideo(id);
const video = res.data;
const body = {
job_id: 'job_id',
query: { // This object is not mandatory
apiKey: 'apiKey',
clicked: true,
uploaded: true,
completed: true,
email: "email@example.com",
username: "exemple",
candidate_id: "candidate_id",
language: "en",
skip: 20,
limit: 20
}
}
const res: IApiResponseObj<IVideo[]> = await GAVideos.getJobVideos(body);
const videos = res.data;
getJobVideosBody
Type | Field | Description |
---|---|---|
string | *job_id | ID of the job |
Query Object | query | Query object definition is above in the interface |
*required field |
const id: string;
const res: IApiResponseObj<IPersonality> = await GAVideos.getVideoPersonality(id);
const personality = res.data;
You can catch the error the same way you catch error normally.
try {
const res = await GAVideos.getVideoPersonality("");
} catch (error) {
// The error will be of type IApiErrorObj the definition is above.
console.log(error)
}
GAVideos.getVideoPersonality("").then((res) => {
// Type IApiResponseObj
}).catch((error) => {
// The error will be of type IApiErrorObj the definition is above.
console.log(error)
})
This call will populate the headers you need to connect to the global API service it will return an object that you can use in you request. In order to authenticate to the API you need to populate the headers (x-myinterview-timestamp, x-myinterview-key, x-myinterview-signed) the populateHeaders method will return an object that you need to include in the headers config.
import { GlobalApi } from '@myinterview/global-api-sdk';
GlobalApi.populateHeaders({
secret: 'yoursecret',
companyId: 'yourcompanyid',
accessKey: 'youraccesskey',
});
It will return:
{
'x-myinterview-timestamp': 'headTimestamp',
'x-myinterview-key': 'headKey',
'x-myinterview-signed': 'headSigned'
}
FAQs
SDK to access myInterview Global API
The npm package @myinterview/global-api-sdk receives a total of 0 weekly downloads. As such, @myinterview/global-api-sdk popularity was classified as not popular.
We found that @myinterview/global-api-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.