Open tehhowch opened 5 years ago
Thanks for issue report. There seems to be two distinct issues here caused by some faulty assumptions:
bigquery
but the serviceName is bigquery-json.googleapis.com
. See assumption in code here.admin
service ID maps to both the AdminDirectory
and AdminReports
advanced services, distinguished by the version. See assumption in code here.I think we could fix the first problem by including an optional field serviceName
in the AdvancedService
type that specifies the serviceName to use in cases when it differs from {serviceId}.googleapis.com
.
Fixing the second problem could probably be done by adding a version
argument to apis enable
, which would be required when the service ID maps to more than advanced service.
@grant - Does that sound reasonable?
Sounds reasonable. Note that commander
has a bug where --version
prints the commander
version, thus we've been using versionNumber
for version flags.
Would an interface like this solve the issues?
clasp apis enable --serviceName 'calendar' --serviceId 'calendar-json' --versionNumber 'v1'
clasp apis enable slides # shortand for most APIs, throws error if there are multiple versions.
clasp apis enable slides:v1
Would all of those still require that the API is already included in the PUBLIC_ADVANCED_SERVICES
list? If not, how would we determine the user symbol? If so, then it would be easier to just add the service ID to that struct rather than have the developer type it in.
Expected Behavior
When using
clasp apis list
, the displayed<api name>
is what can be passed inclasp apis enable/disable <api name>
Actual Behavior
Services with names that have "-" (e.g.
bigquery-json
) or specialized "Advanced Services" bindings (AdminDirectory
,AdminReports
) are not properly reported byapis list
:If attempting to then enable the API by displayed name, e.g.
clasp apis enable bigquery
, HTTP 403 "The caller does not have permission" is raised, and clasp then states:Steps to Reproduce the Problem
clasp apis list
admin
twice (forAdminDirectory
&AdminReports
)bigquery
clasp apis enable bigquery
Specifications
node -v
): 8.11.2clasp -v
): 2.0.1