diff --git a/readme.md b/readme.md index f3be67d..d8bc877 100644 --- a/readme.md +++ b/readme.md @@ -39,7 +39,7 @@ The Vements Client Library for JavaScript includes a command line tool that can #### Usage ```bash -$ vements --help +$ npm run build; node dist/vements.cjs.js --help ``` The JavaScript CLI tool supports all of the same operations as the CLI tool in other languages: diff --git a/src/cli.js b/src/cli.js index 7a0e587..bb133b3 100644 --- a/src/cli.js +++ b/src/cli.js @@ -63,10 +63,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.achievement .leaderboard({ - achievement_id: args.achievementId, + achievementId: args.achievementId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -92,15 +92,13 @@ export const CLI = (config, client, args) => { .action((args) => { client.achievement .record({ - achievement_id: args.achievementId, - body: { - participant_id: args.participantId, - value: args.value, - recorded: args.recorded, - }, + achievementId: args.achievementId, + participantId: args.participantId, + value: args.value, + recorded: args.recorded, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -117,12 +115,12 @@ export const CLI = (config, client, args) => { .action((args) => { client.achievement .list({ - project_id: args.projectId, + projectId: args.projectId, limit: args.limit, offset: args.offset, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -153,20 +151,18 @@ export const CLI = (config, client, args) => { .action((args) => { client.achievement .create({ - body: { - project_id: args.projectId, - display: args.display, - goal: args.goal, - repeats: args.repeats, - locked_image: args.lockedImage, - unlocked_image: args.unlockedImage, - position: args.position, - public: args.public, - extra: args.extra, - }, + projectId: args.projectId, + display: args.display, + goal: args.goal, + repeats: args.repeats, + lockedImage: args.lockedImage, + unlockedImage: args.unlockedImage, + position: args.position, + public_: args.public_, + extra: args.extra, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -185,10 +181,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.achievement .read({ - achievement_id: args.achievementId, + achievementId: args.achievementId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -223,20 +219,18 @@ export const CLI = (config, client, args) => { .action((args) => { client.achievement .update({ - achievement_id: args.achievementId, - body: { - display: args.display, - goal: args.goal, - repeats: args.repeats, - locked_image: args.lockedImage, - unlocked_image: args.unlockedImage, - position: args.position, - public: args.public, - extra: args.extra, - }, + achievementId: args.achievementId, + display: args.display, + goal: args.goal, + repeats: args.repeats, + lockedImage: args.lockedImage, + unlockedImage: args.unlockedImage, + position: args.position, + public_: args.public_, + extra: args.extra, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -255,10 +249,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.achievement .delete({ - achievement_id: args.achievementId, + achievementId: args.achievementId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -283,10 +277,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.participant .progress({ - participant_id: args.participantId, + participantId: args.participantId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -305,10 +299,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.participant .scores({ - participant_id: args.participantId, + participantId: args.participantId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -325,12 +319,12 @@ export const CLI = (config, client, args) => { .action((args) => { client.participant .list({ - project_id: args.projectId, + projectId: args.projectId, limit: args.limit, offset: args.offset, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -349,16 +343,14 @@ export const CLI = (config, client, args) => { .action((args) => { client.participant .create({ - body: { - project_id: args.projectId, - display: args.display, - external_id: args.externalId, - image: args.image, - extra: args.extra, - }, + projectId: args.projectId, + display: args.display, + externalId: args.externalId, + image: args.image, + extra: args.extra, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -377,10 +369,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.participant .read({ - participant_id: args.participantId, + participantId: args.participantId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -403,16 +395,14 @@ export const CLI = (config, client, args) => { .action((args) => { client.participant .update({ - participant_id: args.participantId, - body: { - display: args.display, - external_id: args.externalId, - image: args.image, - extra: args.extra, - }, + participantId: args.participantId, + display: args.display, + externalId: args.externalId, + image: args.image, + extra: args.extra, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -431,10 +421,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.participant .delete({ - participant_id: args.participantId, + participantId: args.participantId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -466,15 +456,13 @@ export const CLI = (config, client, args) => { .action((args) => { client.scoreboard .record({ - scoreboard_id: args.scoreboardId, - body: { - participant_id: args.participantId, - value: args.value, - recorded: args.recorded, - }, + scoreboardId: args.scoreboardId, + participantId: args.participantId, + value: args.value, + recorded: args.recorded, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -495,12 +483,12 @@ export const CLI = (config, client, args) => { .action((args) => { client.scoreboard .scores({ - scoreboard_id: args.scoreboardId, + scoreboardId: args.scoreboardId, from: args.from, to: args.to, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -517,12 +505,12 @@ export const CLI = (config, client, args) => { .action((args) => { client.scoreboard .list({ - project_id: args.projectId, + projectId: args.projectId, limit: args.limit, offset: args.offset, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -541,16 +529,14 @@ export const CLI = (config, client, args) => { .action((args) => { client.scoreboard .create({ - body: { - project_id: args.projectId, - display: args.display, - rank_dir: args.rankDir, - public: args.public, - extra: args.extra, - }, + projectId: args.projectId, + display: args.display, + rankDir: args.rankDir, + public_: args.public_, + extra: args.extra, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -569,10 +555,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.scoreboard .read({ - scoreboard_id: args.scoreboardId, + scoreboardId: args.scoreboardId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -595,16 +581,14 @@ export const CLI = (config, client, args) => { .action((args) => { client.scoreboard .update({ - scoreboard_id: args.scoreboardId, - body: { - display: args.display, - rank_dir: args.rankDir, - public: args.public, - extra: args.extra, - }, + scoreboardId: args.scoreboardId, + display: args.display, + rankDir: args.rankDir, + public_: args.public_, + extra: args.extra, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); @@ -623,10 +607,10 @@ export const CLI = (config, client, args) => { .action((args) => { client.scoreboard .delete({ - scoreboard_id: args.scoreboardId, + scoreboardId: args.scoreboardId, }) .then((response) => { - console.log(response.data()); + console.log(response); }) .catch((response) => { console.error("ERROR:", response); diff --git a/src/index.js b/src/index.js index 6c1d760..bcf73b0 100644 --- a/src/index.js +++ b/src/index.js @@ -37,7 +37,7 @@ export const Client = ({ apiKey, config, tags }) => { ); const headers = { "x-api-key": apiKey, "content-type": "application/json" }; - return forge({ + const inner = forge({ clientId: "vements", host: origin, middleware: [EncodeJsonMiddleware], @@ -157,6 +157,306 @@ export const Client = ({ apiKey, config, tags }) => { }, }, }); + + return { + achievement: { + leaderboard: async ({ achievementId }) => { + const result = await inner.achievement.leaderboard({ + achievement_id: achievementId, + }); + if (result.responseStatus != 200) { + throw new Error(`leaderboard failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).achievement_leaderboard; + }, + + record: async ({ achievementId, participantId, value, recorded }) => { + const result = await inner.achievement.record({ + achievement_id: achievementId, + body: { + participant_id: participantId, + value: value, + recorded: recorded, + }, + }); + if (result.responseStatus != 200) { + throw new Error(`record failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).insert_progress_one; + }, + + list: async ({ projectId, limit, offset }) => { + const result = await inner.achievement.list({ + project_id: projectId, + limit: limit, + offset: offset, + }); + if (result.responseStatus != 200) { + throw new Error(`list failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).achievement; + }, + + create: async ({ + projectId, + display, + goal, + repeats, + lockedImage, + unlockedImage, + position, + public_, + extra, + }) => { + const result = await inner.achievement.create({ + body: { + project_id: projectId, + display: display, + goal: goal, + repeats: repeats, + locked_image: lockedImage, + unlocked_image: unlockedImage, + position: position, + public: public_, + extra: extra, + }, + }); + if (result.responseStatus != 200) { + throw new Error(`create failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).insert_achievement_one; + }, + + read: async ({ achievementId }) => { + const result = await inner.achievement.read({ + achievement_id: achievementId, + }); + if (result.responseStatus != 200) { + throw new Error(`read failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).achievement; + }, + + update: async ({ + achievementId, + display, + goal, + repeats, + lockedImage, + unlockedImage, + position, + public_, + extra, + }) => { + const result = await inner.achievement.update({ + achievement_id: achievementId, + body: { + display: display, + goal: goal, + repeats: repeats, + locked_image: lockedImage, + unlocked_image: unlockedImage, + position: position, + public: public_, + extra: extra, + }, + }); + if (result.responseStatus != 200) { + throw new Error(`update failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).update_achievement_by_pk; + }, + + delete: async ({ achievementId }) => { + const result = await inner.achievement.delete({ + achievement_id: achievementId, + }); + if (result.responseStatus != 200) { + throw new Error(`delete failed: ` + result.responseStatus); + } + return true; + }, + }, + + participant: { + progress: async ({ participantId }) => { + const result = await inner.participant.progress({ + participant_id: participantId, + }); + if (result.responseStatus != 200) { + throw new Error(`progress failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).participant_progress; + }, + + scores: async ({ participantId }) => { + const result = await inner.participant.scores({ + participant_id: participantId, + }); + if (result.responseStatus != 200) { + throw new Error(`scores failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).participant_scores; + }, + + list: async ({ projectId, limit, offset }) => { + const result = await inner.participant.list({ + project_id: projectId, + limit: limit, + offset: offset, + }); + if (result.responseStatus != 200) { + throw new Error(`list failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).participant; + }, + + create: async ({ projectId, display, externalId, image, extra }) => { + const result = await inner.participant.create({ + body: { + project_id: projectId, + display: display, + external_id: externalId, + image: image, + extra: extra, + }, + }); + if (result.responseStatus != 200) { + throw new Error(`create failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).insert_participant_one; + }, + + read: async ({ participantId }) => { + const result = await inner.participant.read({ + participant_id: participantId, + }); + if (result.responseStatus != 200) { + throw new Error(`read failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).participant; + }, + + update: async ({ participantId, display, externalId, image, extra }) => { + const result = await inner.participant.update({ + participant_id: participantId, + body: { + display: display, + external_id: externalId, + image: image, + extra: extra, + }, + }); + if (result.responseStatus != 200) { + throw new Error(`update failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).update_participant_by_pk; + }, + + delete: async ({ participantId }) => { + const result = await inner.participant.delete({ + participant_id: participantId, + }); + if (result.responseStatus != 200) { + throw new Error(`delete failed: ` + result.responseStatus); + } + return true; + }, + }, + + scoreboard: { + record: async ({ scoreboardId, participantId, value, recorded }) => { + const result = await inner.scoreboard.record({ + scoreboard_id: scoreboardId, + body: { + participant_id: participantId, + value: value, + recorded: recorded, + }, + }); + if (result.responseStatus != 200) { + throw new Error(`record failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).insert_score_one; + }, + + scores: async ({ scoreboardId, from, to }) => { + const result = await inner.scoreboard.scores({ + scoreboard_id: scoreboardId, + from: from, + to: to, + }); + if (result.responseStatus != 200) { + throw new Error(`scores failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).scoreboard_scores; + }, + + list: async ({ projectId, limit, offset }) => { + const result = await inner.scoreboard.list({ + project_id: projectId, + limit: limit, + offset: offset, + }); + if (result.responseStatus != 200) { + throw new Error(`list failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).scoreboard; + }, + + create: async ({ projectId, display, rankDir, public_, extra }) => { + const result = await inner.scoreboard.create({ + body: { + project_id: projectId, + display: display, + rank_dir: rankDir, + public: public_, + extra: extra, + }, + }); + if (result.responseStatus != 200) { + throw new Error(`create failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).insert_scoreboard_one; + }, + + read: async ({ scoreboardId }) => { + const result = await inner.scoreboard.read({ + scoreboard_id: scoreboardId, + }); + if (result.responseStatus != 200) { + throw new Error(`read failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).scoreboard; + }, + + update: async ({ scoreboardId, display, rankDir, public_, extra }) => { + const result = await inner.scoreboard.update({ + scoreboard_id: scoreboardId, + body: { + display: display, + rank_dir: rankDir, + public: public_, + extra: extra, + }, + }); + if (result.responseStatus != 200) { + throw new Error(`update failed: ` + result.responseStatus); + } + return JSON.parse(result.responseData).update_scoreboard_by_pk; + }, + + delete: async ({ scoreboardId }) => { + const result = await inner.scoreboard.delete({ + scoreboard_id: scoreboardId, + }); + if (result.responseStatus != 200) { + throw new Error(`delete failed: ` + result.responseStatus); + } + return true; + }, + }, + }; }; if (require.main === module) { diff --git a/src/types.js b/src/types.js index 97116b7..4e8faa1 100644 --- a/src/types.js +++ b/src/types.js @@ -75,7 +75,7 @@ class Achievement { lockedImage, unlockedImage, position, - public, + public_, created, updated, extra, @@ -88,7 +88,7 @@ class Achievement { this.lockedImage = lockedImage; this.unlockedImage = unlockedImage; this.position = position; - this.public = public; + this.public_ = public_; this.created = created; this.updated = updated; this.extra = extra; @@ -123,7 +123,7 @@ class Scoreboard { projectId, display, rankDir, - public, + public_, created, updated, extra, @@ -132,7 +132,7 @@ class Scoreboard { this.projectId = projectId; this.display = display; this.rankDir = rankDir; - this.public = public; + this.public_ = public_; this.created = created; this.updated = updated; this.extra = extra; @@ -253,7 +253,7 @@ class AchievementCreateRequest { lockedImage, unlockedImage, position, - public, + public_, extra, ) { this.projectId = projectId; @@ -263,7 +263,7 @@ class AchievementCreateRequest { this.lockedImage = lockedImage; this.unlockedImage = unlockedImage; this.position = position; - this.public = public; + this.public_ = public_; this.extra = extra; } } @@ -288,7 +288,7 @@ class AchievementUpdateRequest { lockedImage, unlockedImage, position, - public, + public_, extra, ) { this.display = display; @@ -297,7 +297,7 @@ class AchievementUpdateRequest { this.lockedImage = lockedImage; this.unlockedImage = unlockedImage; this.position = position; - this.public = public; + this.public_ = public_; this.extra = extra; } } @@ -370,11 +370,11 @@ class ParticipantListResponse { } class ScoreboardCreateRequest { - constructor(projectId, display, rankDir, public, extra) { + constructor(projectId, display, rankDir, public_, extra) { this.projectId = projectId; this.display = display; this.rankDir = rankDir; - this.public = public; + this.public_ = public_; this.extra = extra; } } @@ -392,10 +392,10 @@ class ScoreboardReadResponse { } class ScoreboardUpdateRequest { - constructor(display, rankDir, public, extra) { + constructor(display, rankDir, public_, extra) { this.display = display; this.rankDir = rankDir; - this.public = public; + this.public_ = public_; this.extra = extra; } } diff --git a/test/default.test.js b/test/default.test.js index d9d1f5c..a8cfbee 100644 --- a/test/default.test.js +++ b/test/default.test.js @@ -92,7 +92,7 @@ test("achievement leaderboard default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.achievement.leaderboard({ - achievement_id: setup.getValue("achievement_id"), + achievementId: setup.getValue("achievement_id"), }); expect(result).toBeDefined(); @@ -104,12 +104,10 @@ test("achievement record default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.achievement.record({ - achievement_id: setup.getValue("achievement_id"), - body: { - participant_id: setup.getRandom("participant_id"), - value: setup.getRandom("value"), - recorded: setup.getRandom("recorded"), - }, + achievementId: setup.getValue("achievement_id"), + participantId: setup.getRandom("participant_id"), + value: setup.getRandom("value"), + recorded: setup.getRandom("recorded"), }); expect(result).toBeDefined(); @@ -121,7 +119,7 @@ test("participant progress default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.participant.progress({ - participant_id: setup.getValue("participant_id"), + participantId: setup.getValue("participant_id"), }); expect(result).toBeDefined(); @@ -133,7 +131,7 @@ test("participant scores default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.participant.scores({ - participant_id: setup.getValue("participant_id"), + participantId: setup.getValue("participant_id"), }); expect(result).toBeDefined(); @@ -145,12 +143,10 @@ test("scoreboard record default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.scoreboard.record({ - scoreboard_id: setup.getValue("scoreboard_id"), - body: { - participant_id: setup.getRandom("participant_id"), - value: setup.getRandom("value"), - recorded: setup.getRandom("recorded"), - }, + scoreboardId: setup.getValue("scoreboard_id"), + participantId: setup.getRandom("participant_id"), + value: setup.getRandom("value"), + recorded: setup.getRandom("recorded"), }); expect(result).toBeDefined(); @@ -162,7 +158,7 @@ test("scoreboard scores default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.scoreboard.scores({ - scoreboard_id: setup.getValue("scoreboard_id"), + scoreboardId: setup.getValue("scoreboard_id"), from: "", to: "", }); @@ -176,7 +172,7 @@ test("achievement list default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.achievement.list({ - project_id: setup.getValue("project_id"), + projectId: setup.getValue("project_id"), limit: "", offset: "", }); @@ -190,17 +186,15 @@ test("achievement create default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.achievement.create({ - body: { - project_id: setup.getValue("project_id"), - display: setup.getRandom("display"), - goal: setup.getRandom("goal"), - repeats: setup.getRandom("repeats"), - locked_image: setup.getRandom("locked_image"), - unlocked_image: setup.getRandom("unlocked_image"), - position: setup.getRandom("position"), - public: setup.getRandom("public"), - extra: setup.getRandom("extra"), - }, + projectId: setup.getValue("project_id"), + display: setup.getRandom("display"), + goal: setup.getRandom("goal"), + repeats: setup.getRandom("repeats"), + lockedImage: setup.getRandom("locked_image"), + unlockedImage: setup.getRandom("unlocked_image"), + position: setup.getRandom("position"), + public_: setup.getRandom("public"), + extra: setup.getRandom("extra"), }); expect(result).toBeDefined(); @@ -212,7 +206,7 @@ test("achievement read default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.achievement.read({ - achievement_id: setup.getValue("achievement_id"), + achievementId: setup.getValue("achievement_id"), }); expect(result).toBeDefined(); @@ -224,17 +218,15 @@ test("achievement update default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.achievement.update({ - achievement_id: setup.getValue("achievement_id"), - body: { - display: setup.getRandom("display"), - goal: setup.getRandom("goal"), - repeats: setup.getRandom("repeats"), - locked_image: setup.getRandom("locked_image"), - unlocked_image: setup.getRandom("unlocked_image"), - position: setup.getRandom("position"), - public: setup.getRandom("public"), - extra: setup.getRandom("extra"), - }, + achievementId: setup.getValue("achievement_id"), + display: setup.getRandom("display"), + goal: setup.getRandom("goal"), + repeats: setup.getRandom("repeats"), + lockedImage: setup.getRandom("locked_image"), + unlockedImage: setup.getRandom("unlocked_image"), + position: setup.getRandom("position"), + public_: setup.getRandom("public"), + extra: setup.getRandom("extra"), }); expect(result).toBeDefined(); @@ -246,7 +238,7 @@ test("achievement delete default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.achievement.delete({ - achievement_id: setup.getValue("achievement_id"), + achievementId: setup.getValue("achievement_id"), }); expect(result).toBeDefined(); @@ -258,7 +250,7 @@ test("participant list default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.participant.list({ - project_id: setup.getValue("project_id"), + projectId: setup.getValue("project_id"), limit: "", offset: "", }); @@ -272,13 +264,11 @@ test("participant create default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.participant.create({ - body: { - project_id: setup.getValue("project_id"), - display: setup.getRandom("display"), - external_id: setup.getRandom("external_id"), - image: setup.getRandom("image"), - extra: setup.getRandom("extra"), - }, + projectId: setup.getValue("project_id"), + display: setup.getRandom("display"), + externalId: setup.getRandom("external_id"), + image: setup.getRandom("image"), + extra: setup.getRandom("extra"), }); expect(result).toBeDefined(); @@ -290,7 +280,7 @@ test("participant read default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.participant.read({ - participant_id: setup.getValue("participant_id"), + participantId: setup.getValue("participant_id"), }); expect(result).toBeDefined(); @@ -302,13 +292,11 @@ test("participant update default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.participant.update({ - participant_id: setup.getValue("participant_id"), - body: { - display: setup.getRandom("display"), - external_id: setup.getRandom("external_id"), - image: setup.getRandom("image"), - extra: setup.getRandom("extra"), - }, + participantId: setup.getValue("participant_id"), + display: setup.getRandom("display"), + externalId: setup.getRandom("external_id"), + image: setup.getRandom("image"), + extra: setup.getRandom("extra"), }); expect(result).toBeDefined(); @@ -320,7 +308,7 @@ test("participant delete default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.participant.delete({ - participant_id: setup.getValue("participant_id"), + participantId: setup.getValue("participant_id"), }); expect(result).toBeDefined(); @@ -332,7 +320,7 @@ test("scoreboard list default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.scoreboard.list({ - project_id: setup.getValue("project_id"), + projectId: setup.getValue("project_id"), limit: "", offset: "", }); @@ -346,13 +334,11 @@ test("scoreboard create default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.scoreboard.create({ - body: { - project_id: setup.getValue("project_id"), - display: setup.getRandom("display"), - rank_dir: setup.getRandom("rank_dir"), - public: setup.getRandom("public"), - extra: setup.getRandom("extra"), - }, + projectId: setup.getValue("project_id"), + display: setup.getRandom("display"), + rankDir: setup.getRandom("rank_dir"), + public_: setup.getRandom("public"), + extra: setup.getRandom("extra"), }); expect(result).toBeDefined(); @@ -364,7 +350,7 @@ test("scoreboard read default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.scoreboard.read({ - scoreboard_id: setup.getValue("scoreboard_id"), + scoreboardId: setup.getValue("scoreboard_id"), }); expect(result).toBeDefined(); @@ -376,13 +362,11 @@ test("scoreboard update default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.scoreboard.update({ - scoreboard_id: setup.getValue("scoreboard_id"), - body: { - display: setup.getRandom("display"), - rank_dir: setup.getRandom("rank_dir"), - public: setup.getRandom("public"), - extra: setup.getRandom("extra"), - }, + scoreboardId: setup.getValue("scoreboard_id"), + display: setup.getRandom("display"), + rankDir: setup.getRandom("rank_dir"), + public_: setup.getRandom("public"), + extra: setup.getRandom("extra"), }); expect(result).toBeDefined(); @@ -394,7 +378,7 @@ test("scoreboard delete default happy path", async () => { expect(setup.db).toBeDefined(); const result = await setup.client.scoreboard.delete({ - scoreboard_id: setup.getValue("scoreboard_id"), + scoreboardId: setup.getValue("scoreboard_id"), }); expect(result).toBeDefined();