@gohighlevel/api-client
Version:
Official SDK for HighLevel Public APIs
77 lines • 2.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmailIsv = void 0;
/**
* EmailIsv Service
* Documentation for Email ISV API
*/
class EmailIsv {
constructor(httpClient) {
this.client = httpClient;
}
/**
* Email Verification
* Verify Email
*/
async verifyEmail(params, requestBody, options) {
let url = '/email/verify';
const queryParams = {};
const headerParams = {};
// Extract security requirements for this endpoint
const securityRequirements = ["Location-Access"];
if (params) {
if (params.locationId !== undefined) {
queryParams['locationId'] = params.locationId;
}
}
// Collect all parameters for token resolution (including path params)
const allParams = {};
if (params) {
if (params.locationId !== undefined) {
allParams['locationId'] = params.locationId;
}
}
const config = {
method: 'POST',
url,
params: queryParams,
headers: {
...headerParams,
...options?.headers
},
data: requestBody,
...options
};
// Get appropriate authorization token based on security requirements
const ghlInstance = this.client.__ghlInstance;
if (ghlInstance && typeof ghlInstance.getTokenForSecurity === 'function') {
try {
// Combine headerParams with headers from options
const combinedHeaders = {
...headerParams,
...options?.headers
};
// Combine queryParams with allParams for token resolution
const combinedQuery = {
...queryParams,
...allParams
};
const authToken = await ghlInstance.getTokenForSecurity(securityRequirements, combinedHeaders, combinedQuery, requestBody);
if (authToken) {
config.headers = {
...config.headers,
'Authorization': authToken
};
}
}
catch (error) {
throw error; // Re-throw authentication errors
}
}
const response = await this.client.request(config);
return response.data;
}
}
exports.EmailIsv = EmailIsv;
exports.default = EmailIsv;
//# sourceMappingURL=email-isv.js.map