Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@myinterview/global-api-sdk

Package Overview
Dependencies
Maintainers
5
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@myinterview/global-api-sdk

SDK to access myInterview Global API

  • 1.0.436
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
5
Weekly downloads
 
Created
Source

myInterview - GlobalAPI SDK

You can see the full typed documentation here.

Prerequisites

This project requires NodeJS (version 8 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.4.1
v8.16.0

Install

npm i @myinterview/global-api-sdk

Usage

Basic configuration

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.

Authentication Helper for API

populateHeaders

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.

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'
}

Responses (Regular/Error)

Standard Response
interface IApiResponseObj<T = any> {
  statusCode: number;
  errorCode: number;
  statusReason: string;
  callId: string;
  data?: T;
  time: Date | number;
}

IApiResponseObj

TypeFieldDescription
numberstatusCodeStatus code of the response
numbererrorCodeInternal error code
stringstatusReasonInfo message of the response
stringcallIdInternal call ID
anydataThis field contain the data required based on the request
Date / numbertimeTimestamp

This is the response object you will receive from the SDK the content of data will change based on your request.

Standard Error Response
interface IApiErrorObj {
  errorMessage: string | ValidationError[];
  errorDetails?: string;
  statusCode: number;
  errorCode: number;
  statusReason: string;
  callId?: string;
  time: Date | number;
}

IApiResponseObj

TypeFieldDescription
stringerrorMessageError message
string / undefinederrorDetailsError message details
numberstatusCodeStatus code of the response
numbererrorCodeInternal error code
stringstatusReasonInfo message of the response
stringcallIdInternal call ID
Date / numbertimeTimestamp

This is the error response object you will receive from the SDK.

Error Handling

You can catch the error the same way you catch error normally.

Async/Await
try {
  const res = await GAVideos.getVideoPersonality("");
} catch (error) {
  // The error will be of type IApiErrorObj the definition is above.
  console.log(error)
}
Callback
GAVideos.getVideoPersonality("").then((res) => {
  // Type IApiResponseObj 
}).catch((error) => {
  // The error will be of type IApiErrorObj the definition is above.
  console.log(error)
})

GACandidates

import { GACandidates } from '@myinterview/global-api-sdk';

createBulkCandidates

interface IBody {
  job_id: string;
  communication?: boolean;
  deadlineDate?: Date | string | number;
  timezoneForInvite?: string;
  candidates: {
    username?: string;
    email: string;
    phone?: string;
    status?: string;
    reminders?: {
      Content: string;
      companyName: string;
      greetings?: string;
      isSent: boolean;
      reminderDate: Date | string;
      timezone: string;
    }[];
    type?: string;
    candidate_id?: string;
    apiKey?: string;
    jobTitle?: string;
    urlStart?: string;
  }[];
};

await GACandidates.createBulkCandidates(body);

createBulkCandidates Params

createBulkCandidatesBody

TypeFieldDescription
stringjob_idID of the job to connect the candidate
boolean / undefinedcommunicationFlag to send mails with the creation
Date / string / number / undefineddeadlineDateDeadline date for the candidate/s
string / undefinedtimezoneForInviteTimezone for the deadline
Array of candidate objectcandidatesArray of candidate objects definition is above in the interface

This call will create one or more candidates and connect them to your Job.

updateCandidate

interface IBody {
  id: string; // You have to provide the id of the candidate
  status?: string;
  username?: string;
  deadline?: string | Date | number;
  timezoneForInvite?: string;
};

await GACandidates.updateCandidate(body);

updateCandidate Params

updateCandidateBody

TypeFieldDescription
stringidID of the candidate
string / undefinedstatusStatus of the candidate
string / undefinedusernameUsername of the candidate
Date / string / number / undefineddeadlineDeadline date for the candidate/s
string / undefinedtimezoneForInviteTimezone for the deadline

GACompanies

import { GACompanies } from '@myinterview/global-api-sdk';

getCompanyInfo

const res: IApiResponseObj<ICompany> = await GACompanies.getCompanyInfo();

const companyInfo = res.data;

getCompanyTemplates

const res: IApiResponseObj<ITemplate[]> = await GACompanies.getCompanyTemplates();

const templates = res.data;

createCompanyTemplateBulk

interface IBody {
  id?: string | number;
  hideQuestions?: boolean;
  name: string;
  questions: {
    numOfRetakes: number;
    partDuration: number;
    question: string;
    timeLimit?: number;
    videoQuestion?: string;
  }[];
  intoductionURL?: string;
}[]

await GACompanies.createCompanyTemplateBulk(body);

createCompanyTemplateBulk Params

createCompanyTemplateBulkBody

TypeFieldDescription
stringidID of the company template
boolean / undefinedhideQuestionshideQuestions flag
stringnameName of the template
string / undefinedintoductionURLUrl of the introduction video on the application page
Array of job questionsquestionsArray of job questions objects definition is above in the interface

GAJobs

import { GAJobs } from '@myinterview/global-api-sdk';

getCompanyInfo

const res: IApiResponseObj<IJob[]> = await GAJobs.getJobs();

const jobs = res.data;

getJobsWithIds

const ids: string[];

const res: IApiResponseObj<IJob[]> = await GAJobs.getJobsWithIds(ids);

const jobs = res.data;

getJob

const id: string;

const res: IApiResponseObj<IJob> = await GAJobs.getJob(id);

const job = res.data;

createJob

interface IBody {
  title: string;
  language?: string;
  overlay?: string;
  termsUrl?: string;
  privacyUrl?: string;
  backgroundImage?: string;
  transcriptLanguage?: string;
  config?: IJobConfig;
  deadlineDate?: string | Date | number;
  experience?: string;
  jobDescription?: string;
  logo?: string;
  questions?: IQuestion[];
  skills?: string[];
  introVideo?: string;
}

await GAJobs.createJob(body);

createJob Params

createJobBody

TypeFieldDescription
stringtitleTitle of the job
string / undefinedlanguageLanguage of the job
string / undefinedoverlayOverlay of the of the application page (Value in Color Hexa #000000)
string / undefinedtermsUrlUrl of the Terms of Service
string / undefinedprivacyUrlUrl of the Privacy
string / undefinedbackgroundImageBackground Image of the of the application page
string / undefinedtranscriptLanguageLanguage of the transcript video
Config ObjectconfigConfiguration object definition is above in the interface
Date / string / number / undefineddeadlineDateDeadline date for the job
string / undefinedexperienceexperience of the job
string / undefinedjobDescriptionJob description
string / undefinedlogoLogo
Array of job questionsquestionsArray of job questions objects definition is above in the interface
Array of string / undefinedskillsskills
string / undefinedintroVideointroduction video for application page

updateJob

interface IBody {
  job_id: string; // REQUIRED !
  language?: string;
  overlay?: string;
  termsUrl?: string;
  privacyUrl?: string;
  backgroundImage?: string;
  transcriptLanguage?: string;
  title?: string;
  config?: IJobConfig;
  deadlineDate?: string | Date | number;
  experience?: string;
  jobDescription?: string;
  logo?: string;
  questions?: IQuestion[];
  skills?: string[];
  introVideo?: string;
}

await GAJobs.updateJob(body);

updateJob Params

updateJobBody

TypeFieldDescription
stringjob_idID of the job
stringtitleTitle of the job
string / undefinedlanguageLanguage of the job
string / undefinedoverlayOverlay of the of the application page (Value in Color Hexa #000000)
string / undefinedtermsUrlUrl of the Terms of Service
string / undefinedprivacyUrlUrl of the Privacy
string / undefinedbackgroundImageBackground Image of the of the application page
string / undefinedtranscriptLanguageLanguage of the transcript video
Config ObjectconfigConfiguration object definition is above in the interface
Date / string / number / undefineddeadlineDateDeadline date for the job
string / undefinedexperienceexperience of the job
string / undefinedjobDescriptionJob description
string / undefinedlogoLogo
Array of job questionsquestionsArray of job questions objects definition is above in the interface
Array of string / undefinedskillsskills
string / undefinedintroVideointroduction video for application page

GAVideos

import { GAVideos } from '@myinterview/global-api-sdk';

getVideo

const id: string;

const res: IApiResponseObj<IVideo> = await GAVideos.getVideo(id);

const video = res.data;

getVideoPersonality

const id: string;

const res: IApiResponseObj<IPersonality> = await GAVideos.getVideoPersonality(id);

const personality = res.data;

Authors

  • Dvd1109

FAQs

Package last updated on 24 Oct 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc