"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/domain/delegates/rfpRequests/read.ts
var read_exports = {};
__export(read_exports, {
  readRfpRequest: () => readRfpRequest
});
module.exports = __toCommonJS(read_exports);
async function readRfpRequest(id, client) {
  console.log(`readRfpRequest id: ${id}`);
  const token = await client.auth.signIn();
  const apiKey = token.access_token;
  const headers = {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json"
  };
  const url = `${client.url}/api/v2/ontologies/${client.ontologyRid}/objects/RfpRequests/${id}`;
  const fetchResult = await fetch(url, {
    method: "GET",
    headers
  });
  const apiResponse = await fetchResult.json();
  if (apiResponse.errorCode) {
    console.log(`errorInstanceId: ${apiResponse.errorCode} errorName: ${apiResponse.errorName} errorCode: ${apiResponse.errorCode}`);
    throw new Error(`An error occurred while calling read RfpRequest errorInstanceId: ${apiResponse.errorInstanceId} errorCode: ${apiResponse.errorCode}`);
  }
  console.log(`the threads ontology returned: ${JSON.stringify(apiResponse)}`);
  return apiResponse;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  readRfpRequest
});
