-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement datacollectionrecordvalues
- Loading branch information
Showing
11 changed files
with
518 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
34 changes: 34 additions & 0 deletions
34
monorepo/actionstep-sandbox/src/endpoints/createDataCollectionRecordValue.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ActionStepTokenClient, actionStepClient } from '@dbc-tech/actionstep' | ||
|
||
export const createDataCollectionRecordValue = async ( | ||
tokenClient: ActionStepTokenClient, | ||
) => { | ||
const { dataCollectionRecordValues: client } = actionStepClient(tokenClient) | ||
|
||
const testActionId = 68330 | ||
// Run createDataCollection and obtain id | ||
const testDataCollectionId = 695 | ||
const testDataCollectionField = '109--Postcode' | ||
// Edit createDataCollectionRecord and replace collection id with above and run it to obtain id | ||
const testDataCollectionRecordId = 416631 | ||
|
||
const { data, error } = await client.createDataCollectionRecordValues({ | ||
datacollectionrecordvalues: { | ||
stringValue: 'TEST01', | ||
links: { | ||
action: testActionId, | ||
dataCollection: testDataCollectionId, | ||
dataCollectionField: testDataCollectionField, | ||
dataCollectionRecord: testDataCollectionRecordId, | ||
}, | ||
}, | ||
}) | ||
if (error) console.error('error:', error) | ||
else { | ||
console.log('created datacollectionrecordvalue:', { | ||
id: data.datacollectionrecordvalues.id, | ||
stringValue: data.datacollectionrecordvalues.stringValue, | ||
links: data.datacollectionrecordvalues.links, | ||
}) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
monorepo/actionstep-sandbox/src/endpoints/getDataCollectionRecordValue.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ActionStepTokenClient, actionStepClient } from '@dbc-tech/actionstep' | ||
|
||
export const getDataCollectionRecordValue = async ( | ||
tokenClient: ActionStepTokenClient, | ||
) => { | ||
const { dataCollectionRecordValues: client } = actionStepClient(tokenClient) | ||
|
||
const testDataCollectionValueId = '109--Postcode--100019' | ||
|
||
const { data, error } = await client.getDataCollectionRecordValue( | ||
testDataCollectionValueId, | ||
) | ||
if (error) console.error('error:', error) | ||
else { | ||
console.log('get datacollectionrecordvalue:', { | ||
id: data.datacollectionrecordvalues.id, | ||
stringValue: data.datacollectionrecordvalues.stringValue, | ||
links: data.datacollectionrecordvalues.links, | ||
}) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
monorepo/actionstep-sandbox/src/endpoints/getDataCollectionRecordValues.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ActionStepTokenClient, actionStepClient } from '@dbc-tech/actionstep' | ||
|
||
export const getDataCollectionRecordValues = async ( | ||
tokenClient: ActionStepTokenClient, | ||
) => { | ||
const { dataCollectionRecordValues: client } = actionStepClient(tokenClient) | ||
|
||
const { data, error } = await client.getDataCollectionRecordValues({ | ||
pageSize: 5, | ||
}) | ||
if (error) console.error('error:', error) | ||
else { | ||
for (const datacollectionrecordvalue of data.datacollectionrecordvalues) { | ||
console.log('get datacollectionrecordvalue:', { | ||
id: datacollectionrecordvalue.id, | ||
stringValue: datacollectionrecordvalue.stringValue, | ||
links: datacollectionrecordvalue.links, | ||
}) | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
monorepo/actionstep-sandbox/src/endpoints/updateDataCollectionRecordValue.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ActionStepTokenClient, actionStepClient } from '@dbc-tech/actionstep' | ||
|
||
export const updateDataCollectionRecordValue = async ( | ||
tokenClient: ActionStepTokenClient, | ||
) => { | ||
const { dataCollectionRecordValues: client } = actionStepClient(tokenClient) | ||
|
||
const testDataCollectionRecordValueId = 629 | ||
|
||
const { data, error } = await client.updateDataCollectionRecordValue( | ||
testDataCollectionRecordValueId, | ||
{ | ||
datacollectionrecordvalues: { | ||
stringValue: 'TEST02', | ||
}, | ||
}, | ||
) | ||
if (error) console.error('error:', error) | ||
else { | ||
console.log('updated datacollectionrecordvalue:', { | ||
id: data.datacollectionrecordvalues.id, | ||
stringValue: data.datacollectionrecordvalues.stringValue, | ||
links: data.datacollectionrecordvalues.links, | ||
}) | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.