Created
November 19, 2021 01:45
-
-
Save loloDawit/2b17453b15458eef2fb130155b355d23 to your computer and use it in GitHub Desktop.
queries.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| /** | |
| * account Uses tagName to get account specific info | |
| * @param {*} tagName | |
| * @returns JSON with error or success | |
| */ | |
| const account = (tagName) => { | |
| return JSON.stringify({ | |
| query: `{ | |
| actor { | |
| entitySearch(queryBuilder: {type: DASHBOARD, tags: {key: "account", value: "${tagName}"}}, sortBy: NAME) { | |
| results { | |
| entities { | |
| ... on DashboardEntityOutline { | |
| guid | |
| name | |
| accountId | |
| owner { | |
| } | |
| permissions | |
| updatedAt | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }`, | |
| variables: {} | |
| }); | |
| }; | |
| /** | |
| * getDashboardInfo Uses guid to get a dashboard info | |
| * @param {*} guid | |
| * @returns JSON with error or success | |
| */ | |
| const getDashboardInfo = (guid) => { | |
| return JSON.stringify({ | |
| query: `{ | |
| actor { | |
| entity(guid: "${guid}") { | |
| ... on DashboardEntity { | |
| guid | |
| accountId | |
| name | |
| createdAt | |
| updatedAt | |
| permissions | |
| description | |
| owner { | |
| userId | |
| } | |
| pages { | |
| guid | |
| name | |
| createdAt | |
| updatedAt | |
| description | |
| owner { | |
| userId | |
| } | |
| widgets { | |
| id | |
| visualization { | |
| id | |
| } | |
| title | |
| layout { | |
| row | |
| column | |
| height | |
| width | |
| } | |
| rawConfiguration | |
| linkedEntities { | |
| guid | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }`, | |
| variables: {} | |
| }); | |
| }; | |
| /** | |
| * unDelete Uses guid to unDelete a dashboard | |
| * @param {*} guid | |
| * @returns JSON with error or success | |
| */ | |
| const unDelete = (guid) => { | |
| return JSON.stringify({ | |
| query: `mutation { | |
| dashboardUndelete(guid: "${guid}") { | |
| errors { | |
| description | |
| type | |
| } | |
| } | |
| }`, | |
| variables: {} | |
| }); | |
| }; | |
| module.exports = {account, getDashboardInfo, unDelete}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment