Skip to content

Commit

Permalink
fix(cloud-rad): move comments for TSDoc (#1040)
Browse files Browse the repository at this point in the history
As we move our ref docs to cloud.google.com, we rely on TSDoc rather JSDoc.

TSDoc expects comments before the first overloaded function, we
currently have those on the last function. Those comments don't make
it into the d.ts files. We need to move comments to the first
overloaded function rather than the last one.

Internally b/190631834

Script used: https://github.com/fhinkel/cloud-rad-script/blob/main/moveComments.js
  • Loading branch information
fhinkel authored Nov 6, 2021
1 parent 618242c commit 93c5e14
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 210 deletions.
68 changes: 34 additions & 34 deletions src/bigquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1172,16 +1172,6 @@ export class BigQuery extends common.Service {
);
}

createDataset(
id: string,
options?: DatasetResource
): Promise<DatasetResponse>;
createDataset(
id: string,
options: DatasetResource,
callback: DatasetCallback
): void;
createDataset(id: string, callback: DatasetCallback): void;
/**
* @callback DatasetCallback
* @param {?Error} err Request error, if any.
Expand Down Expand Up @@ -1219,6 +1209,16 @@ export class BigQuery extends common.Service {
* });
* ```
*/
createDataset(
id: string,
options?: DatasetResource
): Promise<DatasetResponse>;
createDataset(
id: string,
options: DatasetResource,
callback: DatasetCallback
): void;
createDataset(id: string, callback: DatasetCallback): void;
createDataset(
id: string,
optionsOrCallback?: DatasetResource | DatasetCallback,
Expand Down Expand Up @@ -1260,8 +1260,6 @@ export class BigQuery extends common.Service {
);
}

