v2.d.ts
26.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
/**
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { OAuth2Client, JWT, Compute, UserRefreshClient } from 'google-auth-library';
import { GoogleConfigurable, MethodOptions, GlobalOptions, BodyResponseCallback, APIRequestContext } from 'googleapis-common';
import { GaxiosPromise } from 'gaxios';
export declare namespace surveys_v2 {
export interface Options extends GlobalOptions {
version: 'v2';
}
interface StandardParameters {
/**
* Data format for the response.
*/
alt?: string;
/**
* Selector specifying which fields to include in a partial response.
*/
fields?: string;
/**
* API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
*/
key?: string;
/**
* OAuth 2.0 token for the current user.
*/
oauth_token?: string;
/**
* Returns response with indentations and line breaks.
*/
prettyPrint?: boolean;
/**
* An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
*/
quotaUser?: string;
/**
* Deprecated. Please use quotaUser instead.
*/
userIp?: string;
}
/**
* Surveys API
*
* Creates and conducts surveys, lists the surveys that an authenticated user owns, and retrieves survey results and information about specified surveys.
*
* @example
* const {google} = require('googleapis');
* const surveys = google.surveys('v2');
*
* @namespace surveys
* @type {Function}
* @version v2
* @variation v2
* @param {object=} options Options for Surveys
*/
export class Surveys {
context: APIRequestContext;
results: Resource$Results;
surveys: Resource$Surveys;
constructor(options: GlobalOptions, google?: GoogleConfigurable);
}
export interface Schema$FieldMask {
fields?: Schema$FieldMask[];
id?: number | null;
}
export interface Schema$PageInfo {
resultPerPage?: number | null;
startIndex?: number | null;
totalResults?: number | null;
}
export interface Schema$ResultsGetRequest {
resultMask?: Schema$ResultsMask;
}
export interface Schema$ResultsMask {
fields?: Schema$FieldMask[];
projection?: string | null;
}
/**
* Representation of an individual survey object.
*/
export interface Schema$Survey {
/**
* Targeting-criteria message containing demographic information
*/
audience?: Schema$SurveyAudience;
/**
* Cost to run the survey and collect the necessary number of responses.
*/
cost?: Schema$SurveyCost;
/**
* Additional information to store on behalf of the API consumer and associate with this question. This binary blob is treated as opaque. This field is limited to 64K bytes.
*/
customerData?: string | null;
/**
* Text description of the survey.
*/
description?: string | null;
/**
* List of email addresses for survey owners. Must contain at least the address of the user making the API call.
*/
owners?: string[] | null;
/**
* List of questions defining the survey.
*/
questions?: Schema$SurveyQuestion[];
/**
* Reason for the survey being rejected. Only present if the survey state is rejected.
*/
rejectionReason?: Schema$SurveyRejection;
/**
* State that the survey is in.
*/
state?: string | null;
/**
* Unique survey ID, that is viewable in the URL of the Survey Creator UI
*/
surveyUrlId?: string | null;
/**
* Optional name that will be given to the survey.
*/
title?: string | null;
/**
* Number of responses desired for the survey.
*/
wantedResponseCount?: number | null;
}
/**
* Specifications for the target audience of a survey run through the API.
*/
export interface Schema$SurveyAudience {
/**
* Optional list of age buckets to target. Supported age buckets are: ['18-24', '25-34', '35-44', '45-54', '55-64', '65+']
*/
ages?: string[] | null;
/**
* Required country code that surveys should be targeted to. Accepts standard ISO 3166-1 2 character language codes. For instance, 'US' for the United States, and 'GB' for the United Kingdom.
*/
country?: string | null;
/**
* Country subdivision (states/provinces/etc) that surveys should be targeted to. For all countries except GB, ISO-3166-2 subdivision code is required (eg. 'US-OH' for Ohio, United States). For GB, NUTS 1 statistical region codes for the United Kingdom is required (eg. 'UK-UKC' for North East England).
*/
countrySubdivision?: string | null;
/**
* Optional gender to target.
*/
gender?: string | null;
/**
* Language code that surveys should be targeted to. For instance, 'en-US'. Surveys may target bilingual users by specifying a list of language codes (for example, 'de' and 'en-US'). In that case, all languages will be used for targeting users but the survey content (which is displayed) must match the first language listed. Accepts standard BCP47 language codes. See specification.
*/
languages?: string[] | null;
/**
* Online population source where the respondents are sampled from.
*/
populationSource?: string | null;
}
/**
* Message defining the cost to run a given survey through API.
*/
export interface Schema$SurveyCost {
/**
* Cost per survey response in nano units of the given currency. To get the total cost for a survey, multiply this value by wanted_response_count.
*/
costPerResponseNanos?: string | null;
/**
* Currency code that the cost is given in.
*/
currencyCode?: string | null;
/**
* *Deprecated* Threshold to start a survey automatically if the quoted price is at most this value. When a survey has a Screener (threshold) question, it must go through an incidence pricing test to determine the final cost per response. Typically you will have to make a followup call to start the survey giving the final computed cost per response. If the survey has no threshold_answers, setting this property will return an error. By specifying this property, you indicate the max price per response you are willing to pay in advance of the incidence test. If the price turns out to be lower than the specified value, the survey will begin immediately and you will be charged at the rate determined by the incidence pricing test. If the price turns out to be greater than the specified value the survey will not be started and you will instead be notified what price was determined by the incidence test. At that point, you must raise the value of this property to be greater than or equal to that cost before attempting to start the survey again. This will immediately start the survey as long the incidence test was run within the last 21 days. This will no longer be available after June 2018.
*/
maxCostPerResponseNanos?: string | null;
/**
* Cost of survey in nano units of the given currency. DEPRECATED in favor of cost_per_response_nanos
*/
nanos?: string | null;
}
/**
* Message defining the question specifications.
*/
export interface Schema$SurveyQuestion {
/**
* The randomization option for multiple choice and multi-select questions. If not specified, this option defaults to randomize.
*/
answerOrder?: string | null;
/**
* Required list of answer options for a question.
*/
answers?: string[] | null;
/**
* Option to allow open-ended text box for Single Answer and Multiple Answer question types. This can be used with SINGLE_ANSWER, SINGLE_ANSWER_WITH_IMAGE, MULTIPLE_ANSWERS, and MULTIPLE_ANSWERS_WITH_IMAGE question types.
*/
hasOther?: boolean | null;
/**
* For rating questions, the text for the higher end of the scale, such as 'Best'. For numeric questions, a string representing a floating-point that is the maximum allowed number for a response.
*/
highValueLabel?: string | null;
images?: Schema$SurveyQuestionImage[];
/**
* Currently only support pinning an answer option to the last position.
*/
lastAnswerPositionPinned?: boolean | null;
/**
* For rating questions, the text for the lower end of the scale, such as 'Worst'. For numeric questions, a string representing a floating-point that is the minimum allowed number for a response.
*/
lowValueLabel?: string | null;
/**
* Option to force the user to pick one of the open text suggestions. This requires that suggestions are provided for this question.
*/
mustPickSuggestion?: boolean | null;
/**
* Number of stars to use for ratings questions.
*/
numStars?: string | null;
/**
* Placeholder text for an open text question.
*/
openTextPlaceholder?: string | null;
/**
* A list of suggested answers for open text question auto-complete. This is only valid if single_line_response is true.
*/
openTextSuggestions?: string[] | null;
/**
* Required question text shown to the respondent.
*/
question?: string | null;
/**
* Used by the Rating Scale with Text question type. This text goes along with the question field that is presented to the respondent, and is the actual text that the respondent is asked to rate.
*/
sentimentText?: string | null;
/**
* Option to allow multiple line open text responses instead of a single line response. Note that we don't show auto-complete suggestions with multiple line responses.
*/
singleLineResponse?: boolean | null;
/**
* The threshold/screener answer options, which will screen a user into the rest of the survey. These will be a subset of the answer option strings.
*/
thresholdAnswers?: string[] | null;
/**
* Required field defining the question type. For details about configuring different type of questions, consult the question configuration guide.
*/
type?: string | null;
/**
* Optional unit of measurement for display (for example: hours, people, miles).
*/
unitOfMeasurementLabel?: string | null;
/**
* The YouTube video ID to be show in video questions.
*/
videoId?: string | null;
}
/**
* Container object for image data and alt_text.
*/
export interface Schema$SurveyQuestionImage {
/**
* The alt text property used in image tags is required for all images.
*/
altText?: string | null;
/**
* Inline jpeg, gif, tiff, bmp, or png image raw bytes for an image question types.
*/
data?: string | null;
/**
* The read-only URL for the hosted images.
*/
url?: string | null;
}
/**
* Message representing why the survey was rejected from review, if it was.
*/
export interface Schema$SurveyRejection {
/**
* A human-readable explanation of what was wrong with the survey.
*/
explanation?: string | null;
/**
* Which category of rejection this was. See the Google Surveys Help Center for additional details on each category.
*/
type?: string | null;
}
/**
* Reference to the current results for a given survey.
*/
export interface Schema$SurveyResults {
/**
* Human readable string describing the status of the request.
*/
status?: string | null;
/**
* External survey ID as viewable by survey owners in the editor view.
*/
surveyUrlId?: string | null;
}
export interface Schema$SurveysDeleteResponse {
/**
* Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests.
*/
requestId?: string | null;
}
export interface Schema$SurveysListResponse {
pageInfo?: Schema$PageInfo;
/**
* Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests.
*/
requestId?: string | null;
/**
* An individual survey resource.
*/
resources?: Schema$Survey[];
tokenPagination?: Schema$TokenPagination;
}
export interface Schema$SurveysStartRequest {
/**
* *Deprecated* Threshold to start a survey automatically if the quoted prices is less than or equal to this value. See Survey.Cost for more details. This will no longer be available after June 2018.
*/
maxCostPerResponseNanos?: string | null;
}
export interface Schema$SurveysStartResponse {
/**
* Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests.
*/
requestId?: string | null;
}
export interface Schema$SurveysStopResponse {
/**
* Unique request ID used for logging and debugging. Please include in any error reporting or troubleshooting requests.
*/
requestId?: string | null;
}
export interface Schema$TokenPagination {
nextPageToken?: string | null;
previousPageToken?: string | null;
}
export class Resource$Results {
context: APIRequestContext;
constructor(context: APIRequestContext);
/**
* surveys.results.get
* @desc Retrieves any survey results that have been produced so far. Results are formatted as an Excel file. You must add "?alt=media" to the URL as an argument to get results.
* @alias surveys.results.get
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {().ResultsGetRequest} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get(params?: Params$Resource$Results$Get, options?: MethodOptions): GaxiosPromise<Schema$SurveyResults>;
get(params: Params$Resource$Results$Get, options: MethodOptions | BodyResponseCallback<Schema$SurveyResults>, callback: BodyResponseCallback<Schema$SurveyResults>): void;
get(params: Params$Resource$Results$Get, callback: BodyResponseCallback<Schema$SurveyResults>): void;
get(callback: BodyResponseCallback<Schema$SurveyResults>): void;
}
export interface Params$Resource$Results$Get extends StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient;
/**
* External URL ID for the survey.
*/
surveyUrlId?: string;
/**
* Request body metadata
*/
requestBody?: Schema$ResultsGetRequest;
}
export class Resource$Surveys {
context: APIRequestContext;
constructor(context: APIRequestContext);
/**
* surveys.surveys.delete
* @desc Removes a survey from view in all user GET requests.
* @alias surveys.surveys.delete
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete(params?: Params$Resource$Surveys$Delete, options?: MethodOptions): GaxiosPromise<Schema$SurveysDeleteResponse>;
delete(params: Params$Resource$Surveys$Delete, options: MethodOptions | BodyResponseCallback<Schema$SurveysDeleteResponse>, callback: BodyResponseCallback<Schema$SurveysDeleteResponse>): void;
delete(params: Params$Resource$Surveys$Delete, callback: BodyResponseCallback<Schema$SurveysDeleteResponse>): void;
delete(callback: BodyResponseCallback<Schema$SurveysDeleteResponse>): void;
/**
* surveys.surveys.get
* @desc Retrieves information about the specified survey.
* @alias surveys.surveys.get
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get(params?: Params$Resource$Surveys$Get, options?: MethodOptions): GaxiosPromise<Schema$Survey>;
get(params: Params$Resource$Surveys$Get, options: MethodOptions | BodyResponseCallback<Schema$Survey>, callback: BodyResponseCallback<Schema$Survey>): void;
get(params: Params$Resource$Surveys$Get, callback: BodyResponseCallback<Schema$Survey>): void;
get(callback: BodyResponseCallback<Schema$Survey>): void;
/**
* surveys.surveys.insert
* @desc Creates a survey.
* @alias surveys.surveys.insert
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {().Survey} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert(params?: Params$Resource$Surveys$Insert, options?: MethodOptions): GaxiosPromise<Schema$Survey>;
insert(params: Params$Resource$Surveys$Insert, options: MethodOptions | BodyResponseCallback<Schema$Survey>, callback: BodyResponseCallback<Schema$Survey>): void;
insert(params: Params$Resource$Surveys$Insert, callback: BodyResponseCallback<Schema$Survey>): void;
insert(callback: BodyResponseCallback<Schema$Survey>): void;
/**
* surveys.surveys.list
* @desc Lists the surveys owned by the authenticated user.
* @alias surveys.surveys.list
* @memberOf! ()
*
* @param {object=} params Parameters for request
* @param {integer=} params.maxResults
* @param {integer=} params.startIndex
* @param {string=} params.token
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list(params?: Params$Resource$Surveys$List, options?: MethodOptions): GaxiosPromise<Schema$SurveysListResponse>;
list(params: Params$Resource$Surveys$List, options: MethodOptions | BodyResponseCallback<Schema$SurveysListResponse>, callback: BodyResponseCallback<Schema$SurveysListResponse>): void;
list(params: Params$Resource$Surveys$List, callback: BodyResponseCallback<Schema$SurveysListResponse>): void;
list(callback: BodyResponseCallback<Schema$SurveysListResponse>): void;
/**
* surveys.surveys.start
* @desc Begins running a survey.
* @alias surveys.surveys.start
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {string} params.resourceId
* @param {().SurveysStartRequest} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
start(params?: Params$Resource$Surveys$Start, options?: MethodOptions): GaxiosPromise<Schema$SurveysStartResponse>;
start(params: Params$Resource$Surveys$Start, options: MethodOptions | BodyResponseCallback<Schema$SurveysStartResponse>, callback: BodyResponseCallback<Schema$SurveysStartResponse>): void;
start(params: Params$Resource$Surveys$Start, callback: BodyResponseCallback<Schema$SurveysStartResponse>): void;
start(callback: BodyResponseCallback<Schema$SurveysStartResponse>): void;
/**
* surveys.surveys.stop
* @desc Stops a running survey.
* @alias surveys.surveys.stop
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {string} params.resourceId
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
stop(params?: Params$Resource$Surveys$Stop, options?: MethodOptions): GaxiosPromise<Schema$SurveysStopResponse>;
stop(params: Params$Resource$Surveys$Stop, options: MethodOptions | BodyResponseCallback<Schema$SurveysStopResponse>, callback: BodyResponseCallback<Schema$SurveysStopResponse>): void;
stop(params: Params$Resource$Surveys$Stop, callback: BodyResponseCallback<Schema$SurveysStopResponse>): void;
stop(callback: BodyResponseCallback<Schema$SurveysStopResponse>): void;
/**
* surveys.surveys.update
* @desc Updates a survey. Currently the only property that can be updated is the owners property.
* @alias surveys.surveys.update
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {().Survey} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update(params?: Params$Resource$Surveys$Update, options?: MethodOptions): GaxiosPromise<Schema$Survey>;
update(params: Params$Resource$Surveys$Update, options: MethodOptions | BodyResponseCallback<Schema$Survey>, callback: BodyResponseCallback<Schema$Survey>): void;
update(params: Params$Resource$Surveys$Update, callback: BodyResponseCallback<Schema$Survey>): void;
update(callback: BodyResponseCallback<Schema$Survey>): void;
}
export interface Params$Resource$Surveys$Delete extends StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient;
/**
* External URL ID for the survey.
*/
surveyUrlId?: string;
}
export interface Params$Resource$Surveys$Get extends StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient;
/**
* External URL ID for the survey.
*/
surveyUrlId?: string;
}
export interface Params$Resource$Surveys$Insert extends StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient;
/**
* Request body metadata
*/
requestBody?: Schema$Survey;
}
export interface Params$Resource$Surveys$List extends StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient;
/**
*
*/
maxResults?: number;
/**
*
*/
startIndex?: number;
/**
*
*/
token?: string;
}
export interface Params$Resource$Surveys$Start extends StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient;
/**
*
*/
resourceId?: string;
/**
* Request body metadata
*/
requestBody?: Schema$SurveysStartRequest;
}
export interface Params$Resource$Surveys$Stop extends StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient;
/**
*
*/
resourceId?: string;
}
export interface Params$Resource$Surveys$Update extends StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient;
/**
* External URL ID for the survey.
*/
surveyUrlId?: string;
/**
* Request body metadata
*/
requestBody?: Schema$Survey;
}
export {};
}