Closed janhalama closed 2 years ago
@kysely I checked Air and it does work well with profiles without scope.
why keep the profile id components separate? Why not simply expect a valid profileId
@Jakub-Vacek can you confirm that CLI works with profile id components and not full profileId
.
why keep the version required? A request for the latest without specifying a version seems valid to me.
Yes that makes sense to me too. @Jakub-Vacek what do you think?
Currently, CLI http functions (profile and map related) calls directly ServiceClient.fetch where it passes profileId as a string. On the other places we use profileId as ProfileId and optional (which is imo correct - user does not have to pass version expecting that he gets the latest profile/map) version.
CLI will be able to work with both approaches with very little effort. I think the question is more about what is the responsibility of service client. When we decide to pass profile components it will be responsible for construction of the URL when we will pass valid profile ID this responsibility is on CLI/AIR.
The other question is whether ServiceClient should expect its users to understand the profile/map IDs components. But since this is aimed for use in CLI/front end, I think it's reasonable.
In that case I'd suggest keeping the components separate but still make the version
optional.
@Jakub-Vacek @kysely I made version
optional parameter. 🙏 review once again.
Oh I missed that version is required in case of map. Thank you!
putting all of the document ID components into an object seems like an easier API for me
I wanted to pass optional parameters as options, but as all of the parameters are actually document ID components your suggestion makes sense.
Description
This PR fixes
getProfile
,getProfileAST
,getProfileSource
,getMap
,getMapAST
,getMapSource
functions. Parametersscope
andversion
are no longer required to get profile or map resources.BREAKING CHANGE Parameters of
getProfile*
andgetMap*
functions has been changed.Motivation and Context
Fixes: https://github.com/superfaceai/service-client/issues/67
Types of changes
Checklist: