async generateRequestHeaders(options={}) {
        const token = await this.getAccessToken();
        const headers = {
            'Content-Type': 'application/json; charset=utf-8',
            'Authorization': `Bearer ${token}`,
            'x-correlationId': this.generateCorrelationId(),
        }
        if (options.isPostRequest) {
            const payload = JSON.stringify(options.payload)
            headers['X-Idempotency-Key'] = this.generateIdempotencyKey(payload);
        }

        return headers;
    }
/**
     * You need some specific fields in the header when sending an API request.
     * Please pay attention to Correlation Id header.
     * 
     * If you are sending a post request, you will also need
     * "X-Idempotency-Key" header.
     * Please refer to generateIdempotencyKey() helper function for more detail.
     * 
     * Please remember that this is an async function since the function may
     * also generate an access token if necessary.
     * 
     * You may want to refer to the documentation for any further details or fields.
     * 
     * For more information, please visit:
     * [developer guide](https://developer-guide.sovos.com/connect-once-api/general-concepts/api-specifications)
     * 
     * @param {Object} [options={}] specify options for the headers
     * @param {boolean} [options.isPostRequest=false] specify whether it is a POST request
     * @param {Object} [options.payload] if it is a POST request, you must provide
     * the payload for an idempotency key to be generated.
     */
You need some specific fields in the header when sending an API request.
Please pay attention to Correlation Id header.

If you are sending a post request, you will also need
"X-Idempotency-Key" header.
Please refer to generateIdempotencyKey() helper function for more detail.

Please remember that this is an async function since the function may
also generate an access token if necessary.

You may want to refer to the documentation for any further details or fields.

For more information, please visit:
[developer guide]

@param {Object} [options={}] specify options for the headers
@param {boolean} [options.isPostRequest=false] specify whether it is a POST request
@param {Object} [options.payload] if it is a POST request, you must provide
the payload for an idempotency key to be generated.
You need some specific fields in the header when sending an API request . Please pay attention to Correlation Id header . If you are sending a post request you will also need " X - Idempotency - Key " header . Please refer to generateIdempotencyKey () helper function for more detail . Please remember that this is an async function since the function may also generate an access token if necessary . You may want to refer to the documentation for any further details or fields . For more information please visit : [ developer guide ] @param { Object } [ options = {} ] specify options for the headers @param { boolean } [ options . isPostRequest = false ] specify whether it is a POST request @param { Object } [ options . payload ] if it is a POST request you must provide the payload for an idempotency key to be generated .
async generateRequestHeaders(options={}) {
        const token = await this.getAccessToken();
        const headers = {
            'Content-Type': 'application/json; charset=utf-8',
            'Authorization': `Bearer ${token}`,
            'x-correlationId': this.generateCorrelationId(),
        }
        if (options.isPostRequest) {
            const payload = JSON.stringify(options.payload)
            headers['X-Idempotency-Key'] = this.generateIdempotencyKey(payload);
        }
        return headers;
    }
async generateRequestHeaders ( options = { } ) { const token = await this . getAccessToken ( ) ; const headers = { 'Content-Type' : 'application/json; charset=utf-8' , 'Authorization' : ` ${ token } ` , 'x-correlationId' : this . generateCorrelationId ( ) , } if ( options . isPostRequest ) { const payload = JSON . stringify ( options . payload ) headers [ 'X-Idempotency-Key' ] = this . generateIdempotencyKey ( payload ) ; } return headers ; }
You need some specific fields in the header when sending an API request.
You need some specific fields in the header when sending an API request .