Skip to content

Commit

Permalink
feat: switch baseURL to baseUrl
Browse files Browse the repository at this point in the history
Signed-off-by: Hunter Achieng <achienghunter@gmail.com>
  • Loading branch information
hunterachieng committed Feb 10, 2025
1 parent 566e780 commit cef97b7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
18 changes: 15 additions & 3 deletions packages/kobotoolbox/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "getForms",
"params": [],
"docs": {
"description": "Make a request to fetch all survey forms accessible to the user's API token. The url is `/assets/?asset_type=survey`.",
"description": "Make a request to fetch all survey forms accessible to the user's API token. Calls `/api/v2/assets/?asset_type=survey`.",
"tags": [
{
"title": "public",
Expand All @@ -20,6 +20,10 @@
"description": null,
"name": null
},
{
"title": "state",
"description": "data - an array of form objects"
},
{
"title": "returns",
"description": null,
Expand All @@ -39,7 +43,7 @@
"options"
],
"docs": {
"description": "Get submissions for a specific form",
"description": "Get submissions for a specific form. Calls `/api/v2/assets/<id>/data/`.",
"tags": [
{
"title": "example",
Expand Down Expand Up @@ -83,6 +87,10 @@
"name": "options",
"default": "{}"
},
{
"title": "state",
"description": "data - an array of submission objects"
},
{
"title": "returns",
"description": null,
Expand All @@ -101,7 +109,7 @@
"formId"
],
"docs": {
"description": "Get deployment information for a specific form",
"description": "Get deployment information for a specific form. Calls `/api/v2/assets/<id>/deployment/`.",
"tags": [
{
"title": "example",
Expand All @@ -126,6 +134,10 @@
},
"name": "formId"
},
{
"title": "state",
"description": "data - an object containing deployment information"
},
{
"title": "returns",
"description": null,
Expand Down
6 changes: 3 additions & 3 deletions packages/kobotoolbox/configuration-schema.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"baseURL": {
"title": "Base URL",
"baseUrl": {
"title": "Base Url",
"type": "string",
"default": "https://kf.kobotoolbox.org",
"description": "Kobotoolbox URL",
Expand Down Expand Up @@ -46,7 +46,7 @@
"additionalProperties": true,
"required": [
"username",
"baseURL",
"baseUrl",
"password",
"apiVersion"
]
Expand Down
10 changes: 9 additions & 1 deletion packages/kobotoolbox/src/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ export const prepareNextState = (state, response) => {
};

export async function request(state, method, path, opts) {
const { baseURL, apiVersion, username, password } = state.configuration;
const { baseUrl, apiVersion, username, password } = state.configuration;

let baseURL = baseUrl || state.configuration.baseURL;

if (!baseUrl) {
console.warn(
'No baseUrl found in state.configuration. baseURL will be used instead, but this will be deprecated in the future.'
);
}

const {
data = {},
Expand Down
2 changes: 1 addition & 1 deletion packages/kobotoolbox/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const configuration = {
username: 'test',
password: 'strongpassword',
apiVersion: 'v2',
baseURL: 'https://test.kobotoolbox.org',
baseUrl: 'https://test.kobotoolbox.org',
};

const defaultObjects = [
Expand Down

0 comments on commit cef97b7

Please sign in to comment.