Retool URL Builder Class

Hi everyone :wave:t2:

I made this for myself to compose Retool URLs and figured it might be useful to others too. Here it is as a gist.

There is a function to build a URL in one shot, or fluent / chainable interface if you prefer that.

Function

const testUrl = retoolUrl({
  domain: 'fancy-org',
  app: 'dummy-test',
  env: 'staging',
  version: '0.4.1',
  embed: true,
});

expect(testUrl.raw).toBe(
  'https://fancy-org.retool.com/app/dummy-test?_environment=staging&_releaseVersion=0.4.1&_embed=true'
);

Fluent

const testUrl = new RetoolURL('fancy-org')
  .app('dummy-test')
  .env('staging')   
  .version('0.4.1')
  .embed();

expect(testUrl.raw).toBe(
  'https://fancy-org.retool.com/app/dummy-test?_environment=staging&_releaseVersion=0.4.1&_embed=true'
);
2 Likes