-
Notifications
You must be signed in to change notification settings - Fork 1
Add getChoicesetValue API [PLT-93574] #140
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
base: feature/choiceset
Are you sure you want to change the base?
Conversation
fe14606 to
d063a89
Compare
d063a89 to
0c862a6
Compare
| /** Human-readable display name */ | ||
| displayName: string; | ||
| /** Numeric identifier */ | ||
| numberId: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about ordinal/index instead of numberId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check this name in entity get records response, where a field is choiceset
a01eb00 to
0d007ad
Compare
| CreatedBy: string; | ||
| UpdatedBy: string; | ||
| RecordOwner: string; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some if these fields are optional right? for eg RecordOwner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made them optional, previously they are optional only in SDK response
| /** | ||
| * Represents a single choice set value/record | ||
| */ | ||
| export interface ChoiceSetValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChoiceSetGetResponse ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to ChoiceSetValueGetResponse
| export type ChoiceSetGetByIdOptions = { | ||
| /** Level of entity expansion (default: 0) */ | ||
| expansionLevel?: number; | ||
| } & PaginationOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the underlying query_expansion api provide other options as well?
| serviceAccess: this.createPaginationServiceAccess(), | ||
| getEndpoint: () => DATA_FABRIC_ENDPOINTS.CHOICESETS.GET_BY_ID(choicesetId), | ||
| transformFn: transformChoiceSetValue, | ||
| parseItemsFn: parseJsonArray<RawChoiceSetValue>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can the parseItemsFn method be part of the transformFn itself?
|
Is it going to be |
| const transformChoiceSetValue = (item: RawChoiceSetValue): ChoiceSetValue => { | ||
| // First convert PascalCase to camelCase, then rename time fields | ||
| const camelCased = pascalToCamelCaseKeys(item); | ||
| return transformData(camelCased, EntityMap) as unknown as ChoiceSetValue; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid the as unknown as
| * @example | ||
| * ```typescript | ||
| * // Get all values (non-paginated) | ||
| * const values = await sdk.entities.choicesets.getById('choiceset-uuid'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use <choicesetId> conventionfor params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| * const values = await sdk.entities.choicesets.getById('choiceset-uuid', { | ||
| * expansionLevel: 1 | ||
| * }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add what happen with expansionLevel
| /** | ||
| * Raw ChoiceSet Value API Response (PascalCase from API) | ||
| */ | ||
| export interface RawChoiceSetValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RawChoiceSetValueGetResponse ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, done
| /** Name of the choice set value */ | ||
| name: string; | ||
| /** Human-readable display name */ | ||
| displayName: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff between displayName and name? do we need both?
| /** Human-readable display name */ | ||
| displayName: string; | ||
| /** Numeric identifier */ | ||
| numberId: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check this name in entity get records response, where a field is choiceset
| updateTime: 'updatedTime', | ||
| sqlType: 'fieldDataType', | ||
| fieldDefinition: 'fieldMetaData' | ||
| fieldDefinition: 'fieldMetaData' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forwhich sdk method this is intended?
| * Choice Set values endpoint pagination constants | ||
| * Note: The API returns items as a JSON string in 'jsonValue' field | ||
| */ | ||
| export const CHOICESET_VALUES_PAGINATION = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we reuse ENTITY_PAGINATION ?
| additionalParams, | ||
| transformFn, | ||
| parseItemsFn, | ||
| method = 'GET', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have constant for 'GET'
| const items = response.data?.[itemsField] || []; | ||
| // Make the API call based on method | ||
| let response: { data: any }; | ||
| if (method === 'POST') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const for post
| excludeFromPrefix?: string[]; | ||
|
|
||
| /** HTTP method to use for the request (default: 'GET') */ | ||
| method?: 'GET' | 'POST'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have enum?
|
check if we need an update here |
|
@Sarath1018 we need add scopes for new sdk methods you are adding in docs: https://uipath.github.io/uipath-typescript/oauth-scopes |
SummaryThe root cause was a mismatch between the entity's data format (Integer) and the Choice Set's primary key format (GUID). By identifying the SDK Improvement ProposalTo streamline this in future versions of the UiPath Apps SDK, we recommend the following changes to the 1. Add
|
927503d to
94ce698
Compare
Add getById method to ChoiceSetService for retrieving choice set values
Add POST method support to pagination system (first service to use POST for pagination)
Add parseItemsFn to handle API responses that return items as JSON strings
API call: datafabric_/api/EntityService/entity//query_expansion
SDK method: sdk.entities.choicesets.getById()
refer this page for API response and SDK response: https://uipath.atlassian.net/wiki/spaces/~61b7366691c049006fa31d3c/pages/89979912726/getChoicesetValue+-+gets+the+value+of+a+single+CS