UNPKG

googleapis

Version:
268 lines (267 loc) 11.1 kB
/** * Copyright 2015 Google Inc. All Rights Reserved. * * 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 { AxiosPromise } from 'axios'; import { GoogleApis } from '../..'; import { BodyResponseCallback, GlobalOptions, MethodOptions } from '../../lib/api'; /** * TaskQueue API * * Accesses a Google App Engine Pull Task Queue over REST. * * @example * const google = require('googleapis'); * const taskqueue = google.taskqueue('v1beta2'); * * @namespace taskqueue * @type {Function} * @version v1beta2 * @variation v1beta2 * @param {object=} options Options for Taskqueue */ export declare class Taskqueue { _options: GlobalOptions; google: GoogleApis; root: this; taskqueues: Resource$Taskqueues; tasks: Resource$Tasks; constructor(options: GlobalOptions, google: GoogleApis); getRoot(): this; } export interface Schema$Task { /** * Time (in seconds since the epoch) at which the task was enqueued. */ enqueueTimestamp: string; /** * Name of the task. */ id: string; /** * The kind of object returned, in this case set to task. */ kind: string; /** * Time (in seconds since the epoch) at which the task lease will expire. This * value is 0 if the task isnt currently leased out to a worker. */ leaseTimestamp: string; /** * A bag of bytes which is the task payload. The payload on the JSON side is * always Base64 encoded. */ payloadBase64: string; /** * Name of the queue that the task is in. */ queueName: string; /** * The number of leases applied to this task. */ retry_count: number; /** * Tag for the task, could be used later to lease tasks grouped by a specific * tag. */ tag: string; } export interface Schema$TaskQueue { /** * ACLs that are applicable to this TaskQueue object. */ acl: any; /** * Name of the taskqueue. */ id: string; /** * The kind of REST object returned, in this case taskqueue. */ kind: string; /** * The number of times we should lease out tasks before giving up on them. If * unset we lease them out forever until a worker deletes the task. */ maxLeases: number; /** * Statistics for the TaskQueue object in question. */ stats: any; } export interface Schema$Tasks { /** * The actual list of tasks returned as a result of the lease operation. */ items: Schema$Task[]; /** * The kind of object returned, a list of tasks. */ kind: string; } export interface Schema$Tasks2 { /** * The actual list of tasks currently active in the TaskQueue. */ items: Schema$Task[]; /** * The kind of object returned, a list of tasks. */ kind: string; } export declare class Resource$Taskqueues { root: Taskqueue; constructor(root: Taskqueue); getRoot(): Taskqueue; /** * taskqueue.taskqueues.get * @desc Get detailed information about a TaskQueue. * @alias taskqueue.taskqueues.get * @memberOf! () * * @param {object} params Parameters for request * @param {boolean=} params.getStats Whether to get stats. Optional. * @param {string} params.project The project under which the queue lies. * @param {string} params.taskqueue The id of the taskqueue to get the properties of. * @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?: any, options?: MethodOptions): AxiosPromise<Schema$TaskQueue>; get(params?: any, options?: MethodOptions | BodyResponseCallback<Schema$TaskQueue>, callback?: BodyResponseCallback<Schema$TaskQueue>): void; } export declare class Resource$Tasks { root: Taskqueue; constructor(root: Taskqueue); getRoot(): Taskqueue; /** * taskqueue.tasks.delete * @desc Delete a task from a TaskQueue. * @alias taskqueue.tasks.delete * @memberOf! () * * @param {object} params Parameters for request * @param {string} params.project The project under which the queue lies. * @param {string} params.task The id of the task to delete. * @param {string} params.taskqueue The taskqueue to delete a task from. * @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?: any, options?: MethodOptions): AxiosPromise<void>; delete(params?: any, options?: MethodOptions | BodyResponseCallback<void>, callback?: BodyResponseCallback<void>): void; /** * taskqueue.tasks.get * @desc Get a particular task from a TaskQueue. * @alias taskqueue.tasks.get * @memberOf! () * * @param {object} params Parameters for request * @param {string} params.project The project under which the queue lies. * @param {string} params.task The task to get properties of. * @param {string} params.taskqueue The taskqueue in which the task belongs. * @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?: any, options?: MethodOptions): AxiosPromise<Schema$Task>; get(params?: any, options?: MethodOptions | BodyResponseCallback<Schema$Task>, callback?: BodyResponseCallback<Schema$Task>): void; /** * taskqueue.tasks.insert * @desc Insert a new task in a TaskQueue * @alias taskqueue.tasks.insert * @memberOf! () * * @param {object} params Parameters for request * @param {string} params.project The project under which the queue lies * @param {string} params.taskqueue The taskqueue to insert the task into * @param {().Task} 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?: any, options?: MethodOptions): AxiosPromise<Schema$Task>; insert(params?: any, options?: MethodOptions | BodyResponseCallback<Schema$Task>, callback?: BodyResponseCallback<Schema$Task>): void; /** * taskqueue.tasks.lease * @desc Lease 1 or more tasks from a TaskQueue. * @alias taskqueue.tasks.lease * @memberOf! () * * @param {object} params Parameters for request * @param {boolean=} params.groupByTag When true, all returned tasks will have the same tag * @param {integer} params.leaseSecs The lease in seconds. * @param {integer} params.numTasks The number of tasks to lease. * @param {string} params.project The project under which the queue lies. * @param {string=} params.tag The tag allowed for tasks in the response. Must only be specified if group_by_tag is true. If group_by_tag is true and tag is not specified the tag will be that of the oldest task by eta, i.e. the first available tag * @param {string} params.taskqueue The taskqueue to lease a task from. * @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 */ lease(params?: any, options?: MethodOptions): AxiosPromise<Schema$Tasks>; lease(params?: any, options?: MethodOptions | BodyResponseCallback<Schema$Tasks>, callback?: BodyResponseCallback<Schema$Tasks>): void; /** * taskqueue.tasks.list * @desc List Tasks in a TaskQueue * @alias taskqueue.tasks.list * @memberOf! () * * @param {object} params Parameters for request * @param {string} params.project The project under which the queue lies. * @param {string} params.taskqueue The id of the taskqueue to list tasks from. * @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?: any, options?: MethodOptions): AxiosPromise<Schema$Tasks2>; list(params?: any, options?: MethodOptions | BodyResponseCallback<Schema$Tasks2>, callback?: BodyResponseCallback<Schema$Tasks2>): void; /** * taskqueue.tasks.patch * @desc Update tasks that are leased out of a TaskQueue. This method supports * patch semantics. * @alias taskqueue.tasks.patch * @memberOf! () * * @param {object} params Parameters for request * @param {integer} params.newLeaseSeconds The new lease in seconds. * @param {string} params.project The project under which the queue lies. * @param {string} params.task * @param {string} params.taskqueue * @param {().Task} 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 */ patch(params?: any, options?: MethodOptions): AxiosPromise<Schema$Task>; patch(params?: any, options?: MethodOptions | BodyResponseCallback<Schema$Task>, callback?: BodyResponseCallback<Schema$Task>): void; /** * taskqueue.tasks.update * @desc Update tasks that are leased out of a TaskQueue. * @alias taskqueue.tasks.update * @memberOf! () * * @param {object} params Parameters for request * @param {integer} params.newLeaseSeconds The new lease in seconds. * @param {string} params.project The project under which the queue lies. * @param {string} params.task * @param {string} params.taskqueue * @param {().Task} 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?: any, options?: MethodOptions): AxiosPromise<Schema$Task>; update(params?: any, options?: MethodOptions | BodyResponseCallback<Schema$Task>, callback?: BodyResponseCallback<Schema$Task>): void; }