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

@tryvital/vital-node

Package Overview
Dependencies
Maintainers
2
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tryvital/vital-node - npm Package Compare versions

Comparing version 2.1.5 to 2.1.6

192

client/LabTests.ts
import { AxiosInstance } from 'axios';
import {
ClientFacingLabTest,
LabResultsMetadata,
LabResultsResponse,
Order,
OrderRequestResponse,
PatientAdress,
PatientDetails,
Physician,
ClientFacingLabTest,
LabResultsMetadata,
LabResultsResponse,
Order,
OrderRequestResponse,
PatientAdress,
PatientDetails,
Physician,
} from './models/lab_tests_model';
export class OrdersApi {
baseURL: string;
client: AxiosInstance;
constructor(baseURL: string, axios: AxiosInstance) {
this.baseURL = baseURL;
this.client = axios;
}
baseURL: string;
client: AxiosInstance;
constructor(baseURL: string, axios: AxiosInstance) {
this.baseURL = baseURL;
this.client = axios;
}
// Create new order
public async create_order(
user_id: string,
patient_details: PatientDetails,
patient_address: PatientAdress,
lab_test_id: string,
physician?: Physician,
): Promise<OrderRequestResponse> {
const resp = await this.client.post(
this.baseURL.concat('/order'),
{
params: {
user_id: user_id,
patient_details: patient_details,
patient_address: patient_address,
lab_test_id: lab_test_id,
physician: physician ? physician : null
},
}
);
return resp.data;
}
// Create new order
public async create_order(
user_id: string,
patient_details: PatientDetails,
patient_address: PatientAdress,
lab_test_id: string,
physician?: Physician
): Promise<OrderRequestResponse> {
const resp = await this.client.post(this.baseURL.concat('/order'), {
user_id: user_id,
patient_details: patient_details,
patient_address: patient_address,
lab_test_id: lab_test_id,
physician: physician ? physician : null,
});
return resp.data;
}
// Get order status.
public async getOrder(orderId: string): Promise<Order> {
const resp = await this.client.get(
this.baseURL.concat(`/order/${orderId}`)
);
return resp.data;
}
// Get order status.
public async getOrder(orderId: string): Promise<Order> {
const resp = await this.client.get(
this.baseURL.concat(`/order/${orderId}`)
);
return resp.data;
}
// Cancels order.
public async cancelOrder(orderId: string): Promise<OrderRequestResponse> {
const resp = await this.client.post(
this.baseURL.concat(`/order/${orderId}/cancel`)
);
return resp.data;
}
// Cancels order.
public async cancelOrder(orderId: string): Promise<OrderRequestResponse> {
const resp = await this.client.post(
this.baseURL.concat(`/order/${orderId}/cancel`)
);
return resp.data;
}
}
export class ResultsApi {
baseURL: string;
client: AxiosInstance;
constructor(baseURL: string, axios: AxiosInstance) {
this.baseURL = baseURL;
this.client = axios;
}
// GET both metadata and raw json test data.
public async getResults(orderId: string): Promise<LabResultsResponse> {
const resp = await this.client.get(
this.baseURL.concat(`/order/${orderId}/result`)
);
return resp.data;
}
baseURL: string;
client: AxiosInstance;
constructor(baseURL: string, axios: AxiosInstance) {
this.baseURL = baseURL;
this.client = axios;
}
// GET both metadata and raw json test data.
public async getResults(orderId: string): Promise<LabResultsResponse> {
const resp = await this.client.get(
this.baseURL.concat(`/order/${orderId}/result`)
);
return resp.data;
}
// GET gets the lab result for the order in PDF format.
// TODO Check response type for PDF
public async getResultsPdf(orderId: string): Promise<string> {
const resp = await this.client.get(
this.baseURL.concat(`/order/${orderId}/result/pdf`)
);
return resp.data;
}
// GET gets the lab result for the order in PDF format.
// TODO Check response type for PDF
public async getResultsPdf(orderId: string): Promise<string> {
const resp = await this.client.get(
this.baseURL.concat(`/order/${orderId}/result/pdf`)
);
return resp.data;
}
// GET metadata related to order results, such as
// lab metadata, provider and sample dates.
public async getResultsMetadata(orderId: string): Promise<LabResultsMetadata> {
const resp = await this.client.get(
this.baseURL.concat(`/order/${orderId}/result/metadata`)
);
return resp.data;
}
// GET metadata related to order results, such as
// lab metadata, provider and sample dates.
public async getResultsMetadata(
orderId: string
): Promise<LabResultsMetadata> {
const resp = await this.client.get(
this.baseURL.concat(`/order/${orderId}/result/metadata`)
);
return resp.data;
}
}
export class LabTestsApi {
baseURL: string;
client: AxiosInstance;
Orders: OrdersApi;
Results: ResultsApi;
baseURL: string;
client: AxiosInstance;
Orders: OrdersApi;
Results: ResultsApi;
constructor(baseURL: string, axios: AxiosInstance) {
this.baseURL = baseURL;
this.client = axios;
this.Orders = new OrdersApi(baseURL, axios)
this.Results = new ResultsApi(baseURL, axios)
}
public async getTests(): Promise<ClientFacingLabTest> {
const resp = await this.client.get(
this.baseURL.concat(`/lab_tests`)
);
return resp.data;
}
}
constructor(baseURL: string, axios: AxiosInstance) {
this.baseURL = baseURL;
this.client = axios;
this.Orders = new OrdersApi(baseURL, axios);
this.Results = new ResultsApi(baseURL, axios);
}
public async getTests(): Promise<ClientFacingLabTest> {
const resp = await this.client.get(this.baseURL.concat(`/lab_tests`));
return resp.data;
}
}

@@ -7,3 +7,4 @@ export interface PatientAdress {

country: string;
street_number?: string;
first_line: string;
second_line?: string;
}

@@ -10,0 +11,0 @@

@@ -45,3 +45,3 @@ "use strict";

}
// Create new order
// Create new order
OrdersApi.prototype.create_order = function (user_id, patient_details, patient_address, lab_test_id, physician) {

@@ -53,9 +53,7 @@ return __awaiter(this, void 0, void 0, function () {

case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat('/order'), {
params: {
user_id: user_id,
patient_details: patient_details,
patient_address: patient_address,
lab_test_id: lab_test_id,
physician: physician ? physician : null
},
user_id: user_id,
patient_details: patient_details,
patient_address: patient_address,
lab_test_id: lab_test_id,
physician: physician ? physician : null,
})];

@@ -119,3 +117,3 @@ case 1:

};
// GET gets the lab result for the order in PDF format.
// GET gets the lab result for the order in PDF format.
// TODO Check response type for PDF

@@ -135,3 +133,3 @@ ResultsApi.prototype.getResultsPdf = function (orderId) {

};
// GET metadata related to order results, such as
// GET metadata related to order results, such as
// lab metadata, provider and sample dates.

@@ -138,0 +136,0 @@ ResultsApi.prototype.getResultsMetadata = function (orderId) {

@@ -7,3 +7,4 @@ export interface PatientAdress {

country: string;
street_number?: string;
first_line: string;
second_line?: string;
}

@@ -10,0 +11,0 @@ export interface PatientDetails {

{
"name": "@tryvital/vital-node",
"version": "2.1.5",
"version": "2.1.6",
"description": "Node client for Vital",

@@ -5,0 +5,0 @@ "author": "maitham",

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