Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add typing for request params #1141

Merged
merged 5 commits into from May 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
114 changes: 82 additions & 32 deletions src/apis/abusiveexperiencereport/v1.ts
Expand Up @@ -15,6 +15,7 @@
*/

import {AxiosPromise} from 'axios';
import {Compute, JWT, OAuth2Client, UserRefreshClient} from 'google-auth-library';

import {GoogleApis} from '../..';
import {BodyResponseCallback, GlobalOptions, MethodOptions} from '../../lib/api';
Expand All @@ -30,6 +31,8 @@ import {createAPIRequest} from '../../lib/apirequest';
// tslint:disable: no-namespace

export namespace abusiveexperiencereport_v1 {
export interface Options extends GlobalOptions { version: 'v1'; }

/**
* Abusive Experience Report API
*
Expand Down Expand Up @@ -76,31 +79,31 @@ export namespace abusiveexperiencereport_v1 {
/**
* The status of the site reviewed for the abusive experiences.
*/
abusiveStatus: string;
abusiveStatus?: string;
/**
* The date on which enforcement begins.
*/
enforcementTime: string;
enforcementTime?: string;
/**
* The abusive experience enforcement status of the site.
*/
filterStatus: string;
filterStatus?: string;
/**
* The last time that the site changed status.
*/
lastChangeTime: string;
lastChangeTime?: string;
/**
* A link that leads to a full abusive experience report.
*/
reportUrl: string;
reportUrl?: string;
/**
* The name of the site reviewed.
*/
reviewedSite: string;
reviewedSite?: string;
/**
* Whether the site is currently under review.
*/
underReview: boolean;
underReview?: boolean;
}
/**
* Response message for ListViolatingSites.
Expand All @@ -109,9 +112,10 @@ export namespace abusiveexperiencereport_v1 {
/**
* A list of summaries of violating sites.
*/
violatingSites: Schema$SiteSummaryResponse[];
violatingSites?: Schema$SiteSummaryResponse[];
}


export class Resource$Sites {
root: Abusiveexperiencereport;
constructor(root: Abusiveexperiencereport) {
Expand All @@ -136,26 +140,34 @@ export namespace abusiveexperiencereport_v1 {
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get(params?: any,
get(params?: Params$Resource$Sites$Get,
options?: MethodOptions): AxiosPromise<Schema$SiteSummaryResponse>;
get(params?: any,
options?: MethodOptions|
get(params: Params$Resource$Sites$Get,
options: MethodOptions|BodyResponseCallback<Schema$SiteSummaryResponse>,
callback: BodyResponseCallback<Schema$SiteSummaryResponse>): void;
get(params: Params$Resource$Sites$Get,
callback: BodyResponseCallback<Schema$SiteSummaryResponse>): void;
get(callback: BodyResponseCallback<Schema$SiteSummaryResponse>): void;
get(paramsOrCallback?: Params$Resource$Sites$Get|
BodyResponseCallback<Schema$SiteSummaryResponse>,
callback?: BodyResponseCallback<Schema$SiteSummaryResponse>): void;
get(params?: any,
options?: MethodOptions|
optionsOrCallback?: MethodOptions|
BodyResponseCallback<Schema$SiteSummaryResponse>,
callback?: BodyResponseCallback<Schema$SiteSummaryResponse>):
void|AxiosPromise<Schema$SiteSummaryResponse> {
if (typeof options === 'function') {
callback = options;
let params = (paramsOrCallback || {}) as Params$Resource$Sites$Get;
let options = (optionsOrCallback || {}) as MethodOptions;

if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Sites$Get;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};

if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}
options = options || {};

const rootUrl =
options.rootUrl || 'https://abusiveexperiencereport.googleapis.com/';
const parameters = {
Expand All @@ -178,6 +190,26 @@ export namespace abusiveexperiencereport_v1 {
}
}

export interface Params$Resource$Sites$Get {
/**
* Auth client or API Key for the request
*/
auth?: string|OAuth2Client|JWT|Compute|UserRefreshClient;

/**
* The required site name. This is the site property whose abusive
* experiences have been reviewed, and it must be URL-encoded. For example,
* sites/https%3A%2F%2Fwww.google.com. The server will return an error of
* BAD_REQUEST if this field is not filled in. Note that if the site
* property is not yet verified in Search Console, the reportUrl field
* returned by the API will lead to the verification page, prompting the
* user to go through that process before they can gain access to the
* Abusive Experience Report.
*/
name?: string;
}


export class Resource$Violatingsites {
root: Abusiveexperiencereport;
constructor(root: Abusiveexperiencereport) {
Expand All @@ -201,28 +233,39 @@ export namespace abusiveexperiencereport_v1 {
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list(params?: any, options?: MethodOptions):
list(params?: Params$Resource$Violatingsites$List, options?: MethodOptions):
AxiosPromise<Schema$ViolatingSitesResponse>;
list(
params?: any,
options?: MethodOptions|
params: Params$Resource$Violatingsites$List,
options: MethodOptions|
BodyResponseCallback<Schema$ViolatingSitesResponse>,
callback?: BodyResponseCallback<Schema$ViolatingSitesResponse>): void;
callback: BodyResponseCallback<Schema$ViolatingSitesResponse>): void;
list(
params: Params$Resource$Violatingsites$List,
callback: BodyResponseCallback<Schema$ViolatingSitesResponse>): void;
list(callback: BodyResponseCallback<Schema$ViolatingSitesResponse>): void;
list(
params?: any,
options?: MethodOptions|
paramsOrCallback?: Params$Resource$Violatingsites$List|
BodyResponseCallback<Schema$ViolatingSitesResponse>,
optionsOrCallback?: MethodOptions|
BodyResponseCallback<Schema$ViolatingSitesResponse>,
callback?: BodyResponseCallback<Schema$ViolatingSitesResponse>):
void|AxiosPromise<Schema$ViolatingSitesResponse> {
if (typeof options === 'function') {
callback = options;
let params =
(paramsOrCallback || {}) as Params$Resource$Violatingsites$List;
let options = (optionsOrCallback || {}) as MethodOptions;

if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Violatingsites$List;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};

if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}
options = options || {};

const rootUrl =
options.rootUrl || 'https://abusiveexperiencereport.googleapis.com/';
const parameters = {
Expand All @@ -245,4 +288,11 @@ export namespace abusiveexperiencereport_v1 {
}
}
}

export interface Params$Resource$Violatingsites$List {
/**
* Auth client or API Key for the request
*/
auth?: string|OAuth2Client|JWT|Compute|UserRefreshClient;
}
}
74 changes: 51 additions & 23 deletions src/apis/acceleratedmobilepageurl/v1.ts
Expand Up @@ -15,6 +15,7 @@
*/

import {AxiosPromise} from 'axios';
import {Compute, JWT, OAuth2Client, UserRefreshClient} from 'google-auth-library';

import {GoogleApis} from '../..';
import {BodyResponseCallback, GlobalOptions, MethodOptions} from '../../lib/api';
Expand All @@ -30,6 +31,8 @@ import {createAPIRequest} from '../../lib/apirequest';
// tslint:disable: no-namespace

export namespace acceleratedmobilepageurl_v1 {
export interface Options extends GlobalOptions { version: 'v1'; }

/**
* Accelerated Mobile Pages (AMP) URL API
*
Expand Down Expand Up @@ -73,16 +76,16 @@ export namespace acceleratedmobilepageurl_v1 {
/**
* The AMP URL pointing to the publisher&#39;s web server.
*/
ampUrl: string;
ampUrl?: string;
/**
* The [AMP Cache URL](/amp/cache/overview#amp-cache-url-format) pointing to
* the cached document in the Google AMP Cache.
*/
cdnAmpUrl: string;
cdnAmpUrl?: string;
/**
* The original non-AMP URL.
*/
originalUrl: string;
originalUrl?: string;
}
/**
* AMP URL Error resource for a requested URL that couldn&#39;t be found.
Expand All @@ -91,15 +94,15 @@ export namespace acceleratedmobilepageurl_v1 {
/**
* The error code of an API call.
*/
errorCode: string;
errorCode?: string;
/**
* An optional descriptive error message.
*/
errorMessage: string;
errorMessage?: string;
/**
* The original non-AMP URL.
*/
originalUrl: string;
originalUrl?: string;
}
/**
* AMP URL request for a batch of URLs.
Expand All @@ -108,13 +111,13 @@ export namespace acceleratedmobilepageurl_v1 {
/**
* The lookup_strategy being requested.
*/
lookupStrategy: string;
lookupStrategy?: string;
/**
* List of URLs to look up for the paired AMP URLs. The URLs are
* case-sensitive. Up to 50 URLs per lookup (see [Usage
* Limits](/amp/cache/reference/limits)).
*/
urls: string[];
urls?: string[];
}
/**
* Batch AMP URL response.
Expand All @@ -126,13 +129,14 @@ export namespace acceleratedmobilepageurl_v1 {
* BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated only
* once.
*/
ampUrls: Schema$AmpUrl[];
ampUrls?: Schema$AmpUrl[];
/**
* The errors for requested URLs that have no AMP URL.
*/
urlErrors: Schema$AmpUrlError[];
urlErrors?: Schema$AmpUrlError[];
}


export class Resource$Ampurls {
root: Acceleratedmobilepageurl;
constructor(root: Acceleratedmobilepageurl) {
Expand All @@ -158,28 +162,40 @@ export namespace acceleratedmobilepageurl_v1 {
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
batchGet(params?: any, options?: MethodOptions):
AxiosPromise<Schema$BatchGetAmpUrlsResponse>;
batchGet(
params?: any,
options?: MethodOptions|
params?: Params$Resource$Ampurls$Batchget,
options?: MethodOptions): AxiosPromise<Schema$BatchGetAmpUrlsResponse>;
batchGet(
params: Params$Resource$Ampurls$Batchget,
options: MethodOptions|
BodyResponseCallback<Schema$BatchGetAmpUrlsResponse>,
callback?: BodyResponseCallback<Schema$BatchGetAmpUrlsResponse>): void;
callback: BodyResponseCallback<Schema$BatchGetAmpUrlsResponse>): void;
batchGet(
params: Params$Resource$Ampurls$Batchget,
callback: BodyResponseCallback<Schema$BatchGetAmpUrlsResponse>): void;
batchGet(callback: BodyResponseCallback<Schema$BatchGetAmpUrlsResponse>):
void;
batchGet(
params?: any,
options?: MethodOptions|
paramsOrCallback?: Params$Resource$Ampurls$Batchget|
BodyResponseCallback<Schema$BatchGetAmpUrlsResponse>,
optionsOrCallback?: MethodOptions|
BodyResponseCallback<Schema$BatchGetAmpUrlsResponse>,
callback?: BodyResponseCallback<Schema$BatchGetAmpUrlsResponse>):
void|AxiosPromise<Schema$BatchGetAmpUrlsResponse> {
if (typeof options === 'function') {
callback = options;
let params = (paramsOrCallback || {}) as Params$Resource$Ampurls$Batchget;
let options = (optionsOrCallback || {}) as MethodOptions;

if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Ampurls$Batchget;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};

if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}
options = options || {};

const rootUrl =
options.rootUrl || 'https://acceleratedmobilepageurl.googleapis.com/';
const parameters = {
Expand All @@ -202,4 +218,16 @@ export namespace acceleratedmobilepageurl_v1 {
}
}
}

export interface Params$Resource$Ampurls$Batchget {
/**
* Auth client or API Key for the request
*/
auth?: string|OAuth2Client|JWT|Compute|UserRefreshClient;

/**
* Request body metadata
*/
resource?: Schema$BatchGetAmpUrlsRequest;
}
}