import { ConfigureAPI } from "../baseWellsClient"; import { SummaryCount, SummaryItems, WaterDepthLimits, DateRange, MeasurementType, MeasurementTypeItems, DistanceRange, DoglegSeverityRange, WellPropertiesSummaryRequest, WellPropertiesSummaryItems, AngleRange, } from "src"; import { rethrowAsHttpError } from "../errorHandlingUtils"; import { DurationRange } from "src/model/durationRange"; export class SummariesAPI extends ConfigureAPI { public welltypes = async (): Promise => this.getSummary("/summaries/welltypes"); public datumLimits = async (): Promise => { const path: string = this.getPath("/summaries/datum"); return this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public waterDepthLimits = async (): Promise => { const path: string = this.getPath("/summaries/waterdepths"); return this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public spudDateLimits = async (): Promise => { const path: string = this.getPath("/summaries/spuddates"); return this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; private getSummary = async (prefix: string): Promise => { const path: string = this.getPath(prefix); return await this.client .asyncGet(path) .then((response) => response.data.items) .catch((err) => { throw rethrowAsHttpError(err); }); }; public measurementTypes = async (): Promise => { const path: string = this.getPath("/summaries/measurementtypes"); return await this.client .asyncGet(path) .then((response) => response.data.items) .catch((err) => { throw rethrowAsHttpError(err); }); }; public blocks = async (): Promise => this.getSummary("/summaries/blocks"); public fields = async (): Promise => this.getSummary("/summaries/fields"); public operators = async (): Promise => this.getSummary("/summaries/operators"); public quadrants = async (): Promise => this.getSummary("/summaries/quadrants"); public ndsRiskTypes = async (): Promise => this.getSummary("/summaries/nds/risktypes"); public nptCodes = async (): Promise => this.getSummary("/summaries/npt/codes"); /** * @deprecated Please use .nptCodeDetails() instead */ public nptDetailCodes = async (): Promise => this.getSummary("/summaries/npt/codedetails"); public nptCodeDetails = async (): Promise => this.getSummary("/summaries/npt/codedetails"); public regions = async (): Promise => this.getSummary("/summaries/regions"); public nptDurations = async (): Promise => { const path: string = this.getPath(`/summaries/npt/durations`); return this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public trajectoriesMeasuredDepthLimits = async (): Promise => { const path: string = this.getPath("/summaries/trajectories/measureddepth"); return this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public trajectoriesTrueVerticalDepthLimits = async (): Promise => { const path: string = this.getPath( "/summaries/trajectories/trueverticaldepth" ); return this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public trajectoriesDoglegSeverityLimits = async (): Promise => { const path: string = this.getPath( "/summaries/trajectories/doglegseverity" ); return this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public trajectoriesMaximumInclinationLimits = async (): Promise => { const path: string = this.getPath("/summaries/trajectories/inclination"); return this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public wellProperties = async ( request: WellPropertiesSummaryRequest ): Promise => { const path = this.getPath("/summaries/wellproperties"); return this.client .asyncPost(path, { data: request, }) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; }