Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added configurability of scheme #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quickbase",
"version": "6.0.0",
"version": "6.0.1",
"description": "A lightweight, typed, promise-based Quickbase API, autogenerated from the OpenAPI spec",
"keywords": [
"QuickBase",
Expand All @@ -22,7 +22,11 @@
"email": "[email protected]"
},
"maintainers": [],
"contributors": [],
"contributors": [{
"name": "Andrew Steiger",
"email": "[email protected]",
"url": "https://github.com/7elephants"
}],
"main": "./dist/quickbase.js",
"types": "./dist/quickbase.d.ts",
"repository": {
Expand Down
10 changes: 9 additions & 1 deletion src/code-generation/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export class QuickBase {
* The default settings of a `QuickBase` instance
*/
static defaults: Required<QuickBaseOptions> = {
scheme: 'https',
server: 'api.quickbase.com',
version: 'v1',
realm: IS_BROWSER ? window.location.host.split('.')[0] : '',
Expand Down Expand Up @@ -215,7 +216,7 @@ export class QuickBase {
private getBaseRequest(){
return {
method: 'GET',
baseURL: `https://${this.settings.server}/${this.settings.version}`,
baseURL: `${this.settings.scheme}://${this.settings.server}/${this.settings.version}`,
headers: {
'Content-Type': 'application/json; charset=UTF-8',
[IS_BROWSER ? 'X-User-Agent' : 'User-Agent']: `${this.settings.userAgent} node-quickbase/v${VERSION} ${IS_BROWSER ? (window.navigator ? window.navigator.userAgent : '') : 'nodejs/' + process.version}`.trim(),
Expand Down Expand Up @@ -393,6 +394,13 @@ export class QuickBase {

/* Types */
export type QuickBaseOptions = Partial<{
/**
* Quickbase API Server scheme
*
* Default is `https`
*/
scheme: string;

/**
* Quickbase API Server FQDN
*
Expand Down
10 changes: 9 additions & 1 deletion src/quickbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export class QuickBase {
* The default settings of a `QuickBase` instance
*/
static defaults: Required<QuickBaseOptions> = {
scheme: 'https',
server: 'api.quickbase.com',
version: 'v1',
realm: IS_BROWSER ? window.location.host.split('.')[0] : '',
Expand Down Expand Up @@ -216,7 +217,7 @@ export class QuickBase {
private getBaseRequest(){
return {
method: 'GET',
baseURL: `https://${this.settings.server}/${this.settings.version}`,
baseURL: `${this.settings.scheme}://${this.settings.server}/${this.settings.version}`,
headers: {
'Content-Type': 'application/json; charset=UTF-8',
[IS_BROWSER ? 'X-User-Agent' : 'User-Agent']: `${this.settings.userAgent} node-quickbase/v${VERSION} ${IS_BROWSER ? (window.navigator ? window.navigator.userAgent : '') : 'nodejs/' + process.version}`.trim(),
Expand Down Expand Up @@ -1945,6 +1946,13 @@ export class QuickBase {

/* Types */
export type QuickBaseOptions = Partial<{
/**
* Quickbase API Server scheme
*
* Default is `https`
*/
scheme: string;

/**
* Quickbase API Server FQDN
*
Expand Down
1 change: 1 addition & 0 deletions src/tests/quickbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const TEST_UTF_16 = process.env.TEST_UTF_16 === 'true';
const TEST_FILE = process.env.TEST_FILE === 'true';

const qbOptions: QuickBaseOptions = {
scheme: 'https',
server: 'api.quickbase.com',
version: 'v1',

Expand Down