Update a Queue

👍

You're ready for this how-to guide if you've got the following:

A FreeClimb account
A registered application
A configured FreeClimb Number
Your tools and language installed


Node.js

The FreeClimb SDK provides a means to modify the alias or maxSize associated with a given queueId (queueId not provided in this example).

Create your package.json file and save in the root directory of your project:

{
  "name": "node-update-a-queue-how-to-guide",
  "version": "1.0.0",
  "license": "MIT",
  "dependencies": {
    "@freeclimb/sdk": "^3.8.0",
    "dotenv": "^8.1.0"
  }
}

Install the package by running the following in the command line/terminal:

yarn install

Example code:

require('dotenv').config()
const freeclimbSDK = require('@freeclimb/sdk')
const accountId = process.env.ACCOUNT_ID
const apiKey = process.env.API_KEY
const queueId = 'YOUR_QUEUE_ID'
const configuration = freeclimbSDK.createConfiguration({ accountId, apiKey })
const freeclimb = new freeclimbSDK.DefaultApi(configuration)
freeclimb.updateAQueue(queueId, { alias: 'New Name', maxSize: 100 })
  .then(queue => {
    console.log('updated queue', queue)
  }).catch(err => {
    console.log(err)
  })

Java

The QueuesRequester provides a means to modify the alias or maxSize associated with a given queueId.

Create your build.gradle file and save it to the root directory in your project:

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This is a general purpose Gradle build.
 * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds
 */

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    testCompile "junit:junit"
    compile 'com.github.FreeClimbAPI:FreeClimb-Java-SDK:3.0.0'
}

sourceSets {
    main {
        java {
            srcDirs = ['src'] // changed line
        }
    }
}

Build the file by running the following in your terminal/command line:

gradle build

Example code:

import com.vailsys.freeclimb.api.FreeClimbClient;
import com.vailsys.freeclimb.api.FreeClimbException;
import com.vailsys.freeclimb.api.queue.Queue;
import com.vailsys.freeclimb.api.queue.QueueUpdateOptions;
try {
     // Create FreeClimbClient object
     // accountId & apiKey can be found under API credentials on the FreeClimb Dashboard
     FreeClimbClient client = new FreeClimbClient(accountId, apiKey);
 
     // Options payload to change the alias and payload of the specified queue
     QueueUpdateOptions options = new QueueUpdateOptions();
     options.setAlias("Updated Alias");
     options.setMaxSize(12);
 
     // Invoke update method to modify the queue
     Queue queue = client.queues.update(queueId, options);
 
   } catch (FreeClimbException e) {
     // Exception throw upon failure
     System.out.println(e.getMessage());
   }

C#

The getQueuesRequester provides a means to modify the alias or maxSize associated with a given queueId.

Imports used:

using com.freeclimb.api;
using com.freeclimb.api.queue;

Example code:

// Create FreeClimbClient object
// Your account ID & api key can be found under API credentials on the FreeClimb Dashboard
FreeClimbClient client = new FreeClimbClient(getFreeClimbAccountId(),
                                     getFreeClimbApiKey());
 
QueueOptions options = new QueueOptions();
options.setAlias(alias);
options.setMaxSize(maxSize);
 
// Invoke get method to modify the queue
Queue queue = client.getQueuesRequester.update(queueId, options);