createQueryJob(options: Query | string): Promise<JobResponse>;
createQueryJob(options: Query | string, callback: JobCallback): void;
/**
* @callback JobCallback
* @param {?Error} err Request error, if any.
Expand Down Expand Up @@ -1357,6 +1355,8 @@ export class BigQuery extends common.Service {
* });
* ```
*/
createQueryJob(options: Query | string): Promise<JobResponse>;
createQueryJob(options: Query | string, callback: JobCallback): void;
createQueryJob(
opts: Query | string,
callback?: JobCallback
Expand Down Expand Up @@ -1492,8 +1492,6 @@ export class BigQuery extends common.Service {
this.createJob(reqOpts, callback!);
}

createJob(options: JobOptions): Promise<JobResponse>;
createJob(options: JobOptions, callback: JobCallback): void;
/**
* Creates a job. Typically when creating a job you'll have a very specific
* task in mind. For this we recommend one of the following methods:
Expand Down Expand Up @@ -1553,6 +1551,8 @@ export class BigQuery extends common.Service {
* });
* ```
*/
createJob(options: JobOptions): Promise<JobResponse>;
createJob(options: JobOptions, callback: JobCallback): void;
createJob(
options: JobOptions,
callback?: JobCallback
Expand Down Expand Up @@ -1659,9 +1659,6 @@ export class BigQuery extends common.Service {
return new Dataset(this, id, options);
}

getDatasets(options?: GetDatasetsOptions): Promise<DatasetsResponse>;
getDatasets(options: GetDatasetsOptions, callback: DatasetsCallback): void;
getDatasets(callback: DatasetsCallback): void;
/**
* List all or some of the datasets in your project.
*
Expand Down Expand Up @@ -1712,6 +1709,9 @@ export class BigQuery extends common.Service {
* bigquery.getDatasets().then(function(datasets) {});
* ```
*/
getDatasets(options?: GetDatasetsOptions): Promise<DatasetsResponse>;
getDatasets(options: GetDatasetsOptions, callback: DatasetsCallback): void;
getDatasets(callback: DatasetsCallback): void;
getDatasets(
optionsOrCallback?: GetDatasetsOptions | DatasetsCallback,
cb?: DatasetsCallback
Expand Down Expand Up @@ -1757,9 +1757,6 @@ export class BigQuery extends common.Service {
);
}

getJobs(options?: GetJobsOptions): Promise<GetJobsResponse>;
getJobs(options: GetJobsOptions, callback: GetJobsCallback): void;
getJobs(callback: GetJobsCallback): void;
/**
* @callback GetJobsCallback
* @param {?Error} err Request error, if any.
Expand Down Expand Up @@ -1829,6 +1826,9 @@ export class BigQuery extends common.Service {
* });
* ```
*/
getJobs(options?: GetJobsOptions): Promise<GetJobsResponse>;
getJobs(options: GetJobsOptions, callback: GetJobsCallback): void;
getJobs(callback: GetJobsCallback): void;
getJobs(
optionsOrCallback?: GetJobsOptions | GetJobsCallback,
cb?: GetJobsCallback
Expand Down Expand Up @@ -1890,20 +1890,6 @@ export class BigQuery extends common.Service {
return new Job(this, id, options);
}

query(query: string, options?: QueryOptions): Promise<QueryRowsResponse>;
query(query: Query, options?: QueryOptions): Promise<SimpleQueryRowsResponse>;
query(
query: string,
options: QueryOptions,
callback?: QueryRowsCallback
): void;
query(
query: Query,
options: QueryOptions,
callback?: SimpleQueryRowsCallback
): void;
query(query: string, callback?: QueryRowsCallback): void;
query(query: Query, callback?: SimpleQueryRowsCallback): void;
/**
* Run a query scoped to your project. For manual pagination please refer to
* {@link BigQuery#createQueryJob}.
Expand Down Expand Up @@ -2021,6 +2007,20 @@ export class BigQuery extends common.Service {
* });
* ```
*/
query(query: string, options?: QueryOptions): Promise<QueryRowsResponse>;
query(query: Query, options?: QueryOptions): Promise<SimpleQueryRowsResponse>;
query(
query: string,
options: QueryOptions,
callback?: QueryRowsCallback
): void;
query(
query: Query,
options: QueryOptions,
callback?: SimpleQueryRowsCallback
): void;
query(query: string, callback?: QueryRowsCallback): void;
query(query: Query, callback?: SimpleQueryRowsCallback): void;
query(
query: string | Query,
optionsOrCallback?:
Expand Down
62 changes: 31 additions & 31 deletions src/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,6 @@ class Dataset extends ServiceObject {
this.getTablesStream = paginator.streamify<Table>('getTables');
}

createQueryJob(options: string | Query): Promise<JobResponse>;
createQueryJob(options: string | Query, callback: JobCallback): void;
/**
* Run a query as a job. No results are immediately returned. Instead, your
* callback will be executed with a {@link Job} object that you must
Expand All @@ -498,6 +496,8 @@ class Dataset extends ServiceObject {
* @param {JobCallback} [callback] See {@link BigQuery#createQueryJob} for full documentation of this method.
* @returns {Promise<JobResponse>} See {@link BigQuery#createQueryJob} for full documentation of this method.
*/
createQueryJob(options: string | Query): Promise<JobResponse>;
createQueryJob(options: string | Query, callback: JobCallback): void;
createQueryJob(
options: string | Query,
callback?: JobCallback
Expand Down Expand Up @@ -544,12 +544,6 @@ class Dataset extends ServiceObject {
return this.bigQuery.createQueryStream(options);
}

createRoutine(id: string, config: RoutineMetadata): Promise<RoutineResponse>;
createRoutine(
id: string,
config: RoutineMetadata,
callback: RoutineCallback
): void;
/**
* @callback CreateRoutineCallback
* @param {?Error} err Request error, if any.
Expand Down Expand Up @@ -604,6 +598,12 @@ class Dataset extends ServiceObject {
* const [routine, apiResponse] = await dataset.createRoutine(id, config);
* ```
*/
createRoutine(id: string, config: RoutineMetadata): Promise<RoutineResponse>;
createRoutine(
id: string,
config: RoutineMetadata,
callback: RoutineCallback
): void;
createRoutine(
id: string,
config: RoutineMetadata,
Expand Down Expand Up @@ -636,13 +636,6 @@ class Dataset extends ServiceObject {
);
}

createTable(id: string, options: TableMetadata): Promise<TableResponse>;
createTable(
id: string,
options: TableMetadata,
callback: TableCallback
): void;
createTable(id: string, callback: TableCallback): void;
/**
* @callback TableCallback
* @param {?Error} err Request error, if any.
Expand Down Expand Up @@ -698,6 +691,13 @@ class Dataset extends ServiceObject {
* });
* ```
*/
createTable(id: string, options: TableMetadata): Promise<TableResponse>;
createTable(
id: string,
options: TableMetadata,
callback: TableCallback
): void;
createTable(id: string, callback: TableCallback): void;
createTable(
id: string,
optionsOrCallback?: TableMetadata | TableCallback,
Expand Down Expand Up @@ -737,9 +737,6 @@ class Dataset extends ServiceObject {
);
}

delete(options?: DatasetDeleteOptions): Promise<[Metadata]>;
delete(options: DatasetDeleteOptions, callback: DeleteCallback): void;
delete(callback: DeleteCallback): void;
/**
* @callback DeleteCallback
* @param {?Error} err Request error, if any.
Expand Down Expand Up @@ -785,6 +782,9 @@ class Dataset extends ServiceObject {
* });
* ```
*/
delete(options?: DatasetDeleteOptions): Promise<[Metadata]>;
delete(options: DatasetDeleteOptions, callback: DeleteCallback): void;
delete(callback: DeleteCallback): void;
delete(
optionsOrCallback?: DeleteCallback | DatasetDeleteOptions,
callback?: DeleteCallback
Expand All @@ -808,9 +808,6 @@ class Dataset extends ServiceObject {
);
}

getModels(options?: GetModelsOptions): Promise<GetModelsResponse>;
getModels(options: GetModelsOptions, callback: GetModelsCallback): void;
getModels(callback: GetModelsCallback): void;
/**
* @typedef {object} GetModelsOptions
* @property {boolean} [autoPaginate=true] Have pagination handled
Expand Down Expand Up @@ -888,6 +885,9 @@ class Dataset extends ServiceObject {
* });
* ```
*/
getModels(options?: GetModelsOptions): Promise<GetModelsResponse>;
getModels(options: GetModelsOptions, callback: GetModelsCallback): void;
getModels(callback: GetModelsCallback): void;
getModels(
optsOrCb?: GetModelsOptions | GetModelsCallback,
cb?: GetModelsCallback
Expand Down Expand Up @@ -924,9 +924,6 @@ class Dataset extends ServiceObject {
);
}

getRoutines(options?: GetRoutinesOptions): Promise<GetRoutinesResponse>;
getRoutines(options: GetRoutinesOptions, callback: GetRoutinesCallback): void;
getRoutines(callback: GetRoutinesCallback): void;
/**
* @typedef {object} GetRoutinesOptions
* @property {boolean} [autoPaginate=true] Have pagination handled
Expand Down Expand Up @@ -1002,6 +999,9 @@ class Dataset extends ServiceObject {
* const [routines] = await dataset.getRoutines();
* ```
*/
getRoutines(options?: GetRoutinesOptions): Promise<GetRoutinesResponse>;
getRoutines(options: GetRoutinesOptions, callback: GetRoutinesCallback): void;
getRoutines(callback: GetRoutinesCallback): void;
getRoutines(
optsOrCb?: GetRoutinesOptions | GetRoutinesCallback,
cb?: GetRoutinesCallback
Expand Down Expand Up @@ -1038,9 +1038,6 @@ class Dataset extends ServiceObject {
);
}

getTables(options?: GetTablesOptions): Promise<GetTablesResponse>;
getTables(options: GetTablesOptions, callback: GetTablesCallback): void;
getTables(callback: GetTablesCallback): void;
/**
* @typedef {object} GetTablesOptions
* @property {boolean} [autoPaginate=true] Have pagination handled
Expand Down Expand Up @@ -1118,6 +1115,9 @@ class Dataset extends ServiceObject {
* });
* ```
*/
getTables(options?: GetTablesOptions): Promise<GetTablesResponse>;
getTables(options: GetTablesOptions, callback: GetTablesCallback): void;
getTables(callback: GetTablesCallback): void;
getTables(
optionsOrCallback?: GetTablesOptions | GetTablesCallback,
cb?: GetTablesCallback
Expand Down Expand Up @@ -1183,10 +1183,6 @@ class Dataset extends ServiceObject {
return new Model(this, id);
}

query(options: Query): Promise<QueryRowsResponse>;
query(options: string): Promise<QueryRowsResponse>;
query(options: Query, callback: SimpleQueryRowsCallback): void;
query(options: string, callback: SimpleQueryRowsCallback): void;
/**
* Run a query scoped to your dataset.
*
Expand All @@ -1197,6 +1193,10 @@ class Dataset extends ServiceObject {
* @returns {Promise<SimpleQueryRowsResponse>}
* @returns {Promise<QueryRowsResponse>} See {@link BigQuery#query} for full documentation of this method.
*/
query(options: Query): Promise<QueryRowsResponse>;
query(options: string): Promise<QueryRowsResponse>;
query(options: Query, callback: SimpleQueryRowsCallback): void;
query(options: string, callback: SimpleQueryRowsCallback): void;
query(
options: Query | string,
callback?: SimpleQueryRowsCallback
Expand Down
16 changes: 8 additions & 8 deletions src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ class Job extends Operation {
);
}

cancel(): Promise<CancelResponse>;
cancel(callback: CancelCallback): void;
/**
* @callback CancelCallback
* @param {?Error} err Request error, if any.
Expand Down Expand Up @@ -368,6 +366,8 @@ class Job extends Operation {
* });
* ```
*/
cancel(): Promise<CancelResponse>;
cancel(callback: CancelCallback): void;
cancel(callback?: CancelCallback): void | Promise<CancelResponse> {
let qs;

Expand All @@ -385,12 +385,6 @@ class Job extends Operation {
);
}

getQueryResults(options?: QueryResultsOptions): Promise<QueryRowsResponse>;
getQueryResults(
options: QueryResultsOptions,
callback: QueryRowsCallback
): void;
getQueryResults(callback: QueryRowsCallback): void;
/**
* Get the results of a job.
*
Expand Down Expand Up @@ -465,6 +459,12 @@ class Job extends Operation {
* });
* ```
*/
getQueryResults(options?: QueryResultsOptions): Promise<QueryRowsResponse>;
getQueryResults(
options: QueryResultsOptions,
callback: QueryRowsCallback
): void;
getQueryResults(callback: QueryRowsCallback): void;
getQueryResults(
optionsOrCallback?: QueryResultsOptions | QueryRowsCallback,
cb?: QueryRowsCallback
Expand Down
Loading

0 comments on commit 93c5e14

Please sign in to comment.