javascript/NexarClient/nexarClient.js
/**
     * Make a request to the Nexar API
     * @param {string} gqlQuery - graphQL string containing the query/mutation.
     * @param {object} variables - key/value pairs for variables used in the gqlQuery.
     * @returns {object} - The Nexar API response
     */
Make a request to the Nexar API
@param {string} gqlQuery - graphQL string containing the query/mutation.
@param {object} variables - key/value pairs for variables used in the gqlQuery.
@returns {object} - The Nexar API response
Make a request to the Nexar API @param { string } gqlQuery - graphQL string containing the query / mutation . @param { object } variables - key / value pairs for variables used in the gqlQuery . @returns { object } - The Nexar API response
query(gqlQuery, variables) {
        this.#accessToken = this.#accessToken || this.#getAccessToken(this.#id, this.#secret)
        return this.#checkTokenExp()
            .then(token => {
                const options = {
                    hostname: this.hostName,
                    path: '/graphql',
                    method: 'POST',
                    headers: {
                        'Authorization': 'Bearer ' + token.access_token,
                        'Content-Type': 'application/json'
                    }
                }
                const data = {
                    'query': gqlQuery,
                    'variables': variables   
                }
                return getRequest(options, JSON.stringify(data))
            })
    }
query ( gqlQuery , variables ) { this . #accessToken = this . #accessToken || this . #getAccessToken ( this . #id , this . #secret ) return this . #checkTokenExp ( ) . then ( token => { const options = { hostname : this . hostName , path : '/graphql' , method : 'POST' , headers : { 'Authorization' : 'Bearer ' + token . access_token , 'Content-Type' : 'application/json' } } const data = { 'query' : gqlQuery , 'variables' : variables } return getRequest ( options , JSON . stringify ( data ) ) } ) }
Make a request to the Nexar API
 @param {string} gqlQuery - graphQL string containing the query/mutation.
Make a request to the Nexar API @param { string } gqlQuery - graphQL string containing the query / mutation .