Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

4519 рядки
158 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package script provides access to the Apps Script API.
  6. //
  7. // For product documentation, see: https://developers.google.com/apps-script/api/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/script/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // scriptService, err := script.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // scriptService, err := script.NewService(ctx, option.WithScopes(script.UserinfoEmailScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // scriptService, err := script.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // scriptService, err := script.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package script // import "google.golang.org/api/script/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "script:v1"
  71. const apiName = "script"
  72. const apiVersion = "v1"
  73. const basePath = "https://script.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // Read, compose, send, and permanently delete all your email from Gmail
  77. MailGoogleComScope = "https://mail.google.com/"
  78. // See, edit, share, and permanently delete all the calendars you can
  79. // access using Google Calendar
  80. WwwGoogleComCalendarFeedsScope = "https://www.google.com/calendar/feeds"
  81. // See, edit, download, and permanently delete your contacts
  82. WwwGoogleComM8FeedsScope = "https://www.google.com/m8/feeds"
  83. // View and manage the provisioning of groups on your domain
  84. AdminDirectoryGroupScope = "https://www.googleapis.com/auth/admin.directory.group"
  85. // View and manage the provisioning of users on your domain
  86. AdminDirectoryUserScope = "https://www.googleapis.com/auth/admin.directory.user"
  87. // View and manage your Google Docs documents
  88. DocumentsScope = "https://www.googleapis.com/auth/documents"
  89. // See, edit, create, and delete all of your Google Drive files
  90. DriveScope = "https://www.googleapis.com/auth/drive"
  91. // View and manage your forms in Google Drive
  92. FormsScope = "https://www.googleapis.com/auth/forms"
  93. // View and manage forms that this application has been installed in
  94. FormsCurrentonlyScope = "https://www.googleapis.com/auth/forms.currentonly"
  95. // View and manage your Google Groups
  96. GroupsScope = "https://www.googleapis.com/auth/groups"
  97. // Create and update Google Apps Script deployments
  98. ScriptDeploymentsScope = "https://www.googleapis.com/auth/script.deployments"
  99. // View Google Apps Script deployments
  100. ScriptDeploymentsReadonlyScope = "https://www.googleapis.com/auth/script.deployments.readonly"
  101. // View Google Apps Script project's metrics
  102. ScriptMetricsScope = "https://www.googleapis.com/auth/script.metrics"
  103. // View Google Apps Script processes
  104. ScriptProcessesScope = "https://www.googleapis.com/auth/script.processes"
  105. // Create and update Google Apps Script projects
  106. ScriptProjectsScope = "https://www.googleapis.com/auth/script.projects"
  107. // View Google Apps Script projects
  108. ScriptProjectsReadonlyScope = "https://www.googleapis.com/auth/script.projects.readonly"
  109. // See, edit, create, and delete your spreadsheets in Google Drive
  110. SpreadsheetsScope = "https://www.googleapis.com/auth/spreadsheets"
  111. // View your email address
  112. UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email"
  113. )
  114. // NewService creates a new Service.
  115. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  116. scopesOption := option.WithScopes(
  117. "https://mail.google.com/",
  118. "https://www.google.com/calendar/feeds",
  119. "https://www.google.com/m8/feeds",
  120. "https://www.googleapis.com/auth/admin.directory.group",
  121. "https://www.googleapis.com/auth/admin.directory.user",
  122. "https://www.googleapis.com/auth/documents",
  123. "https://www.googleapis.com/auth/drive",
  124. "https://www.googleapis.com/auth/forms",
  125. "https://www.googleapis.com/auth/forms.currentonly",
  126. "https://www.googleapis.com/auth/groups",
  127. "https://www.googleapis.com/auth/script.deployments",
  128. "https://www.googleapis.com/auth/script.deployments.readonly",
  129. "https://www.googleapis.com/auth/script.metrics",
  130. "https://www.googleapis.com/auth/script.processes",
  131. "https://www.googleapis.com/auth/script.projects",
  132. "https://www.googleapis.com/auth/script.projects.readonly",
  133. "https://www.googleapis.com/auth/spreadsheets",
  134. "https://www.googleapis.com/auth/userinfo.email",
  135. )
  136. // NOTE: prepend, so we don't override user-specified scopes.
  137. opts = append([]option.ClientOption{scopesOption}, opts...)
  138. client, endpoint, err := htransport.NewClient(ctx, opts...)
  139. if err != nil {
  140. return nil, err
  141. }
  142. s, err := New(client)
  143. if err != nil {
  144. return nil, err
  145. }
  146. if endpoint != "" {
  147. s.BasePath = endpoint
  148. }
  149. return s, nil
  150. }
  151. // New creates a new Service. It uses the provided http.Client for requests.
  152. //
  153. // Deprecated: please use NewService instead.
  154. // To provide a custom HTTP client, use option.WithHTTPClient.
  155. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  156. func New(client *http.Client) (*Service, error) {
  157. if client == nil {
  158. return nil, errors.New("client is nil")
  159. }
  160. s := &Service{client: client, BasePath: basePath}
  161. s.Processes = NewProcessesService(s)
  162. s.Projects = NewProjectsService(s)
  163. s.Scripts = NewScriptsService(s)
  164. return s, nil
  165. }
  166. type Service struct {
  167. client *http.Client
  168. BasePath string // API endpoint base URL
  169. UserAgent string // optional additional User-Agent fragment
  170. Processes *ProcessesService
  171. Projects *ProjectsService
  172. Scripts *ScriptsService
  173. }
  174. func (s *Service) userAgent() string {
  175. if s.UserAgent == "" {
  176. return googleapi.UserAgent
  177. }
  178. return googleapi.UserAgent + " " + s.UserAgent
  179. }
  180. func NewProcessesService(s *Service) *ProcessesService {
  181. rs := &ProcessesService{s: s}
  182. return rs
  183. }
  184. type ProcessesService struct {
  185. s *Service
  186. }
  187. func NewProjectsService(s *Service) *ProjectsService {
  188. rs := &ProjectsService{s: s}
  189. rs.Deployments = NewProjectsDeploymentsService(s)
  190. rs.Versions = NewProjectsVersionsService(s)
  191. return rs
  192. }
  193. type ProjectsService struct {
  194. s *Service
  195. Deployments *ProjectsDeploymentsService
  196. Versions *ProjectsVersionsService
  197. }
  198. func NewProjectsDeploymentsService(s *Service) *ProjectsDeploymentsService {
  199. rs := &ProjectsDeploymentsService{s: s}
  200. return rs
  201. }
  202. type ProjectsDeploymentsService struct {
  203. s *Service
  204. }
  205. func NewProjectsVersionsService(s *Service) *ProjectsVersionsService {
  206. rs := &ProjectsVersionsService{s: s}
  207. return rs
  208. }
  209. type ProjectsVersionsService struct {
  210. s *Service
  211. }
  212. func NewScriptsService(s *Service) *ScriptsService {
  213. rs := &ScriptsService{s: s}
  214. return rs
  215. }
  216. type ScriptsService struct {
  217. s *Service
  218. }
  219. // Content: The Content resource.
  220. type Content struct {
  221. // Files: The list of script project files.
  222. // One of the files is a script manifest; it must be named
  223. // "appsscript",
  224. // must have type of JSON, and include the manifest configurations for
  225. // the
  226. // project.
  227. Files []*File `json:"files,omitempty"`
  228. // ScriptId: The script project's Drive ID.
  229. ScriptId string `json:"scriptId,omitempty"`
  230. // ServerResponse contains the HTTP response code and headers from the
  231. // server.
  232. googleapi.ServerResponse `json:"-"`
  233. // ForceSendFields is a list of field names (e.g. "Files") to
  234. // unconditionally include in API requests. By default, fields with
  235. // empty values are omitted from API requests. However, any non-pointer,
  236. // non-interface field appearing in ForceSendFields will be sent to the
  237. // server regardless of whether the field is empty or not. This may be
  238. // used to include empty fields in Patch requests.
  239. ForceSendFields []string `json:"-"`
  240. // NullFields is a list of field names (e.g. "Files") to include in API
  241. // requests with the JSON null value. By default, fields with empty
  242. // values are omitted from API requests. However, any field with an
  243. // empty value appearing in NullFields will be sent to the server as
  244. // null. It is an error if a field in this list has a non-empty value.
  245. // This may be used to include null fields in Patch requests.
  246. NullFields []string `json:"-"`
  247. }
  248. func (s *Content) MarshalJSON() ([]byte, error) {
  249. type NoMethod Content
  250. raw := NoMethod(*s)
  251. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  252. }
  253. // CreateProjectRequest: Request to create a script project.
  254. type CreateProjectRequest struct {
  255. // ParentId: The Drive ID of a parent file that the created script
  256. // project is bound to.
  257. // This is usually the ID of a Google Doc, Google Sheet, Google Form,
  258. // or
  259. // Google Slides file. If not set, a standalone script project is
  260. // created.
  261. ParentId string `json:"parentId,omitempty"`
  262. // Title: The title for the project.
  263. Title string `json:"title,omitempty"`
  264. // ForceSendFields is a list of field names (e.g. "ParentId") to
  265. // unconditionally include in API requests. By default, fields with
  266. // empty values are omitted from API requests. However, any non-pointer,
  267. // non-interface field appearing in ForceSendFields will be sent to the
  268. // server regardless of whether the field is empty or not. This may be
  269. // used to include empty fields in Patch requests.
  270. ForceSendFields []string `json:"-"`
  271. // NullFields is a list of field names (e.g. "ParentId") to include in
  272. // API requests with the JSON null value. By default, fields with empty
  273. // values are omitted from API requests. However, any field with an
  274. // empty value appearing in NullFields will be sent to the server as
  275. // null. It is an error if a field in this list has a non-empty value.
  276. // This may be used to include null fields in Patch requests.
  277. NullFields []string `json:"-"`
  278. }
  279. func (s *CreateProjectRequest) MarshalJSON() ([]byte, error) {
  280. type NoMethod CreateProjectRequest
  281. raw := NoMethod(*s)
  282. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  283. }
  284. // Deployment: Representation of a single script deployment.
  285. type Deployment struct {
  286. // DeploymentConfig: The deployment configuration.
  287. DeploymentConfig *DeploymentConfig `json:"deploymentConfig,omitempty"`
  288. // DeploymentId: The deployment ID for this deployment.
  289. DeploymentId string `json:"deploymentId,omitempty"`
  290. // EntryPoints: The deployment's entry points.
  291. EntryPoints []*EntryPoint `json:"entryPoints,omitempty"`
  292. // UpdateTime: Last modified date time stamp.
  293. UpdateTime string `json:"updateTime,omitempty"`
  294. // ServerResponse contains the HTTP response code and headers from the
  295. // server.
  296. googleapi.ServerResponse `json:"-"`
  297. // ForceSendFields is a list of field names (e.g. "DeploymentConfig") to
  298. // unconditionally include in API requests. By default, fields with
  299. // empty values are omitted from API requests. However, any non-pointer,
  300. // non-interface field appearing in ForceSendFields will be sent to the
  301. // server regardless of whether the field is empty or not. This may be
  302. // used to include empty fields in Patch requests.
  303. ForceSendFields []string `json:"-"`
  304. // NullFields is a list of field names (e.g. "DeploymentConfig") to
  305. // include in API requests with the JSON null value. By default, fields
  306. // with empty values are omitted from API requests. However, any field
  307. // with an empty value appearing in NullFields will be sent to the
  308. // server as null. It is an error if a field in this list has a
  309. // non-empty value. This may be used to include null fields in Patch
  310. // requests.
  311. NullFields []string `json:"-"`
  312. }
  313. func (s *Deployment) MarshalJSON() ([]byte, error) {
  314. type NoMethod Deployment
  315. raw := NoMethod(*s)
  316. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  317. }
  318. // DeploymentConfig: Metadata the defines how a deployment is
  319. // configured.
  320. type DeploymentConfig struct {
  321. // Description: The description for this deployment.
  322. Description string `json:"description,omitempty"`
  323. // ManifestFileName: The manifest file name for this deployment.
  324. ManifestFileName string `json:"manifestFileName,omitempty"`
  325. // ScriptId: The script project's Drive ID.
  326. ScriptId string `json:"scriptId,omitempty"`
  327. // VersionNumber: The version number on which this deployment is based.
  328. VersionNumber int64 `json:"versionNumber,omitempty"`
  329. // ForceSendFields is a list of field names (e.g. "Description") to
  330. // unconditionally include in API requests. By default, fields with
  331. // empty values are omitted from API requests. However, any non-pointer,
  332. // non-interface field appearing in ForceSendFields will be sent to the
  333. // server regardless of whether the field is empty or not. This may be
  334. // used to include empty fields in Patch requests.
  335. ForceSendFields []string `json:"-"`
  336. // NullFields is a list of field names (e.g. "Description") to include
  337. // in API requests with the JSON null value. By default, fields with
  338. // empty values are omitted from API requests. However, any field with
  339. // an empty value appearing in NullFields will be sent to the server as
  340. // null. It is an error if a field in this list has a non-empty value.
  341. // This may be used to include null fields in Patch requests.
  342. NullFields []string `json:"-"`
  343. }
  344. func (s *DeploymentConfig) MarshalJSON() ([]byte, error) {
  345. type NoMethod DeploymentConfig
  346. raw := NoMethod(*s)
  347. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  348. }
  349. // Empty: A generic empty message that you can re-use to avoid defining
  350. // duplicated
  351. // empty messages in your APIs. A typical example is to use it as the
  352. // request
  353. // or the response type of an API method. For instance:
  354. //
  355. // service Foo {
  356. // rpc Bar(google.protobuf.Empty) returns
  357. // (google.protobuf.Empty);
  358. // }
  359. //
  360. // The JSON representation for `Empty` is empty JSON object `{}`.
  361. type Empty struct {
  362. // ServerResponse contains the HTTP response code and headers from the
  363. // server.
  364. googleapi.ServerResponse `json:"-"`
  365. }
  366. // EntryPoint: A configuration that defines how a deployment is accessed
  367. // externally.
  368. type EntryPoint struct {
  369. // AddOn: Add-on properties.
  370. AddOn *GoogleAppsScriptTypeAddOnEntryPoint `json:"addOn,omitempty"`
  371. // EntryPointType: The type of the entry point.
  372. //
  373. // Possible values:
  374. // "ENTRY_POINT_TYPE_UNSPECIFIED" - An unspecified entry point.
  375. // "WEB_APP" - A web application entry point.
  376. // "EXECUTION_API" - An API executable entry point.
  377. // "ADD_ON" - An Add-On entry point.
  378. EntryPointType string `json:"entryPointType,omitempty"`
  379. // ExecutionApi: An entry point specification for Apps Script API
  380. // execution calls.
  381. ExecutionApi *GoogleAppsScriptTypeExecutionApiEntryPoint `json:"executionApi,omitempty"`
  382. // WebApp: An entry point specification for web apps.
  383. WebApp *GoogleAppsScriptTypeWebAppEntryPoint `json:"webApp,omitempty"`
  384. // ForceSendFields is a list of field names (e.g. "AddOn") to
  385. // unconditionally include in API requests. By default, fields with
  386. // empty values are omitted from API requests. However, any non-pointer,
  387. // non-interface field appearing in ForceSendFields will be sent to the
  388. // server regardless of whether the field is empty or not. This may be
  389. // used to include empty fields in Patch requests.
  390. ForceSendFields []string `json:"-"`
  391. // NullFields is a list of field names (e.g. "AddOn") to include in API
  392. // requests with the JSON null value. By default, fields with empty
  393. // values are omitted from API requests. However, any field with an
  394. // empty value appearing in NullFields will be sent to the server as
  395. // null. It is an error if a field in this list has a non-empty value.
  396. // This may be used to include null fields in Patch requests.
  397. NullFields []string `json:"-"`
  398. }
  399. func (s *EntryPoint) MarshalJSON() ([]byte, error) {
  400. type NoMethod EntryPoint
  401. raw := NoMethod(*s)
  402. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  403. }
  404. // ExecutionError: An object that provides information about the nature
  405. // of an error resulting
  406. // from an attempted execution of a script function using the Apps
  407. // Script API.
  408. // If a run call
  409. // succeeds but the script function (or Apps Script itself) throws an
  410. // exception,
  411. // the response body's error field
  412. // contains a
  413. // Status object. The `Status` object's `details` field
  414. // contains an array with a single one of these `ExecutionError`
  415. // objects.
  416. type ExecutionError struct {
  417. // ErrorMessage: The error message thrown by Apps Script, usually
  418. // localized into the user's
  419. // language.
  420. ErrorMessage string `json:"errorMessage,omitempty"`
  421. // ErrorType: The error type, for example `TypeError` or
  422. // `ReferenceError`. If the error
  423. // type is unavailable, this field is not included.
  424. ErrorType string `json:"errorType,omitempty"`
  425. // ScriptStackTraceElements: An array of objects that provide a stack
  426. // trace through the script to show
  427. // where the execution failed, with the deepest call first.
  428. ScriptStackTraceElements []*ScriptStackTraceElement `json:"scriptStackTraceElements,omitempty"`
  429. // ForceSendFields is a list of field names (e.g. "ErrorMessage") to
  430. // unconditionally include in API requests. By default, fields with
  431. // empty values are omitted from API requests. However, any non-pointer,
  432. // non-interface field appearing in ForceSendFields will be sent to the
  433. // server regardless of whether the field is empty or not. This may be
  434. // used to include empty fields in Patch requests.
  435. ForceSendFields []string `json:"-"`
  436. // NullFields is a list of field names (e.g. "ErrorMessage") to include
  437. // in API requests with the JSON null value. By default, fields with
  438. // empty values are omitted from API requests. However, any field with
  439. // an empty value appearing in NullFields will be sent to the server as
  440. // null. It is an error if a field in this list has a non-empty value.
  441. // This may be used to include null fields in Patch requests.
  442. NullFields []string `json:"-"`
  443. }
  444. func (s *ExecutionError) MarshalJSON() ([]byte, error) {
  445. type NoMethod ExecutionError
  446. raw := NoMethod(*s)
  447. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  448. }
  449. // ExecutionRequest: A request to run the function in a script. The
  450. // script is identified by the
  451. // specified `script_id`. Executing a function on a script returns
  452. // results
  453. // based on the implementation of the script.
  454. type ExecutionRequest struct {
  455. // DevMode: If `true` and the user is an owner of the script, the script
  456. // runs at the
  457. // most recently saved version rather than the version deployed for use
  458. // with
  459. // the Apps Script API. Optional; default is `false`.
  460. DevMode bool `json:"devMode,omitempty"`
  461. // Function: The name of the function to execute in the given script.
  462. // The name does not
  463. // include parentheses or parameters. It can reference a function in
  464. // an
  465. // included library such as `Library.libFunction1`.
  466. Function string `json:"function,omitempty"`
  467. // Parameters: The parameters to be passed to the function being
  468. // executed. The object type
  469. // for each parameter should match the expected type in Apps
  470. // Script.
  471. // Parameters cannot be Apps Script-specific object types (such as
  472. // a
  473. // `Document` or a `Calendar`); they can only be primitive types such
  474. // as
  475. // `string`, `number`, `array`, `object`, or `boolean`. Optional.
  476. Parameters []interface{} `json:"parameters,omitempty"`
  477. // SessionState: <b>Deprecated</b>. For use with Android add-ons only.
  478. // An ID that represents
  479. // the user's current session in the Android app for Google Docs or
  480. // Sheets,
  481. // included as extra data in
  482. // the
  483. // [Intent](https://developer.android.com/guide/components/intents-fi
  484. // lters.html)
  485. // that launches the add-on. When an Android add-on is run with a
  486. // session
  487. // state, it gains the privileges of
  488. // a
  489. // [bound](https://developers.google.com/apps-script/guides/bound)
  490. // scri
  491. // pt&mdash;that is, it can access information like the user's
  492. // current
  493. // cursor position (in Docs) or selected cell (in Sheets). To retrieve
  494. // the
  495. // state,
  496. // call
  497. // `Intent.getStringExtra("com.google.android.apps.docs.addons.Sessi
  498. // onState")`.
  499. // Optional.
  500. SessionState string `json:"sessionState,omitempty"`
  501. // ForceSendFields is a list of field names (e.g. "DevMode") to
  502. // unconditionally include in API requests. By default, fields with
  503. // empty values are omitted from API requests. However, any non-pointer,
  504. // non-interface field appearing in ForceSendFields will be sent to the
  505. // server regardless of whether the field is empty or not. This may be
  506. // used to include empty fields in Patch requests.
  507. ForceSendFields []string `json:"-"`
  508. // NullFields is a list of field names (e.g. "DevMode") to include in
  509. // API requests with the JSON null value. By default, fields with empty
  510. // values are omitted from API requests. However, any field with an
  511. // empty value appearing in NullFields will be sent to the server as
  512. // null. It is an error if a field in this list has a non-empty value.
  513. // This may be used to include null fields in Patch requests.
  514. NullFields []string `json:"-"`
  515. }
  516. func (s *ExecutionRequest) MarshalJSON() ([]byte, error) {
  517. type NoMethod ExecutionRequest
  518. raw := NoMethod(*s)
  519. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  520. }
  521. // ExecutionResponse: An object that provides the return value of a
  522. // function executed using the
  523. // Apps Script API. If the script function returns successfully, the
  524. // response
  525. // body's response field contains this
  526. // `ExecutionResponse` object.
  527. type ExecutionResponse struct {
  528. // Result: The return value of the script function. The type matches the
  529. // object type
  530. // returned in Apps Script. Functions called using the Apps Script API
  531. // cannot
  532. // return Apps Script-specific objects (such as a `Document` or a
  533. // `Calendar`);
  534. // they can only return primitive types such as a `string`, `number`,
  535. // `array`,
  536. // `object`, or `boolean`.
  537. Result interface{} `json:"result,omitempty"`
  538. // ForceSendFields is a list of field names (e.g. "Result") to
  539. // unconditionally include in API requests. By default, fields with
  540. // empty values are omitted from API requests. However, any non-pointer,
  541. // non-interface field appearing in ForceSendFields will be sent to the
  542. // server regardless of whether the field is empty or not. This may be
  543. // used to include empty fields in Patch requests.
  544. ForceSendFields []string `json:"-"`
  545. // NullFields is a list of field names (e.g. "Result") to include in API
  546. // requests with the JSON null value. By default, fields with empty
  547. // values are omitted from API requests. However, any field with an
  548. // empty value appearing in NullFields will be sent to the server as
  549. // null. It is an error if a field in this list has a non-empty value.
  550. // This may be used to include null fields in Patch requests.
  551. NullFields []string `json:"-"`
  552. }
  553. func (s *ExecutionResponse) MarshalJSON() ([]byte, error) {
  554. type NoMethod ExecutionResponse
  555. raw := NoMethod(*s)
  556. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  557. }
  558. // File: An individual file within a script project.
  559. // A file is a third-party source code created by one or
  560. // more
  561. // developers. It can be a server-side JS code, HTML, or a
  562. // configuration file. Each script project can contain multiple files.
  563. type File struct {
  564. // CreateTime: Creation date timestamp.
  565. // This read-only field is only visible to users who have
  566. // WRITER
  567. // permission for the script project.
  568. CreateTime string `json:"createTime,omitempty"`
  569. // FunctionSet: The defined set of functions in the script file, if any.
  570. FunctionSet *GoogleAppsScriptTypeFunctionSet `json:"functionSet,omitempty"`
  571. // LastModifyUser: The user who modified the file most recently.
  572. // This read-only field is only visible to users who have
  573. // WRITER
  574. // permission for the script project.
  575. LastModifyUser *GoogleAppsScriptTypeUser `json:"lastModifyUser,omitempty"`
  576. // Name: The name of the file. The file extension is not part of the
  577. // file
  578. // name, which can be identified from the type field.
  579. Name string `json:"name,omitempty"`
  580. // Source: The file content.
  581. Source string `json:"source,omitempty"`
  582. // Type: The type of the file.
  583. //
  584. // Possible values:
  585. // "ENUM_TYPE_UNSPECIFIED" - Undetermined file type; never actually
  586. // used.
  587. // "SERVER_JS" - An Apps Script server-side code file.
  588. // "HTML" - A file containing client-side HTML.
  589. // "JSON" - A file in JSON format. This type is only used for the
  590. // script
  591. // project's manifest. The manifest file content must match
  592. // the
  593. // structure of a
  594. // valid
  595. // [ScriptManifest](/apps-script/concepts/manifests)
  596. Type string `json:"type,omitempty"`
  597. // UpdateTime: Last modified date timestamp.
  598. // This read-only field is only visible to users who have
  599. // WRITER
  600. // permission for the script project.
  601. UpdateTime string `json:"updateTime,omitempty"`
  602. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  603. // unconditionally include in API requests. By default, fields with
  604. // empty values are omitted from API requests. However, any non-pointer,
  605. // non-interface field appearing in ForceSendFields will be sent to the
  606. // server regardless of whether the field is empty or not. This may be
  607. // used to include empty fields in Patch requests.
  608. ForceSendFields []string `json:"-"`
  609. // NullFields is a list of field names (e.g. "CreateTime") to include in
  610. // API requests with the JSON null value. By default, fields with empty
  611. // values are omitted from API requests. However, any field with an
  612. // empty value appearing in NullFields will be sent to the server as
  613. // null. It is an error if a field in this list has a non-empty value.
  614. // This may be used to include null fields in Patch requests.
  615. NullFields []string `json:"-"`
  616. }
  617. func (s *File) MarshalJSON() ([]byte, error) {
  618. type NoMethod File
  619. raw := NoMethod(*s)
  620. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  621. }
  622. // GoogleAppsScriptTypeAddOnEntryPoint: An add-on entry point.
  623. type GoogleAppsScriptTypeAddOnEntryPoint struct {
  624. // AddOnType: The add-on's required list of supported container types.
  625. //
  626. // Possible values:
  627. // "UNKNOWN_ADDON_TYPE" - Default value, unknown add-on type.
  628. // "GMAIL" - Add-on type for Gmail.
  629. // "DATA_STUDIO" - Add-on type for Data Studio.
  630. AddOnType string `json:"addOnType,omitempty"`
  631. // Description: The add-on's optional description.
  632. Description string `json:"description,omitempty"`
  633. // HelpUrl: The add-on's optional help URL.
  634. HelpUrl string `json:"helpUrl,omitempty"`
  635. // PostInstallTipUrl: The add-on's required post install tip URL.
  636. PostInstallTipUrl string `json:"postInstallTipUrl,omitempty"`
  637. // ReportIssueUrl: The add-on's optional report issue URL.
  638. ReportIssueUrl string `json:"reportIssueUrl,omitempty"`
  639. // Title: The add-on's required title.
  640. Title string `json:"title,omitempty"`
  641. // ForceSendFields is a list of field names (e.g. "AddOnType") to
  642. // unconditionally include in API requests. By default, fields with
  643. // empty values are omitted from API requests. However, any non-pointer,
  644. // non-interface field appearing in ForceSendFields will be sent to the
  645. // server regardless of whether the field is empty or not. This may be
  646. // used to include empty fields in Patch requests.
  647. ForceSendFields []string `json:"-"`
  648. // NullFields is a list of field names (e.g. "AddOnType") to include in
  649. // API requests with the JSON null value. By default, fields with empty
  650. // values are omitted from API requests. However, any field with an
  651. // empty value appearing in NullFields will be sent to the server as
  652. // null. It is an error if a field in this list has a non-empty value.
  653. // This may be used to include null fields in Patch requests.
  654. NullFields []string `json:"-"`
  655. }
  656. func (s *GoogleAppsScriptTypeAddOnEntryPoint) MarshalJSON() ([]byte, error) {
  657. type NoMethod GoogleAppsScriptTypeAddOnEntryPoint
  658. raw := NoMethod(*s)
  659. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  660. }
  661. // GoogleAppsScriptTypeExecutionApiConfig: API executable entry point
  662. // configuration.
  663. type GoogleAppsScriptTypeExecutionApiConfig struct {
  664. // Access: Who has permission to run the API executable.
  665. //
  666. // Possible values:
  667. // "UNKNOWN_ACCESS" - Default value, should not be used.
  668. // "MYSELF" - Only the user who deployed the web app or executable can
  669. // access it.
  670. // Note that this is not necessarily the owner of the script project.
  671. // "DOMAIN" - Only users in the same domain as the user who deployed
  672. // the web app or
  673. // executable can access it.
  674. // "ANYONE" - Any logged in user can access the web app or executable.
  675. // "ANYONE_ANONYMOUS" - Any user, logged in or not, can access the web
  676. // app or executable.
  677. Access string `json:"access,omitempty"`
  678. // ForceSendFields is a list of field names (e.g. "Access") to
  679. // unconditionally include in API requests. By default, fields with
  680. // empty values are omitted from API requests. However, any non-pointer,
  681. // non-interface field appearing in ForceSendFields will be sent to the
  682. // server regardless of whether the field is empty or not. This may be
  683. // used to include empty fields in Patch requests.
  684. ForceSendFields []string `json:"-"`
  685. // NullFields is a list of field names (e.g. "Access") to include in API
  686. // requests with the JSON null value. By default, fields with empty
  687. // values are omitted from API requests. However, any field with an
  688. // empty value appearing in NullFields will be sent to the server as
  689. // null. It is an error if a field in this list has a non-empty value.
  690. // This may be used to include null fields in Patch requests.
  691. NullFields []string `json:"-"`
  692. }
  693. func (s *GoogleAppsScriptTypeExecutionApiConfig) MarshalJSON() ([]byte, error) {
  694. type NoMethod GoogleAppsScriptTypeExecutionApiConfig
  695. raw := NoMethod(*s)
  696. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  697. }
  698. // GoogleAppsScriptTypeExecutionApiEntryPoint: An API executable entry
  699. // point.
  700. type GoogleAppsScriptTypeExecutionApiEntryPoint struct {
  701. // EntryPointConfig: The entry point's configuration.
  702. EntryPointConfig *GoogleAppsScriptTypeExecutionApiConfig `json:"entryPointConfig,omitempty"`
  703. // ForceSendFields is a list of field names (e.g. "EntryPointConfig") to
  704. // unconditionally include in API requests. By default, fields with
  705. // empty values are omitted from API requests. However, any non-pointer,
  706. // non-interface field appearing in ForceSendFields will be sent to the
  707. // server regardless of whether the field is empty or not. This may be
  708. // used to include empty fields in Patch requests.
  709. ForceSendFields []string `json:"-"`
  710. // NullFields is a list of field names (e.g. "EntryPointConfig") to
  711. // include in API requests with the JSON null value. By default, fields
  712. // with empty values are omitted from API requests. However, any field
  713. // with an empty value appearing in NullFields will be sent to the
  714. // server as null. It is an error if a field in this list has a
  715. // non-empty value. This may be used to include null fields in Patch
  716. // requests.
  717. NullFields []string `json:"-"`
  718. }
  719. func (s *GoogleAppsScriptTypeExecutionApiEntryPoint) MarshalJSON() ([]byte, error) {
  720. type NoMethod GoogleAppsScriptTypeExecutionApiEntryPoint
  721. raw := NoMethod(*s)
  722. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  723. }
  724. // GoogleAppsScriptTypeFunction: Represents a function in a script
  725. // project.
  726. type GoogleAppsScriptTypeFunction struct {
  727. // Name: The function name in the script project.
  728. Name string `json:"name,omitempty"`
  729. // ForceSendFields is a list of field names (e.g. "Name") to
  730. // unconditionally include in API requests. By default, fields with
  731. // empty values are omitted from API requests. However, any non-pointer,
  732. // non-interface field appearing in ForceSendFields will be sent to the
  733. // server regardless of whether the field is empty or not. This may be
  734. // used to include empty fields in Patch requests.
  735. ForceSendFields []string `json:"-"`
  736. // NullFields is a list of field names (e.g. "Name") to include in API
  737. // requests with the JSON null value. By default, fields with empty
  738. // values are omitted from API requests. However, any field with an
  739. // empty value appearing in NullFields will be sent to the server as
  740. // null. It is an error if a field in this list has a non-empty value.
  741. // This may be used to include null fields in Patch requests.
  742. NullFields []string `json:"-"`
  743. }
  744. func (s *GoogleAppsScriptTypeFunction) MarshalJSON() ([]byte, error) {
  745. type NoMethod GoogleAppsScriptTypeFunction
  746. raw := NoMethod(*s)
  747. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  748. }
  749. // GoogleAppsScriptTypeFunctionSet: A set of functions. No duplicates
  750. // are permitted.
  751. type GoogleAppsScriptTypeFunctionSet struct {
  752. // Values: A list of functions composing the set.
  753. Values []*GoogleAppsScriptTypeFunction `json:"values,omitempty"`
  754. // ForceSendFields is a list of field names (e.g. "Values") to
  755. // unconditionally include in API requests. By default, fields with
  756. // empty values are omitted from API requests. However, any non-pointer,
  757. // non-interface field appearing in ForceSendFields will be sent to the
  758. // server regardless of whether the field is empty or not. This may be
  759. // used to include empty fields in Patch requests.
  760. ForceSendFields []string `json:"-"`
  761. // NullFields is a list of field names (e.g. "Values") to include in API
  762. // requests with the JSON null value. By default, fields with empty
  763. // values are omitted from API requests. However, any field with an
  764. // empty value appearing in NullFields will be sent to the server as
  765. // null. It is an error if a field in this list has a non-empty value.
  766. // This may be used to include null fields in Patch requests.
  767. NullFields []string `json:"-"`
  768. }
  769. func (s *GoogleAppsScriptTypeFunctionSet) MarshalJSON() ([]byte, error) {
  770. type NoMethod GoogleAppsScriptTypeFunctionSet
  771. raw := NoMethod(*s)
  772. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  773. }
  774. // GoogleAppsScriptTypeProcess: Representation of a single script
  775. // process execution that was started from
  776. // the script editor, a trigger, an application, or using the Apps
  777. // Script API.
  778. // This is distinct from the `Operation`
  779. // resource, which only represents executions started via the Apps
  780. // Script API.
  781. type GoogleAppsScriptTypeProcess struct {
  782. // Duration: Duration the execution spent executing.
  783. Duration string `json:"duration,omitempty"`
  784. // FunctionName: Name of the function the started the execution.
  785. FunctionName string `json:"functionName,omitempty"`
  786. // ProcessStatus: The executions status.
  787. //
  788. // Possible values:
  789. // "PROCESS_STATUS_UNSPECIFIED" - Unspecified status.
  790. // "RUNNING" - The process is currently running.
  791. // "PAUSED" - The process has paused.
  792. // "COMPLETED" - The process has completed.
  793. // "CANCELED" - The process was cancelled.
  794. // "FAILED" - The process failed.
  795. // "TIMED_OUT" - The process timed out.
  796. // "UNKNOWN" - Process status unknown.
  797. // "DELAYED" - The process is delayed, waiting for quota.
  798. ProcessStatus string `json:"processStatus,omitempty"`
  799. // ProcessType: The executions type.
  800. //
  801. // Possible values:
  802. // "PROCESS_TYPE_UNSPECIFIED" - Unspecified type.
  803. // "ADD_ON" - The process was started from an add-on entry point.
  804. // "EXECUTION_API" - The process was started using the Apps Script
  805. // API.
  806. // "TIME_DRIVEN" - The process was started from a time-based trigger.
  807. // "TRIGGER" - The process was started from an event-based trigger.
  808. // "WEBAPP" - The process was started from a web app entry point.
  809. // "EDITOR" - The process was started using the Apps Script IDE.
  810. // "SIMPLE_TRIGGER" - The process was started from a G Suite simple
  811. // trigger.
  812. // "MENU" - The process was started from a G Suite menu item.
  813. // "BATCH_TASK" - The process was started as a task in a batch job.
  814. ProcessType string `json:"processType,omitempty"`
  815. // ProjectName: Name of the script being executed.
  816. ProjectName string `json:"projectName,omitempty"`
  817. // StartTime: Time the execution started.
  818. StartTime string `json:"startTime,omitempty"`
  819. // UserAccessLevel: The executing users access level to the script.
  820. //
  821. // Possible values:
  822. // "USER_ACCESS_LEVEL_UNSPECIFIED" - User access level unspecified
  823. // "NONE" - The user has no access.
  824. // "READ" - The user has read-only access.
  825. // "WRITE" - The user has write access.
  826. // "OWNER" - The user is an owner.
  827. UserAccessLevel string `json:"userAccessLevel,omitempty"`
  828. // ForceSendFields is a list of field names (e.g. "Duration") to
  829. // unconditionally include in API requests. By default, fields with
  830. // empty values are omitted from API requests. However, any non-pointer,
  831. // non-interface field appearing in ForceSendFields will be sent to the
  832. // server regardless of whether the field is empty or not. This may be
  833. // used to include empty fields in Patch requests.
  834. ForceSendFields []string `json:"-"`
  835. // NullFields is a list of field names (e.g. "Duration") to include in
  836. // API requests with the JSON null value. By default, fields with empty
  837. // values are omitted from API requests. However, any field with an
  838. // empty value appearing in NullFields will be sent to the server as
  839. // null. It is an error if a field in this list has a non-empty value.
  840. // This may be used to include null fields in Patch requests.
  841. NullFields []string `json:"-"`
  842. }
  843. func (s *GoogleAppsScriptTypeProcess) MarshalJSON() ([]byte, error) {
  844. type NoMethod GoogleAppsScriptTypeProcess
  845. raw := NoMethod(*s)
  846. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  847. }
  848. // GoogleAppsScriptTypeUser: A simple user profile resource.
  849. type GoogleAppsScriptTypeUser struct {
  850. // Domain: The user's domain.
  851. Domain string `json:"domain,omitempty"`
  852. // Email: The user's identifying email address.
  853. Email string `json:"email,omitempty"`
  854. // Name: The user's display name.
  855. Name string `json:"name,omitempty"`
  856. // PhotoUrl: The user's photo.
  857. PhotoUrl string `json:"photoUrl,omitempty"`
  858. // ForceSendFields is a list of field names (e.g. "Domain") to
  859. // unconditionally include in API requests. By default, fields with
  860. // empty values are omitted from API requests. However, any non-pointer,
  861. // non-interface field appearing in ForceSendFields will be sent to the
  862. // server regardless of whether the field is empty or not. This may be
  863. // used to include empty fields in Patch requests.
  864. ForceSendFields []string `json:"-"`
  865. // NullFields is a list of field names (e.g. "Domain") to include in API
  866. // requests with the JSON null value. By default, fields with empty
  867. // values are omitted from API requests. However, any field with an
  868. // empty value appearing in NullFields will be sent to the server as
  869. // null. It is an error if a field in this list has a non-empty value.
  870. // This may be used to include null fields in Patch requests.
  871. NullFields []string `json:"-"`
  872. }
  873. func (s *GoogleAppsScriptTypeUser) MarshalJSON() ([]byte, error) {
  874. type NoMethod GoogleAppsScriptTypeUser
  875. raw := NoMethod(*s)
  876. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  877. }
  878. // GoogleAppsScriptTypeWebAppConfig: Web app entry point configuration.
  879. type GoogleAppsScriptTypeWebAppConfig struct {
  880. // Access: Who has permission to run the web app.
  881. //
  882. // Possible values:
  883. // "UNKNOWN_ACCESS" - Default value, should not be used.
  884. // "MYSELF" - Only the user who deployed the web app or executable can
  885. // access it.
  886. // Note that this is not necessarily the owner of the script project.
  887. // "DOMAIN" - Only users in the same domain as the user who deployed
  888. // the web app or
  889. // executable can access it.
  890. // "ANYONE" - Any logged in user can access the web app or executable.
  891. // "ANYONE_ANONYMOUS" - Any user, logged in or not, can access the web
  892. // app or executable.
  893. Access string `json:"access,omitempty"`
  894. // ExecuteAs: Who to execute the web app as.
  895. //
  896. // Possible values:
  897. // "UNKNOWN_EXECUTE_AS" - Default value, should not be used.
  898. // "USER_ACCESSING" - The script runs as the user accessing the web
  899. // app.
  900. // "USER_DEPLOYING" - The script runs as the user who deployed the web
  901. // app. Note that this is
  902. // not necessarily the owner of the script project.
  903. ExecuteAs string `json:"executeAs,omitempty"`
  904. // ForceSendFields is a list of field names (e.g. "Access") to
  905. // unconditionally include in API requests. By default, fields with
  906. // empty values are omitted from API requests. However, any non-pointer,
  907. // non-interface field appearing in ForceSendFields will be sent to the
  908. // server regardless of whether the field is empty or not. This may be
  909. // used to include empty fields in Patch requests.
  910. ForceSendFields []string `json:"-"`
  911. // NullFields is a list of field names (e.g. "Access") to include in API
  912. // requests with the JSON null value. By default, fields with empty
  913. // values are omitted from API requests. However, any field with an
  914. // empty value appearing in NullFields will be sent to the server as
  915. // null. It is an error if a field in this list has a non-empty value.
  916. // This may be used to include null fields in Patch requests.
  917. NullFields []string `json:"-"`
  918. }
  919. func (s *GoogleAppsScriptTypeWebAppConfig) MarshalJSON() ([]byte, error) {
  920. type NoMethod GoogleAppsScriptTypeWebAppConfig
  921. raw := NoMethod(*s)
  922. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  923. }
  924. // GoogleAppsScriptTypeWebAppEntryPoint: A web application entry point.
  925. type GoogleAppsScriptTypeWebAppEntryPoint struct {
  926. // EntryPointConfig: The entry point's configuration.
  927. EntryPointConfig *GoogleAppsScriptTypeWebAppConfig `json:"entryPointConfig,omitempty"`
  928. // Url: The URL for the web application.
  929. Url string `json:"url,omitempty"`
  930. // ForceSendFields is a list of field names (e.g. "EntryPointConfig") to
  931. // unconditionally include in API requests. By default, fields with
  932. // empty values are omitted from API requests. However, any non-pointer,
  933. // non-interface field appearing in ForceSendFields will be sent to the
  934. // server regardless of whether the field is empty or not. This may be
  935. // used to include empty fields in Patch requests.
  936. ForceSendFields []string `json:"-"`
  937. // NullFields is a list of field names (e.g. "EntryPointConfig") to
  938. // include in API requests with the JSON null value. By default, fields
  939. // with empty values are omitted from API requests. However, any field
  940. // with an empty value appearing in NullFields will be sent to the
  941. // server as null. It is an error if a field in this list has a
  942. // non-empty value. This may be used to include null fields in Patch
  943. // requests.
  944. NullFields []string `json:"-"`
  945. }
  946. func (s *GoogleAppsScriptTypeWebAppEntryPoint) MarshalJSON() ([]byte, error) {
  947. type NoMethod GoogleAppsScriptTypeWebAppEntryPoint
  948. raw := NoMethod(*s)
  949. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  950. }
  951. // ListDeploymentsResponse: Response with the list of deployments for
  952. // the specified Apps Script project.
  953. type ListDeploymentsResponse struct {
  954. // Deployments: The list of deployments.
  955. Deployments []*Deployment `json:"deployments,omitempty"`
  956. // NextPageToken: The token that can be used in the next call to get the
  957. // next page of
  958. // results.
  959. NextPageToken string `json:"nextPageToken,omitempty"`
  960. // ServerResponse contains the HTTP response code and headers from the
  961. // server.
  962. googleapi.ServerResponse `json:"-"`
  963. // ForceSendFields is a list of field names (e.g. "Deployments") to
  964. // unconditionally include in API requests. By default, fields with
  965. // empty values are omitted from API requests. However, any non-pointer,
  966. // non-interface field appearing in ForceSendFields will be sent to the
  967. // server regardless of whether the field is empty or not. This may be
  968. // used to include empty fields in Patch requests.
  969. ForceSendFields []string `json:"-"`
  970. // NullFields is a list of field names (e.g. "Deployments") to include
  971. // in API requests with the JSON null value. By default, fields with
  972. // empty values are omitted from API requests. However, any field with
  973. // an empty value appearing in NullFields will be sent to the server as
  974. // null. It is an error if a field in this list has a non-empty value.
  975. // This may be used to include null fields in Patch requests.
  976. NullFields []string `json:"-"`
  977. }
  978. func (s *ListDeploymentsResponse) MarshalJSON() ([]byte, error) {
  979. type NoMethod ListDeploymentsResponse
  980. raw := NoMethod(*s)
  981. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  982. }
  983. // ListScriptProcessesResponse: Response with the list of
  984. // Process resources.
  985. type ListScriptProcessesResponse struct {
  986. // NextPageToken: Token for the next page of results. If empty, there
  987. // are no more pages
  988. // remaining.
  989. NextPageToken string `json:"nextPageToken,omitempty"`
  990. // Processes: List of processes matching request parameters.
  991. Processes []*GoogleAppsScriptTypeProcess `json:"processes,omitempty"`
  992. // ServerResponse contains the HTTP response code and headers from the
  993. // server.
  994. googleapi.ServerResponse `json:"-"`
  995. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  996. // unconditionally include in API requests. By default, fields with
  997. // empty values are omitted from API requests. However, any non-pointer,
  998. // non-interface field appearing in ForceSendFields will be sent to the
  999. // server regardless of whether the field is empty or not. This may be
  1000. // used to include empty fields in Patch requests.
  1001. ForceSendFields []string `json:"-"`
  1002. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1003. // in API requests with the JSON null value. By default, fields with
  1004. // empty values are omitted from API requests. However, any field with
  1005. // an empty value appearing in NullFields will be sent to the server as
  1006. // null. It is an error if a field in this list has a non-empty value.
  1007. // This may be used to include null fields in Patch requests.
  1008. NullFields []string `json:"-"`
  1009. }
  1010. func (s *ListScriptProcessesResponse) MarshalJSON() ([]byte, error) {
  1011. type NoMethod ListScriptProcessesResponse
  1012. raw := NoMethod(*s)
  1013. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1014. }
  1015. // ListUserProcessesResponse: Response with the list of
  1016. // Process resources.
  1017. type ListUserProcessesResponse struct {
  1018. // NextPageToken: Token for the next page of results. If empty, there
  1019. // are no more pages
  1020. // remaining.
  1021. NextPageToken string `json:"nextPageToken,omitempty"`
  1022. // Processes: List of processes matching request parameters.
  1023. Processes []*GoogleAppsScriptTypeProcess `json:"processes,omitempty"`
  1024. // ServerResponse contains the HTTP response code and headers from the
  1025. // server.
  1026. googleapi.ServerResponse `json:"-"`
  1027. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1028. // unconditionally include in API requests. By default, fields with
  1029. // empty values are omitted from API requests. However, any non-pointer,
  1030. // non-interface field appearing in ForceSendFields will be sent to the
  1031. // server regardless of whether the field is empty or not. This may be
  1032. // used to include empty fields in Patch requests.
  1033. ForceSendFields []string `json:"-"`
  1034. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1035. // in API requests with the JSON null value. By default, fields with
  1036. // empty values are omitted from API requests. However, any field with
  1037. // an empty value appearing in NullFields will be sent to the server as
  1038. // null. It is an error if a field in this list has a non-empty value.
  1039. // This may be used to include null fields in Patch requests.
  1040. NullFields []string `json:"-"`
  1041. }
  1042. func (s *ListUserProcessesResponse) MarshalJSON() ([]byte, error) {
  1043. type NoMethod ListUserProcessesResponse
  1044. raw := NoMethod(*s)
  1045. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1046. }
  1047. // ListVersionsResponse: Response with the list of the versions for the
  1048. // specified script project.
  1049. type ListVersionsResponse struct {
  1050. // NextPageToken: The token use to fetch the next page of records. if
  1051. // not exist in the
  1052. // response, that means no more versions to list.
  1053. NextPageToken string `json:"nextPageToken,omitempty"`
  1054. // Versions: The list of versions.
  1055. Versions []*Version `json:"versions,omitempty"`
  1056. // ServerResponse contains the HTTP response code and headers from the
  1057. // server.
  1058. googleapi.ServerResponse `json:"-"`
  1059. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1060. // unconditionally include in API requests. By default, fields with
  1061. // empty values are omitted from API requests. However, any non-pointer,
  1062. // non-interface field appearing in ForceSendFields will be sent to the
  1063. // server regardless of whether the field is empty or not. This may be
  1064. // used to include empty fields in Patch requests.
  1065. ForceSendFields []string `json:"-"`
  1066. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1067. // in API requests with the JSON null value. By default, fields with
  1068. // empty values are omitted from API requests. However, any field with
  1069. // an empty value appearing in NullFields will be sent to the server as
  1070. // null. It is an error if a field in this list has a non-empty value.
  1071. // This may be used to include null fields in Patch requests.
  1072. NullFields []string `json:"-"`
  1073. }
  1074. func (s *ListVersionsResponse) MarshalJSON() ([]byte, error) {
  1075. type NoMethod ListVersionsResponse
  1076. raw := NoMethod(*s)
  1077. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1078. }
  1079. // Metrics: Resource containing usage stats for a given script, based on
  1080. // the supplied
  1081. // filter and mask present in the request.
  1082. type Metrics struct {
  1083. // ActiveUsers: Number of active users.
  1084. ActiveUsers []*MetricsValue `json:"activeUsers,omitempty"`
  1085. // FailedExecutions: Number of failed executions.
  1086. FailedExecutions []*MetricsValue `json:"failedExecutions,omitempty"`
  1087. // TotalExecutions: Number of total executions.
  1088. TotalExecutions []*MetricsValue `json:"totalExecutions,omitempty"`
  1089. // ServerResponse contains the HTTP response code and headers from the
  1090. // server.
  1091. googleapi.ServerResponse `json:"-"`
  1092. // ForceSendFields is a list of field names (e.g. "ActiveUsers") to
  1093. // unconditionally include in API requests. By default, fields with
  1094. // empty values are omitted from API requests. However, any non-pointer,
  1095. // non-interface field appearing in ForceSendFields will be sent to the
  1096. // server regardless of whether the field is empty or not. This may be
  1097. // used to include empty fields in Patch requests.
  1098. ForceSendFields []string `json:"-"`
  1099. // NullFields is a list of field names (e.g. "ActiveUsers") to include
  1100. // in API requests with the JSON null value. By default, fields with
  1101. // empty values are omitted from API requests. However, any field with
  1102. // an empty value appearing in NullFields will be sent to the server as
  1103. // null. It is an error if a field in this list has a non-empty value.
  1104. // This may be used to include null fields in Patch requests.
  1105. NullFields []string `json:"-"`
  1106. }
  1107. func (s *Metrics) MarshalJSON() ([]byte, error) {
  1108. type NoMethod Metrics
  1109. raw := NoMethod(*s)
  1110. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1111. }
  1112. // MetricsValue: Metrics value that holds number of executions counted.
  1113. type MetricsValue struct {
  1114. // EndTime: Required field indicating the end time of the interval.
  1115. EndTime string `json:"endTime,omitempty"`
  1116. // StartTime: Required field indicating the start time of the interval.
  1117. StartTime string `json:"startTime,omitempty"`
  1118. // Value: Indicates the number of executions counted.
  1119. Value uint64 `json:"value,omitempty,string"`
  1120. // ForceSendFields is a list of field names (e.g. "EndTime") to
  1121. // unconditionally include in API requests. By default, fields with
  1122. // empty values are omitted from API requests. However, any non-pointer,
  1123. // non-interface field appearing in ForceSendFields will be sent to the
  1124. // server regardless of whether the field is empty or not. This may be
  1125. // used to include empty fields in Patch requests.
  1126. ForceSendFields []string `json:"-"`
  1127. // NullFields is a list of field names (e.g. "EndTime") to include in
  1128. // API requests with the JSON null value. By default, fields with empty
  1129. // values are omitted from API requests. However, any field with an
  1130. // empty value appearing in NullFields will be sent to the server as
  1131. // null. It is an error if a field in this list has a non-empty value.
  1132. // This may be used to include null fields in Patch requests.
  1133. NullFields []string `json:"-"`
  1134. }
  1135. func (s *MetricsValue) MarshalJSON() ([]byte, error) {
  1136. type NoMethod MetricsValue
  1137. raw := NoMethod(*s)
  1138. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1139. }
  1140. // Operation: A representation of an execution of an Apps Script
  1141. // function started with run. The execution response does not arrive
  1142. // until the function finishes executing. The maximum execution runtime
  1143. // is listed in the [Apps Script quotas
  1144. // guide](/apps-script/guides/services/quotas#current_limitations).
  1145. // <p>After execution has started, it can have one of four outcomes:</p>
  1146. // <ul> <li> If the script function returns successfully, the
  1147. // response field contains an
  1148. // ExecutionResponse object
  1149. // with the function's return value in the object's `result`
  1150. // field.</li>
  1151. // <li> If the script function (or Apps Script itself) throws an
  1152. // exception, the
  1153. // error field contains a
  1154. // Status object. The `Status` object's `details`
  1155. // field contains an array with a single
  1156. // ExecutionError object that
  1157. // provides information about the nature of the error.</li>
  1158. // <li> If the execution has not yet completed,
  1159. // the done field is `false` and
  1160. // the neither the `response` nor `error` fields are
  1161. // present.</li>
  1162. // <li> If the `run` call itself fails (for example, because of a
  1163. // malformed request or an authorization error), the method returns an
  1164. // HTTP
  1165. // response code in the 4XX range with a different format for the
  1166. // response
  1167. // body. Client libraries automatically convert a 4XX response into
  1168. // an
  1169. // exception class.</li>
  1170. // </ul>
  1171. type Operation struct {
  1172. // Done: This field indicates whether the script execution has
  1173. // completed. A completed execution has a populated `response` field
  1174. // containing the ExecutionResponse from function that was executed.
  1175. Done bool `json:"done,omitempty"`
  1176. // Error: If a `run` call succeeds but the script function (or Apps
  1177. // Script itself) throws an exception, this field contains a Status
  1178. // object. The `Status` object's `details` field contains an array with
  1179. // a single ExecutionError object that provides information about the
  1180. // nature of the error.
  1181. Error *Status `json:"error,omitempty"`
  1182. // Response: If the script function returns successfully, this field
  1183. // contains an ExecutionResponse object with the function's return
  1184. // value.
  1185. Response googleapi.RawMessage `json:"response,omitempty"`
  1186. // ServerResponse contains the HTTP response code and headers from the
  1187. // server.
  1188. googleapi.ServerResponse `json:"-"`
  1189. // ForceSendFields is a list of field names (e.g. "Done") to
  1190. // unconditionally include in API requests. By default, fields with
  1191. // empty values are omitted from API requests. However, any non-pointer,
  1192. // non-interface field appearing in ForceSendFields will be sent to the
  1193. // server regardless of whether the field is empty or not. This may be
  1194. // used to include empty fields in Patch requests.
  1195. ForceSendFields []string `json:"-"`
  1196. // NullFields is a list of field names (e.g. "Done") to include in API
  1197. // requests with the JSON null value. By default, fields with empty
  1198. // values are omitted from API requests. However, any field with an
  1199. // empty value appearing in NullFields will be sent to the server as
  1200. // null. It is an error if a field in this list has a non-empty value.
  1201. // This may be used to include null fields in Patch requests.
  1202. NullFields []string `json:"-"`
  1203. }
  1204. func (s *Operation) MarshalJSON() ([]byte, error) {
  1205. type NoMethod Operation
  1206. raw := NoMethod(*s)
  1207. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1208. }
  1209. // Project: The script project resource.
  1210. type Project struct {
  1211. // CreateTime: When the script was created.
  1212. CreateTime string `json:"createTime,omitempty"`
  1213. // Creator: User who originally created the script.
  1214. Creator *GoogleAppsScriptTypeUser `json:"creator,omitempty"`
  1215. // LastModifyUser: User who last modified the script.
  1216. LastModifyUser *GoogleAppsScriptTypeUser `json:"lastModifyUser,omitempty"`
  1217. // ParentId: The parent's Drive ID that the script will be attached to.
  1218. // This is usually
  1219. // the ID of a Google Document or Google Sheet. This filed is optional,
  1220. // and
  1221. // if not set, a stand-alone script will be created.
  1222. ParentId string `json:"parentId,omitempty"`
  1223. // ScriptId: The script project's Drive ID.
  1224. ScriptId string `json:"scriptId,omitempty"`
  1225. // Title: The title for the project.
  1226. Title string `json:"title,omitempty"`
  1227. // UpdateTime: When the script was last updated.
  1228. UpdateTime string `json:"updateTime,omitempty"`
  1229. // ServerResponse contains the HTTP response code and headers from the
  1230. // server.
  1231. googleapi.ServerResponse `json:"-"`
  1232. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1233. // unconditionally include in API requests. By default, fields with
  1234. // empty values are omitted from API requests. However, any non-pointer,
  1235. // non-interface field appearing in ForceSendFields will be sent to the
  1236. // server regardless of whether the field is empty or not. This may be
  1237. // used to include empty fields in Patch requests.
  1238. ForceSendFields []string `json:"-"`
  1239. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1240. // API requests with the JSON null value. By default, fields with empty
  1241. // values are omitted from API requests. However, any field with an
  1242. // empty value appearing in NullFields will be sent to the server as
  1243. // null. It is an error if a field in this list has a non-empty value.
  1244. // This may be used to include null fields in Patch requests.
  1245. NullFields []string `json:"-"`
  1246. }
  1247. func (s *Project) MarshalJSON() ([]byte, error) {
  1248. type NoMethod Project
  1249. raw := NoMethod(*s)
  1250. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1251. }
  1252. // ScriptStackTraceElement: A stack trace through the script that shows
  1253. // where the execution failed.
  1254. type ScriptStackTraceElement struct {
  1255. // Function: The name of the function that failed.
  1256. Function string `json:"function,omitempty"`
  1257. // LineNumber: The line number where the script failed.
  1258. LineNumber int64 `json:"lineNumber,omitempty"`
  1259. // ForceSendFields is a list of field names (e.g. "Function") to
  1260. // unconditionally include in API requests. By default, fields with
  1261. // empty values are omitted from API requests. However, any non-pointer,
  1262. // non-interface field appearing in ForceSendFields will be sent to the
  1263. // server regardless of whether the field is empty or not. This may be
  1264. // used to include empty fields in Patch requests.
  1265. ForceSendFields []string `json:"-"`
  1266. // NullFields is a list of field names (e.g. "Function") to include in
  1267. // API requests with the JSON null value. By default, fields with empty
  1268. // values are omitted from API requests. However, any field with an
  1269. // empty value appearing in NullFields will be sent to the server as
  1270. // null. It is an error if a field in this list has a non-empty value.
  1271. // This may be used to include null fields in Patch requests.
  1272. NullFields []string `json:"-"`
  1273. }
  1274. func (s *ScriptStackTraceElement) MarshalJSON() ([]byte, error) {
  1275. type NoMethod ScriptStackTraceElement
  1276. raw := NoMethod(*s)
  1277. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1278. }
  1279. // Status: If a `run` call succeeds but the script function (or Apps
  1280. // Script itself) throws an exception, the response body's error field
  1281. // contains this `Status` object.
  1282. type Status struct {
  1283. // Code: The status code. For this API, this value either: <ul> <li> 10,
  1284. // indicating a `SCRIPT_TIMEOUT` error,</li> <li> 3, indicating an
  1285. // `INVALID_ARGUMENT` error, or</li> <li> 1, indicating a `CANCELLED`
  1286. // execution.</li> </ul>
  1287. Code int64 `json:"code,omitempty"`
  1288. // Details: An array that contains a single ExecutionError object that
  1289. // provides information about the nature of the error.
  1290. Details []googleapi.RawMessage `json:"details,omitempty"`
  1291. // Message: A developer-facing error message, which is in English. Any
  1292. // user-facing error message is localized and sent in the details field,
  1293. // or localized by the client.
  1294. Message string `json:"message,omitempty"`
  1295. // ForceSendFields is a list of field names (e.g. "Code") to
  1296. // unconditionally include in API requests. By default, fields with
  1297. // empty values are omitted from API requests. However, any non-pointer,
  1298. // non-interface field appearing in ForceSendFields will be sent to the
  1299. // server regardless of whether the field is empty or not. This may be
  1300. // used to include empty fields in Patch requests.
  1301. ForceSendFields []string `json:"-"`
  1302. // NullFields is a list of field names (e.g. "Code") to include in API
  1303. // requests with the JSON null value. By default, fields with empty
  1304. // values are omitted from API requests. However, any field with an
  1305. // empty value appearing in NullFields will be sent to the server as
  1306. // null. It is an error if a field in this list has a non-empty value.
  1307. // This may be used to include null fields in Patch requests.
  1308. NullFields []string `json:"-"`
  1309. }
  1310. func (s *Status) MarshalJSON() ([]byte, error) {
  1311. type NoMethod Status
  1312. raw := NoMethod(*s)
  1313. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1314. }
  1315. // UpdateDeploymentRequest: Request with deployment information to
  1316. // update an existing deployment.
  1317. type UpdateDeploymentRequest struct {
  1318. // DeploymentConfig: The deployment configuration.
  1319. DeploymentConfig *DeploymentConfig `json:"deploymentConfig,omitempty"`
  1320. // ForceSendFields is a list of field names (e.g. "DeploymentConfig") to
  1321. // unconditionally include in API requests. By default, fields with
  1322. // empty values are omitted from API requests. However, any non-pointer,
  1323. // non-interface field appearing in ForceSendFields will be sent to the
  1324. // server regardless of whether the field is empty or not. This may be
  1325. // used to include empty fields in Patch requests.
  1326. ForceSendFields []string `json:"-"`
  1327. // NullFields is a list of field names (e.g. "DeploymentConfig") to
  1328. // include in API requests with the JSON null value. By default, fields
  1329. // with empty values are omitted from API requests. However, any field
  1330. // with an empty value appearing in NullFields will be sent to the
  1331. // server as null. It is an error if a field in this list has a
  1332. // non-empty value. This may be used to include null fields in Patch
  1333. // requests.
  1334. NullFields []string `json:"-"`
  1335. }
  1336. func (s *UpdateDeploymentRequest) MarshalJSON() ([]byte, error) {
  1337. type NoMethod UpdateDeploymentRequest
  1338. raw := NoMethod(*s)
  1339. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1340. }
  1341. // Version: A resource representing a script project version. A version
  1342. // is a "snapshot"
  1343. // of a script project and is similar to a read-only branched release.
  1344. // When
  1345. // creating deployments, the version to use must be specified.
  1346. type Version struct {
  1347. // CreateTime: When the version was created.
  1348. CreateTime string `json:"createTime,omitempty"`
  1349. // Description: The description for this version.
  1350. Description string `json:"description,omitempty"`
  1351. // ScriptId: The script project's Drive ID.
  1352. ScriptId string `json:"scriptId,omitempty"`
  1353. // VersionNumber: The incremental ID that is created by Apps Script when
  1354. // a version is
  1355. // created. This is system assigned number and is immutable once
  1356. // created.
  1357. VersionNumber int64 `json:"versionNumber,omitempty"`
  1358. // ServerResponse contains the HTTP response code and headers from the
  1359. // server.
  1360. googleapi.ServerResponse `json:"-"`
  1361. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1362. // unconditionally include in API requests. By default, fields with
  1363. // empty values are omitted from API requests. However, any non-pointer,
  1364. // non-interface field appearing in ForceSendFields will be sent to the
  1365. // server regardless of whether the field is empty or not. This may be
  1366. // used to include empty fields in Patch requests.
  1367. ForceSendFields []string `json:"-"`
  1368. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1369. // API requests with the JSON null value. By default, fields with empty
  1370. // values are omitted from API requests. However, any field with an
  1371. // empty value appearing in NullFields will be sent to the server as
  1372. // null. It is an error if a field in this list has a non-empty value.
  1373. // This may be used to include null fields in Patch requests.
  1374. NullFields []string `json:"-"`
  1375. }
  1376. func (s *Version) MarshalJSON() ([]byte, error) {
  1377. type NoMethod Version
  1378. raw := NoMethod(*s)
  1379. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1380. }
  1381. // method id "script.processes.list":
  1382. type ProcessesListCall struct {
  1383. s *Service
  1384. urlParams_ gensupport.URLParams
  1385. ifNoneMatch_ string
  1386. ctx_ context.Context
  1387. header_ http.Header
  1388. }
  1389. // List: List information about processes made by or on behalf of a
  1390. // user,
  1391. // such as process type and current status.
  1392. func (r *ProcessesService) List() *ProcessesListCall {
  1393. c := &ProcessesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1394. return c
  1395. }
  1396. // PageSize sets the optional parameter "pageSize": The maximum number
  1397. // of returned processes per page of results. Defaults to
  1398. // 50.
  1399. func (c *ProcessesListCall) PageSize(pageSize int64) *ProcessesListCall {
  1400. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1401. return c
  1402. }
  1403. // PageToken sets the optional parameter "pageToken": The token for
  1404. // continuing a previous list request on the next page. This
  1405. // should be set to the value of `nextPageToken` from a previous
  1406. // response.
  1407. func (c *ProcessesListCall) PageToken(pageToken string) *ProcessesListCall {
  1408. c.urlParams_.Set("pageToken", pageToken)
  1409. return c
  1410. }
  1411. // UserProcessFilterDeploymentId sets the optional parameter
  1412. // "userProcessFilter.deploymentId": Optional field used to limit
  1413. // returned processes to those originating from
  1414. // projects with a specific deployment ID.
  1415. func (c *ProcessesListCall) UserProcessFilterDeploymentId(userProcessFilterDeploymentId string) *ProcessesListCall {
  1416. c.urlParams_.Set("userProcessFilter.deploymentId", userProcessFilterDeploymentId)
  1417. return c
  1418. }
  1419. // UserProcessFilterEndTime sets the optional parameter
  1420. // "userProcessFilter.endTime": Optional field used to limit returned
  1421. // processes to those that completed
  1422. // on or before the given timestamp.
  1423. func (c *ProcessesListCall) UserProcessFilterEndTime(userProcessFilterEndTime string) *ProcessesListCall {
  1424. c.urlParams_.Set("userProcessFilter.endTime", userProcessFilterEndTime)
  1425. return c
  1426. }
  1427. // UserProcessFilterFunctionName sets the optional parameter
  1428. // "userProcessFilter.functionName": Optional field used to limit
  1429. // returned processes to those originating from
  1430. // a script function with the given function name.
  1431. func (c *ProcessesListCall) UserProcessFilterFunctionName(userProcessFilterFunctionName string) *ProcessesListCall {
  1432. c.urlParams_.Set("userProcessFilter.functionName", userProcessFilterFunctionName)
  1433. return c
  1434. }
  1435. // UserProcessFilterProjectName sets the optional parameter
  1436. // "userProcessFilter.projectName": Optional field used to limit
  1437. // returned processes to those originating from
  1438. // projects with project names containing a specific string.
  1439. func (c *ProcessesListCall) UserProcessFilterProjectName(userProcessFilterProjectName string) *ProcessesListCall {
  1440. c.urlParams_.Set("userProcessFilter.projectName", userProcessFilterProjectName)
  1441. return c
  1442. }
  1443. // UserProcessFilterScriptId sets the optional parameter
  1444. // "userProcessFilter.scriptId": Optional field used to limit returned
  1445. // processes to those originating from
  1446. // projects with a specific script ID.
  1447. func (c *ProcessesListCall) UserProcessFilterScriptId(userProcessFilterScriptId string) *ProcessesListCall {
  1448. c.urlParams_.Set("userProcessFilter.scriptId", userProcessFilterScriptId)
  1449. return c
  1450. }
  1451. // UserProcessFilterStartTime sets the optional parameter
  1452. // "userProcessFilter.startTime": Optional field used to limit returned
  1453. // processes to those that were
  1454. // started on or after the given timestamp.
  1455. func (c *ProcessesListCall) UserProcessFilterStartTime(userProcessFilterStartTime string) *ProcessesListCall {
  1456. c.urlParams_.Set("userProcessFilter.startTime", userProcessFilterStartTime)
  1457. return c
  1458. }
  1459. // UserProcessFilterStatuses sets the optional parameter
  1460. // "userProcessFilter.statuses": Optional field used to limit returned
  1461. // processes to those having one of
  1462. // the specified process statuses.
  1463. //
  1464. // Possible values:
  1465. // "PROCESS_STATUS_UNSPECIFIED"
  1466. // "RUNNING"
  1467. // "PAUSED"
  1468. // "COMPLETED"
  1469. // "CANCELED"
  1470. // "FAILED"
  1471. // "TIMED_OUT"
  1472. // "UNKNOWN"
  1473. // "DELAYED"
  1474. func (c *ProcessesListCall) UserProcessFilterStatuses(userProcessFilterStatuses ...string) *ProcessesListCall {
  1475. c.urlParams_.SetMulti("userProcessFilter.statuses", append([]string{}, userProcessFilterStatuses...))
  1476. return c
  1477. }
  1478. // UserProcessFilterTypes sets the optional parameter
  1479. // "userProcessFilter.types": Optional field used to limit returned
  1480. // processes to those having one of
  1481. // the specified process types.
  1482. //
  1483. // Possible values:
  1484. // "PROCESS_TYPE_UNSPECIFIED"
  1485. // "ADD_ON"
  1486. // "EXECUTION_API"
  1487. // "TIME_DRIVEN"
  1488. // "TRIGGER"
  1489. // "WEBAPP"
  1490. // "EDITOR"
  1491. // "SIMPLE_TRIGGER"
  1492. // "MENU"
  1493. // "BATCH_TASK"
  1494. func (c *ProcessesListCall) UserProcessFilterTypes(userProcessFilterTypes ...string) *ProcessesListCall {
  1495. c.urlParams_.SetMulti("userProcessFilter.types", append([]string{}, userProcessFilterTypes...))
  1496. return c
  1497. }
  1498. // UserProcessFilterUserAccessLevels sets the optional parameter
  1499. // "userProcessFilter.userAccessLevels": Optional field used to limit
  1500. // returned processes to those having one of
  1501. // the specified user access levels.
  1502. //
  1503. // Possible values:
  1504. // "USER_ACCESS_LEVEL_UNSPECIFIED"
  1505. // "NONE"
  1506. // "READ"
  1507. // "WRITE"
  1508. // "OWNER"
  1509. func (c *ProcessesListCall) UserProcessFilterUserAccessLevels(userProcessFilterUserAccessLevels ...string) *ProcessesListCall {
  1510. c.urlParams_.SetMulti("userProcessFilter.userAccessLevels", append([]string{}, userProcessFilterUserAccessLevels...))
  1511. return c
  1512. }
  1513. // Fields allows partial responses to be retrieved. See
  1514. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1515. // for more information.
  1516. func (c *ProcessesListCall) Fields(s ...googleapi.Field) *ProcessesListCall {
  1517. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1518. return c
  1519. }
  1520. // IfNoneMatch sets the optional parameter which makes the operation
  1521. // fail if the object's ETag matches the given value. This is useful for
  1522. // getting updates only after the object has changed since the last
  1523. // request. Use googleapi.IsNotModified to check whether the response
  1524. // error from Do is the result of In-None-Match.
  1525. func (c *ProcessesListCall) IfNoneMatch(entityTag string) *ProcessesListCall {
  1526. c.ifNoneMatch_ = entityTag
  1527. return c
  1528. }
  1529. // Context sets the context to be used in this call's Do method. Any
  1530. // pending HTTP request will be aborted if the provided context is
  1531. // canceled.
  1532. func (c *ProcessesListCall) Context(ctx context.Context) *ProcessesListCall {
  1533. c.ctx_ = ctx
  1534. return c
  1535. }
  1536. // Header returns an http.Header that can be modified by the caller to
  1537. // add HTTP headers to the request.
  1538. func (c *ProcessesListCall) Header() http.Header {
  1539. if c.header_ == nil {
  1540. c.header_ = make(http.Header)
  1541. }
  1542. return c.header_
  1543. }
  1544. func (c *ProcessesListCall) doRequest(alt string) (*http.Response, error) {
  1545. reqHeaders := make(http.Header)
  1546. for k, v := range c.header_ {
  1547. reqHeaders[k] = v
  1548. }
  1549. reqHeaders.Set("User-Agent", c.s.userAgent())
  1550. if c.ifNoneMatch_ != "" {
  1551. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1552. }
  1553. var body io.Reader = nil
  1554. c.urlParams_.Set("alt", alt)
  1555. c.urlParams_.Set("prettyPrint", "false")
  1556. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/processes")
  1557. urls += "?" + c.urlParams_.Encode()
  1558. req, err := http.NewRequest("GET", urls, body)
  1559. if err != nil {
  1560. return nil, err
  1561. }
  1562. req.Header = reqHeaders
  1563. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1564. }
  1565. // Do executes the "script.processes.list" call.
  1566. // Exactly one of *ListUserProcessesResponse or error will be non-nil.
  1567. // Any non-2xx status code is an error. Response headers are in either
  1568. // *ListUserProcessesResponse.ServerResponse.Header or (if a response
  1569. // was returned at all) in error.(*googleapi.Error).Header. Use
  1570. // googleapi.IsNotModified to check whether the returned error was
  1571. // because http.StatusNotModified was returned.
  1572. func (c *ProcessesListCall) Do(opts ...googleapi.CallOption) (*ListUserProcessesResponse, error) {
  1573. gensupport.SetOptions(c.urlParams_, opts...)
  1574. res, err := c.doRequest("json")
  1575. if res != nil && res.StatusCode == http.StatusNotModified {
  1576. if res.Body != nil {
  1577. res.Body.Close()
  1578. }
  1579. return nil, &googleapi.Error{
  1580. Code: res.StatusCode,
  1581. Header: res.Header,
  1582. }
  1583. }
  1584. if err != nil {
  1585. return nil, err
  1586. }
  1587. defer googleapi.CloseBody(res)
  1588. if err := googleapi.CheckResponse(res); err != nil {
  1589. return nil, err
  1590. }
  1591. ret := &ListUserProcessesResponse{
  1592. ServerResponse: googleapi.ServerResponse{
  1593. Header: res.Header,
  1594. HTTPStatusCode: res.StatusCode,
  1595. },
  1596. }
  1597. target := &ret
  1598. if err := gensupport.DecodeResponse(target, res); err != nil {
  1599. return nil, err
  1600. }
  1601. return ret, nil
  1602. // {
  1603. // "description": "List information about processes made by or on behalf of a user,\nsuch as process type and current status.",
  1604. // "flatPath": "v1/processes",
  1605. // "httpMethod": "GET",
  1606. // "id": "script.processes.list",
  1607. // "parameterOrder": [],
  1608. // "parameters": {
  1609. // "pageSize": {
  1610. // "description": "The maximum number of returned processes per page of results. Defaults to\n50.",
  1611. // "format": "int32",
  1612. // "location": "query",
  1613. // "type": "integer"
  1614. // },
  1615. // "pageToken": {
  1616. // "description": "The token for continuing a previous list request on the next page. This\nshould be set to the value of `nextPageToken` from a previous response.",
  1617. // "location": "query",
  1618. // "type": "string"
  1619. // },
  1620. // "userProcessFilter.deploymentId": {
  1621. // "description": "Optional field used to limit returned processes to those originating from\nprojects with a specific deployment ID.",
  1622. // "location": "query",
  1623. // "type": "string"
  1624. // },
  1625. // "userProcessFilter.endTime": {
  1626. // "description": "Optional field used to limit returned processes to those that completed\non or before the given timestamp.",
  1627. // "format": "google-datetime",
  1628. // "location": "query",
  1629. // "type": "string"
  1630. // },
  1631. // "userProcessFilter.functionName": {
  1632. // "description": "Optional field used to limit returned processes to those originating from\na script function with the given function name.",
  1633. // "location": "query",
  1634. // "type": "string"
  1635. // },
  1636. // "userProcessFilter.projectName": {
  1637. // "description": "Optional field used to limit returned processes to those originating from\nprojects with project names containing a specific string.",
  1638. // "location": "query",
  1639. // "type": "string"
  1640. // },
  1641. // "userProcessFilter.scriptId": {
  1642. // "description": "Optional field used to limit returned processes to those originating from\nprojects with a specific script ID.",
  1643. // "location": "query",
  1644. // "type": "string"
  1645. // },
  1646. // "userProcessFilter.startTime": {
  1647. // "description": "Optional field used to limit returned processes to those that were\nstarted on or after the given timestamp.",
  1648. // "format": "google-datetime",
  1649. // "location": "query",
  1650. // "type": "string"
  1651. // },
  1652. // "userProcessFilter.statuses": {
  1653. // "description": "Optional field used to limit returned processes to those having one of\nthe specified process statuses.",
  1654. // "enum": [
  1655. // "PROCESS_STATUS_UNSPECIFIED",
  1656. // "RUNNING",
  1657. // "PAUSED",
  1658. // "COMPLETED",
  1659. // "CANCELED",
  1660. // "FAILED",
  1661. // "TIMED_OUT",
  1662. // "UNKNOWN",
  1663. // "DELAYED"
  1664. // ],
  1665. // "location": "query",
  1666. // "repeated": true,
  1667. // "type": "string"
  1668. // },
  1669. // "userProcessFilter.types": {
  1670. // "description": "Optional field used to limit returned processes to those having one of\nthe specified process types.",
  1671. // "enum": [
  1672. // "PROCESS_TYPE_UNSPECIFIED",
  1673. // "ADD_ON",
  1674. // "EXECUTION_API",
  1675. // "TIME_DRIVEN",
  1676. // "TRIGGER",
  1677. // "WEBAPP",
  1678. // "EDITOR",
  1679. // "SIMPLE_TRIGGER",
  1680. // "MENU",
  1681. // "BATCH_TASK"
  1682. // ],
  1683. // "location": "query",
  1684. // "repeated": true,
  1685. // "type": "string"
  1686. // },
  1687. // "userProcessFilter.userAccessLevels": {
  1688. // "description": "Optional field used to limit returned processes to those having one of\nthe specified user access levels.",
  1689. // "enum": [
  1690. // "USER_ACCESS_LEVEL_UNSPECIFIED",
  1691. // "NONE",
  1692. // "READ",
  1693. // "WRITE",
  1694. // "OWNER"
  1695. // ],
  1696. // "location": "query",
  1697. // "repeated": true,
  1698. // "type": "string"
  1699. // }
  1700. // },
  1701. // "path": "v1/processes",
  1702. // "response": {
  1703. // "$ref": "ListUserProcessesResponse"
  1704. // },
  1705. // "scopes": [
  1706. // "https://www.googleapis.com/auth/script.processes"
  1707. // ]
  1708. // }
  1709. }
  1710. // Pages invokes f for each page of results.
  1711. // A non-nil error returned from f will halt the iteration.
  1712. // The provided context supersedes any context provided to the Context method.
  1713. func (c *ProcessesListCall) Pages(ctx context.Context, f func(*ListUserProcessesResponse) error) error {
  1714. c.ctx_ = ctx
  1715. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1716. for {
  1717. x, err := c.Do()
  1718. if err != nil {
  1719. return err
  1720. }
  1721. if err := f(x); err != nil {
  1722. return err
  1723. }
  1724. if x.NextPageToken == "" {
  1725. return nil
  1726. }
  1727. c.PageToken(x.NextPageToken)
  1728. }
  1729. }
  1730. // method id "script.processes.listScriptProcesses":
  1731. type ProcessesListScriptProcessesCall struct {
  1732. s *Service
  1733. urlParams_ gensupport.URLParams
  1734. ifNoneMatch_ string
  1735. ctx_ context.Context
  1736. header_ http.Header
  1737. }
  1738. // ListScriptProcesses: List information about a script's executed
  1739. // processes, such as process type
  1740. // and current status.
  1741. func (r *ProcessesService) ListScriptProcesses() *ProcessesListScriptProcessesCall {
  1742. c := &ProcessesListScriptProcessesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1743. return c
  1744. }
  1745. // PageSize sets the optional parameter "pageSize": The maximum number
  1746. // of returned processes per page of results. Defaults to
  1747. // 50.
  1748. func (c *ProcessesListScriptProcessesCall) PageSize(pageSize int64) *ProcessesListScriptProcessesCall {
  1749. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1750. return c
  1751. }
  1752. // PageToken sets the optional parameter "pageToken": The token for
  1753. // continuing a previous list request on the next page. This
  1754. // should be set to the value of `nextPageToken` from a previous
  1755. // response.
  1756. func (c *ProcessesListScriptProcessesCall) PageToken(pageToken string) *ProcessesListScriptProcessesCall {
  1757. c.urlParams_.Set("pageToken", pageToken)
  1758. return c
  1759. }
  1760. // ScriptId sets the optional parameter "scriptId": The script ID of the
  1761. // project whose processes are listed.
  1762. func (c *ProcessesListScriptProcessesCall) ScriptId(scriptId string) *ProcessesListScriptProcessesCall {
  1763. c.urlParams_.Set("scriptId", scriptId)
  1764. return c
  1765. }
  1766. // ScriptProcessFilterDeploymentId sets the optional parameter
  1767. // "scriptProcessFilter.deploymentId": Optional field used to limit
  1768. // returned processes to those originating from
  1769. // projects with a specific deployment ID.
  1770. func (c *ProcessesListScriptProcessesCall) ScriptProcessFilterDeploymentId(scriptProcessFilterDeploymentId string) *ProcessesListScriptProcessesCall {
  1771. c.urlParams_.Set("scriptProcessFilter.deploymentId", scriptProcessFilterDeploymentId)
  1772. return c
  1773. }
  1774. // ScriptProcessFilterEndTime sets the optional parameter
  1775. // "scriptProcessFilter.endTime": Optional field used to limit returned
  1776. // processes to those that completed
  1777. // on or before the given timestamp.
  1778. func (c *ProcessesListScriptProcessesCall) ScriptProcessFilterEndTime(scriptProcessFilterEndTime string) *ProcessesListScriptProcessesCall {
  1779. c.urlParams_.Set("scriptProcessFilter.endTime", scriptProcessFilterEndTime)
  1780. return c
  1781. }
  1782. // ScriptProcessFilterFunctionName sets the optional parameter
  1783. // "scriptProcessFilter.functionName": Optional field used to limit
  1784. // returned processes to those originating from
  1785. // a script function with the given function name.
  1786. func (c *ProcessesListScriptProcessesCall) ScriptProcessFilterFunctionName(scriptProcessFilterFunctionName string) *ProcessesListScriptProcessesCall {
  1787. c.urlParams_.Set("scriptProcessFilter.functionName", scriptProcessFilterFunctionName)
  1788. return c
  1789. }
  1790. // ScriptProcessFilterStartTime sets the optional parameter
  1791. // "scriptProcessFilter.startTime": Optional field used to limit
  1792. // returned processes to those that were
  1793. // started on or after the given timestamp.
  1794. func (c *ProcessesListScriptProcessesCall) ScriptProcessFilterStartTime(scriptProcessFilterStartTime string) *ProcessesListScriptProcessesCall {
  1795. c.urlParams_.Set("scriptProcessFilter.startTime", scriptProcessFilterStartTime)
  1796. return c
  1797. }
  1798. // ScriptProcessFilterStatuses sets the optional parameter
  1799. // "scriptProcessFilter.statuses": Optional field used to limit returned
  1800. // processes to those having one of
  1801. // the specified process statuses.
  1802. //
  1803. // Possible values:
  1804. // "PROCESS_STATUS_UNSPECIFIED"
  1805. // "RUNNING"
  1806. // "PAUSED"
  1807. // "COMPLETED"
  1808. // "CANCELED"
  1809. // "FAILED"
  1810. // "TIMED_OUT"
  1811. // "UNKNOWN"
  1812. // "DELAYED"
  1813. func (c *ProcessesListScriptProcessesCall) ScriptProcessFilterStatuses(scriptProcessFilterStatuses ...string) *ProcessesListScriptProcessesCall {
  1814. c.urlParams_.SetMulti("scriptProcessFilter.statuses", append([]string{}, scriptProcessFilterStatuses...))
  1815. return c
  1816. }
  1817. // ScriptProcessFilterTypes sets the optional parameter
  1818. // "scriptProcessFilter.types": Optional field used to limit returned
  1819. // processes to those having one of
  1820. // the specified process types.
  1821. //
  1822. // Possible values:
  1823. // "PROCESS_TYPE_UNSPECIFIED"
  1824. // "ADD_ON"
  1825. // "EXECUTION_API"
  1826. // "TIME_DRIVEN"
  1827. // "TRIGGER"
  1828. // "WEBAPP"
  1829. // "EDITOR"
  1830. // "SIMPLE_TRIGGER"
  1831. // "MENU"
  1832. // "BATCH_TASK"
  1833. func (c *ProcessesListScriptProcessesCall) ScriptProcessFilterTypes(scriptProcessFilterTypes ...string) *ProcessesListScriptProcessesCall {
  1834. c.urlParams_.SetMulti("scriptProcessFilter.types", append([]string{}, scriptProcessFilterTypes...))
  1835. return c
  1836. }
  1837. // ScriptProcessFilterUserAccessLevels sets the optional parameter
  1838. // "scriptProcessFilter.userAccessLevels": Optional field used to limit
  1839. // returned processes to those having one of
  1840. // the specified user access levels.
  1841. //
  1842. // Possible values:
  1843. // "USER_ACCESS_LEVEL_UNSPECIFIED"
  1844. // "NONE"
  1845. // "READ"
  1846. // "WRITE"
  1847. // "OWNER"
  1848. func (c *ProcessesListScriptProcessesCall) ScriptProcessFilterUserAccessLevels(scriptProcessFilterUserAccessLevels ...string) *ProcessesListScriptProcessesCall {
  1849. c.urlParams_.SetMulti("scriptProcessFilter.userAccessLevels", append([]string{}, scriptProcessFilterUserAccessLevels...))
  1850. return c
  1851. }
  1852. // Fields allows partial responses to be retrieved. See
  1853. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1854. // for more information.
  1855. func (c *ProcessesListScriptProcessesCall) Fields(s ...googleapi.Field) *ProcessesListScriptProcessesCall {
  1856. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1857. return c
  1858. }
  1859. // IfNoneMatch sets the optional parameter which makes the operation
  1860. // fail if the object's ETag matches the given value. This is useful for
  1861. // getting updates only after the object has changed since the last
  1862. // request. Use googleapi.IsNotModified to check whether the response
  1863. // error from Do is the result of In-None-Match.
  1864. func (c *ProcessesListScriptProcessesCall) IfNoneMatch(entityTag string) *ProcessesListScriptProcessesCall {
  1865. c.ifNoneMatch_ = entityTag
  1866. return c
  1867. }
  1868. // Context sets the context to be used in this call's Do method. Any
  1869. // pending HTTP request will be aborted if the provided context is
  1870. // canceled.
  1871. func (c *ProcessesListScriptProcessesCall) Context(ctx context.Context) *ProcessesListScriptProcessesCall {
  1872. c.ctx_ = ctx
  1873. return c
  1874. }
  1875. // Header returns an http.Header that can be modified by the caller to
  1876. // add HTTP headers to the request.
  1877. func (c *ProcessesListScriptProcessesCall) Header() http.Header {
  1878. if c.header_ == nil {
  1879. c.header_ = make(http.Header)
  1880. }
  1881. return c.header_
  1882. }
  1883. func (c *ProcessesListScriptProcessesCall) doRequest(alt string) (*http.Response, error) {
  1884. reqHeaders := make(http.Header)
  1885. for k, v := range c.header_ {
  1886. reqHeaders[k] = v
  1887. }
  1888. reqHeaders.Set("User-Agent", c.s.userAgent())
  1889. if c.ifNoneMatch_ != "" {
  1890. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1891. }
  1892. var body io.Reader = nil
  1893. c.urlParams_.Set("alt", alt)
  1894. c.urlParams_.Set("prettyPrint", "false")
  1895. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/processes:listScriptProcesses")
  1896. urls += "?" + c.urlParams_.Encode()
  1897. req, err := http.NewRequest("GET", urls, body)
  1898. if err != nil {
  1899. return nil, err
  1900. }
  1901. req.Header = reqHeaders
  1902. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1903. }
  1904. // Do executes the "script.processes.listScriptProcesses" call.
  1905. // Exactly one of *ListScriptProcessesResponse or error will be non-nil.
  1906. // Any non-2xx status code is an error. Response headers are in either
  1907. // *ListScriptProcessesResponse.ServerResponse.Header or (if a response
  1908. // was returned at all) in error.(*googleapi.Error).Header. Use
  1909. // googleapi.IsNotModified to check whether the returned error was
  1910. // because http.StatusNotModified was returned.
  1911. func (c *ProcessesListScriptProcessesCall) Do(opts ...googleapi.CallOption) (*ListScriptProcessesResponse, error) {
  1912. gensupport.SetOptions(c.urlParams_, opts...)
  1913. res, err := c.doRequest("json")
  1914. if res != nil && res.StatusCode == http.StatusNotModified {
  1915. if res.Body != nil {
  1916. res.Body.Close()
  1917. }
  1918. return nil, &googleapi.Error{
  1919. Code: res.StatusCode,
  1920. Header: res.Header,
  1921. }
  1922. }
  1923. if err != nil {
  1924. return nil, err
  1925. }
  1926. defer googleapi.CloseBody(res)
  1927. if err := googleapi.CheckResponse(res); err != nil {
  1928. return nil, err
  1929. }
  1930. ret := &ListScriptProcessesResponse{
  1931. ServerResponse: googleapi.ServerResponse{
  1932. Header: res.Header,
  1933. HTTPStatusCode: res.StatusCode,
  1934. },
  1935. }
  1936. target := &ret
  1937. if err := gensupport.DecodeResponse(target, res); err != nil {
  1938. return nil, err
  1939. }
  1940. return ret, nil
  1941. // {
  1942. // "description": "List information about a script's executed processes, such as process type\nand current status.",
  1943. // "flatPath": "v1/processes:listScriptProcesses",
  1944. // "httpMethod": "GET",
  1945. // "id": "script.processes.listScriptProcesses",
  1946. // "parameterOrder": [],
  1947. // "parameters": {
  1948. // "pageSize": {
  1949. // "description": "The maximum number of returned processes per page of results. Defaults to\n50.",
  1950. // "format": "int32",
  1951. // "location": "query",
  1952. // "type": "integer"
  1953. // },
  1954. // "pageToken": {
  1955. // "description": "The token for continuing a previous list request on the next page. This\nshould be set to the value of `nextPageToken` from a previous response.",
  1956. // "location": "query",
  1957. // "type": "string"
  1958. // },
  1959. // "scriptId": {
  1960. // "description": "The script ID of the project whose processes are listed.",
  1961. // "location": "query",
  1962. // "type": "string"
  1963. // },
  1964. // "scriptProcessFilter.deploymentId": {
  1965. // "description": "Optional field used to limit returned processes to those originating from\nprojects with a specific deployment ID.",
  1966. // "location": "query",
  1967. // "type": "string"
  1968. // },
  1969. // "scriptProcessFilter.endTime": {
  1970. // "description": "Optional field used to limit returned processes to those that completed\non or before the given timestamp.",
  1971. // "format": "google-datetime",
  1972. // "location": "query",
  1973. // "type": "string"
  1974. // },
  1975. // "scriptProcessFilter.functionName": {
  1976. // "description": "Optional field used to limit returned processes to those originating from\na script function with the given function name.",
  1977. // "location": "query",
  1978. // "type": "string"
  1979. // },
  1980. // "scriptProcessFilter.startTime": {
  1981. // "description": "Optional field used to limit returned processes to those that were\nstarted on or after the given timestamp.",
  1982. // "format": "google-datetime",
  1983. // "location": "query",
  1984. // "type": "string"
  1985. // },
  1986. // "scriptProcessFilter.statuses": {
  1987. // "description": "Optional field used to limit returned processes to those having one of\nthe specified process statuses.",
  1988. // "enum": [
  1989. // "PROCESS_STATUS_UNSPECIFIED",
  1990. // "RUNNING",
  1991. // "PAUSED",
  1992. // "COMPLETED",
  1993. // "CANCELED",
  1994. // "FAILED",
  1995. // "TIMED_OUT",
  1996. // "UNKNOWN",
  1997. // "DELAYED"
  1998. // ],
  1999. // "location": "query",
  2000. // "repeated": true,
  2001. // "type": "string"
  2002. // },
  2003. // "scriptProcessFilter.types": {
  2004. // "description": "Optional field used to limit returned processes to those having one of\nthe specified process types.",
  2005. // "enum": [
  2006. // "PROCESS_TYPE_UNSPECIFIED",
  2007. // "ADD_ON",
  2008. // "EXECUTION_API",
  2009. // "TIME_DRIVEN",
  2010. // "TRIGGER",
  2011. // "WEBAPP",
  2012. // "EDITOR",
  2013. // "SIMPLE_TRIGGER",
  2014. // "MENU",
  2015. // "BATCH_TASK"
  2016. // ],
  2017. // "location": "query",
  2018. // "repeated": true,
  2019. // "type": "string"
  2020. // },
  2021. // "scriptProcessFilter.userAccessLevels": {
  2022. // "description": "Optional field used to limit returned processes to those having one of\nthe specified user access levels.",
  2023. // "enum": [
  2024. // "USER_ACCESS_LEVEL_UNSPECIFIED",
  2025. // "NONE",
  2026. // "READ",
  2027. // "WRITE",
  2028. // "OWNER"
  2029. // ],
  2030. // "location": "query",
  2031. // "repeated": true,
  2032. // "type": "string"
  2033. // }
  2034. // },
  2035. // "path": "v1/processes:listScriptProcesses",
  2036. // "response": {
  2037. // "$ref": "ListScriptProcessesResponse"
  2038. // },
  2039. // "scopes": [
  2040. // "https://www.googleapis.com/auth/script.processes"
  2041. // ]
  2042. // }
  2043. }
  2044. // Pages invokes f for each page of results.
  2045. // A non-nil error returned from f will halt the iteration.
  2046. // The provided context supersedes any context provided to the Context method.
  2047. func (c *ProcessesListScriptProcessesCall) Pages(ctx context.Context, f func(*ListScriptProcessesResponse) error) error {
  2048. c.ctx_ = ctx
  2049. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2050. for {
  2051. x, err := c.Do()
  2052. if err != nil {
  2053. return err
  2054. }
  2055. if err := f(x); err != nil {
  2056. return err
  2057. }
  2058. if x.NextPageToken == "" {
  2059. return nil
  2060. }
  2061. c.PageToken(x.NextPageToken)
  2062. }
  2063. }
  2064. // method id "script.projects.create":
  2065. type ProjectsCreateCall struct {
  2066. s *Service
  2067. createprojectrequest *CreateProjectRequest
  2068. urlParams_ gensupport.URLParams
  2069. ctx_ context.Context
  2070. header_ http.Header
  2071. }
  2072. // Create: Creates a new, empty script project with no script files and
  2073. // a base
  2074. // manifest file.
  2075. func (r *ProjectsService) Create(createprojectrequest *CreateProjectRequest) *ProjectsCreateCall {
  2076. c := &ProjectsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2077. c.createprojectrequest = createprojectrequest
  2078. return c
  2079. }
  2080. // Fields allows partial responses to be retrieved. See
  2081. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2082. // for more information.
  2083. func (c *ProjectsCreateCall) Fields(s ...googleapi.Field) *ProjectsCreateCall {
  2084. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2085. return c
  2086. }
  2087. // Context sets the context to be used in this call's Do method. Any
  2088. // pending HTTP request will be aborted if the provided context is
  2089. // canceled.
  2090. func (c *ProjectsCreateCall) Context(ctx context.Context) *ProjectsCreateCall {
  2091. c.ctx_ = ctx
  2092. return c
  2093. }
  2094. // Header returns an http.Header that can be modified by the caller to
  2095. // add HTTP headers to the request.
  2096. func (c *ProjectsCreateCall) Header() http.Header {
  2097. if c.header_ == nil {
  2098. c.header_ = make(http.Header)
  2099. }
  2100. return c.header_
  2101. }
  2102. func (c *ProjectsCreateCall) doRequest(alt string) (*http.Response, error) {
  2103. reqHeaders := make(http.Header)
  2104. for k, v := range c.header_ {
  2105. reqHeaders[k] = v
  2106. }
  2107. reqHeaders.Set("User-Agent", c.s.userAgent())
  2108. var body io.Reader = nil
  2109. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createprojectrequest)
  2110. if err != nil {
  2111. return nil, err
  2112. }
  2113. reqHeaders.Set("Content-Type", "application/json")
  2114. c.urlParams_.Set("alt", alt)
  2115. c.urlParams_.Set("prettyPrint", "false")
  2116. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects")
  2117. urls += "?" + c.urlParams_.Encode()
  2118. req, err := http.NewRequest("POST", urls, body)
  2119. if err != nil {
  2120. return nil, err
  2121. }
  2122. req.Header = reqHeaders
  2123. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2124. }
  2125. // Do executes the "script.projects.create" call.
  2126. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  2127. // code is an error. Response headers are in either
  2128. // *Project.ServerResponse.Header or (if a response was returned at all)
  2129. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2130. // check whether the returned error was because http.StatusNotModified
  2131. // was returned.
  2132. func (c *ProjectsCreateCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  2133. gensupport.SetOptions(c.urlParams_, opts...)
  2134. res, err := c.doRequest("json")
  2135. if res != nil && res.StatusCode == http.StatusNotModified {
  2136. if res.Body != nil {
  2137. res.Body.Close()
  2138. }
  2139. return nil, &googleapi.Error{
  2140. Code: res.StatusCode,
  2141. Header: res.Header,
  2142. }
  2143. }
  2144. if err != nil {
  2145. return nil, err
  2146. }
  2147. defer googleapi.CloseBody(res)
  2148. if err := googleapi.CheckResponse(res); err != nil {
  2149. return nil, err
  2150. }
  2151. ret := &Project{
  2152. ServerResponse: googleapi.ServerResponse{
  2153. Header: res.Header,
  2154. HTTPStatusCode: res.StatusCode,
  2155. },
  2156. }
  2157. target := &ret
  2158. if err := gensupport.DecodeResponse(target, res); err != nil {
  2159. return nil, err
  2160. }
  2161. return ret, nil
  2162. // {
  2163. // "description": "Creates a new, empty script project with no script files and a base\nmanifest file.",
  2164. // "flatPath": "v1/projects",
  2165. // "httpMethod": "POST",
  2166. // "id": "script.projects.create",
  2167. // "parameterOrder": [],
  2168. // "parameters": {},
  2169. // "path": "v1/projects",
  2170. // "request": {
  2171. // "$ref": "CreateProjectRequest"
  2172. // },
  2173. // "response": {
  2174. // "$ref": "Project"
  2175. // },
  2176. // "scopes": [
  2177. // "https://www.googleapis.com/auth/script.projects"
  2178. // ]
  2179. // }
  2180. }
  2181. // method id "script.projects.get":
  2182. type ProjectsGetCall struct {
  2183. s *Service
  2184. scriptId string
  2185. urlParams_ gensupport.URLParams
  2186. ifNoneMatch_ string
  2187. ctx_ context.Context
  2188. header_ http.Header
  2189. }
  2190. // Get: Gets a script project's metadata.
  2191. func (r *ProjectsService) Get(scriptId string) *ProjectsGetCall {
  2192. c := &ProjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2193. c.scriptId = scriptId
  2194. return c
  2195. }
  2196. // Fields allows partial responses to be retrieved. See
  2197. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2198. // for more information.
  2199. func (c *ProjectsGetCall) Fields(s ...googleapi.Field) *ProjectsGetCall {
  2200. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2201. return c
  2202. }
  2203. // IfNoneMatch sets the optional parameter which makes the operation
  2204. // fail if the object's ETag matches the given value. This is useful for
  2205. // getting updates only after the object has changed since the last
  2206. // request. Use googleapi.IsNotModified to check whether the response
  2207. // error from Do is the result of In-None-Match.
  2208. func (c *ProjectsGetCall) IfNoneMatch(entityTag string) *ProjectsGetCall {
  2209. c.ifNoneMatch_ = entityTag
  2210. return c
  2211. }
  2212. // Context sets the context to be used in this call's Do method. Any
  2213. // pending HTTP request will be aborted if the provided context is
  2214. // canceled.
  2215. func (c *ProjectsGetCall) Context(ctx context.Context) *ProjectsGetCall {
  2216. c.ctx_ = ctx
  2217. return c
  2218. }
  2219. // Header returns an http.Header that can be modified by the caller to
  2220. // add HTTP headers to the request.
  2221. func (c *ProjectsGetCall) Header() http.Header {
  2222. if c.header_ == nil {
  2223. c.header_ = make(http.Header)
  2224. }
  2225. return c.header_
  2226. }
  2227. func (c *ProjectsGetCall) doRequest(alt string) (*http.Response, error) {
  2228. reqHeaders := make(http.Header)
  2229. for k, v := range c.header_ {
  2230. reqHeaders[k] = v
  2231. }
  2232. reqHeaders.Set("User-Agent", c.s.userAgent())
  2233. if c.ifNoneMatch_ != "" {
  2234. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2235. }
  2236. var body io.Reader = nil
  2237. c.urlParams_.Set("alt", alt)
  2238. c.urlParams_.Set("prettyPrint", "false")
  2239. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}")
  2240. urls += "?" + c.urlParams_.Encode()
  2241. req, err := http.NewRequest("GET", urls, body)
  2242. if err != nil {
  2243. return nil, err
  2244. }
  2245. req.Header = reqHeaders
  2246. googleapi.Expand(req.URL, map[string]string{
  2247. "scriptId": c.scriptId,
  2248. })
  2249. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2250. }
  2251. // Do executes the "script.projects.get" call.
  2252. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  2253. // code is an error. Response headers are in either
  2254. // *Project.ServerResponse.Header or (if a response was returned at all)
  2255. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2256. // check whether the returned error was because http.StatusNotModified
  2257. // was returned.
  2258. func (c *ProjectsGetCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  2259. gensupport.SetOptions(c.urlParams_, opts...)
  2260. res, err := c.doRequest("json")
  2261. if res != nil && res.StatusCode == http.StatusNotModified {
  2262. if res.Body != nil {
  2263. res.Body.Close()
  2264. }
  2265. return nil, &googleapi.Error{
  2266. Code: res.StatusCode,
  2267. Header: res.Header,
  2268. }
  2269. }
  2270. if err != nil {
  2271. return nil, err
  2272. }
  2273. defer googleapi.CloseBody(res)
  2274. if err := googleapi.CheckResponse(res); err != nil {
  2275. return nil, err
  2276. }
  2277. ret := &Project{
  2278. ServerResponse: googleapi.ServerResponse{
  2279. Header: res.Header,
  2280. HTTPStatusCode: res.StatusCode,
  2281. },
  2282. }
  2283. target := &ret
  2284. if err := gensupport.DecodeResponse(target, res); err != nil {
  2285. return nil, err
  2286. }
  2287. return ret, nil
  2288. // {
  2289. // "description": "Gets a script project's metadata.",
  2290. // "flatPath": "v1/projects/{scriptId}",
  2291. // "httpMethod": "GET",
  2292. // "id": "script.projects.get",
  2293. // "parameterOrder": [
  2294. // "scriptId"
  2295. // ],
  2296. // "parameters": {
  2297. // "scriptId": {
  2298. // "description": "The script project's Drive ID.",
  2299. // "location": "path",
  2300. // "required": true,
  2301. // "type": "string"
  2302. // }
  2303. // },
  2304. // "path": "v1/projects/{scriptId}",
  2305. // "response": {
  2306. // "$ref": "Project"
  2307. // },
  2308. // "scopes": [
  2309. // "https://www.googleapis.com/auth/script.projects",
  2310. // "https://www.googleapis.com/auth/script.projects.readonly"
  2311. // ]
  2312. // }
  2313. }
  2314. // method id "script.projects.getContent":
  2315. type ProjectsGetContentCall struct {
  2316. s *Service
  2317. scriptId string
  2318. urlParams_ gensupport.URLParams
  2319. ifNoneMatch_ string
  2320. ctx_ context.Context
  2321. header_ http.Header
  2322. }
  2323. // GetContent: Gets the content of the script project, including the
  2324. // code source and
  2325. // metadata for each script file.
  2326. func (r *ProjectsService) GetContent(scriptId string) *ProjectsGetContentCall {
  2327. c := &ProjectsGetContentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2328. c.scriptId = scriptId
  2329. return c
  2330. }
  2331. // VersionNumber sets the optional parameter "versionNumber": The
  2332. // version number of the project to retrieve. If not provided,
  2333. // the
  2334. // project's HEAD version is returned.
  2335. func (c *ProjectsGetContentCall) VersionNumber(versionNumber int64) *ProjectsGetContentCall {
  2336. c.urlParams_.Set("versionNumber", fmt.Sprint(versionNumber))
  2337. return c
  2338. }
  2339. // Fields allows partial responses to be retrieved. See
  2340. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2341. // for more information.
  2342. func (c *ProjectsGetContentCall) Fields(s ...googleapi.Field) *ProjectsGetContentCall {
  2343. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2344. return c
  2345. }
  2346. // IfNoneMatch sets the optional parameter which makes the operation
  2347. // fail if the object's ETag matches the given value. This is useful for
  2348. // getting updates only after the object has changed since the last
  2349. // request. Use googleapi.IsNotModified to check whether the response
  2350. // error from Do is the result of In-None-Match.
  2351. func (c *ProjectsGetContentCall) IfNoneMatch(entityTag string) *ProjectsGetContentCall {
  2352. c.ifNoneMatch_ = entityTag
  2353. return c
  2354. }
  2355. // Context sets the context to be used in this call's Do method. Any
  2356. // pending HTTP request will be aborted if the provided context is
  2357. // canceled.
  2358. func (c *ProjectsGetContentCall) Context(ctx context.Context) *ProjectsGetContentCall {
  2359. c.ctx_ = ctx
  2360. return c
  2361. }
  2362. // Header returns an http.Header that can be modified by the caller to
  2363. // add HTTP headers to the request.
  2364. func (c *ProjectsGetContentCall) Header() http.Header {
  2365. if c.header_ == nil {
  2366. c.header_ = make(http.Header)
  2367. }
  2368. return c.header_
  2369. }
  2370. func (c *ProjectsGetContentCall) doRequest(alt string) (*http.Response, error) {
  2371. reqHeaders := make(http.Header)
  2372. for k, v := range c.header_ {
  2373. reqHeaders[k] = v
  2374. }
  2375. reqHeaders.Set("User-Agent", c.s.userAgent())
  2376. if c.ifNoneMatch_ != "" {
  2377. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2378. }
  2379. var body io.Reader = nil
  2380. c.urlParams_.Set("alt", alt)
  2381. c.urlParams_.Set("prettyPrint", "false")
  2382. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/content")
  2383. urls += "?" + c.urlParams_.Encode()
  2384. req, err := http.NewRequest("GET", urls, body)
  2385. if err != nil {
  2386. return nil, err
  2387. }
  2388. req.Header = reqHeaders
  2389. googleapi.Expand(req.URL, map[string]string{
  2390. "scriptId": c.scriptId,
  2391. })
  2392. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2393. }
  2394. // Do executes the "script.projects.getContent" call.
  2395. // Exactly one of *Content or error will be non-nil. Any non-2xx status
  2396. // code is an error. Response headers are in either
  2397. // *Content.ServerResponse.Header or (if a response was returned at all)
  2398. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2399. // check whether the returned error was because http.StatusNotModified
  2400. // was returned.
  2401. func (c *ProjectsGetContentCall) Do(opts ...googleapi.CallOption) (*Content, error) {
  2402. gensupport.SetOptions(c.urlParams_, opts...)
  2403. res, err := c.doRequest("json")
  2404. if res != nil && res.StatusCode == http.StatusNotModified {
  2405. if res.Body != nil {
  2406. res.Body.Close()
  2407. }
  2408. return nil, &googleapi.Error{
  2409. Code: res.StatusCode,
  2410. Header: res.Header,
  2411. }
  2412. }
  2413. if err != nil {
  2414. return nil, err
  2415. }
  2416. defer googleapi.CloseBody(res)
  2417. if err := googleapi.CheckResponse(res); err != nil {
  2418. return nil, err
  2419. }
  2420. ret := &Content{
  2421. ServerResponse: googleapi.ServerResponse{
  2422. Header: res.Header,
  2423. HTTPStatusCode: res.StatusCode,
  2424. },
  2425. }
  2426. target := &ret
  2427. if err := gensupport.DecodeResponse(target, res); err != nil {
  2428. return nil, err
  2429. }
  2430. return ret, nil
  2431. // {
  2432. // "description": "Gets the content of the script project, including the code source and\nmetadata for each script file.",
  2433. // "flatPath": "v1/projects/{scriptId}/content",
  2434. // "httpMethod": "GET",
  2435. // "id": "script.projects.getContent",
  2436. // "parameterOrder": [
  2437. // "scriptId"
  2438. // ],
  2439. // "parameters": {
  2440. // "scriptId": {
  2441. // "description": "The script project's Drive ID.",
  2442. // "location": "path",
  2443. // "required": true,
  2444. // "type": "string"
  2445. // },
  2446. // "versionNumber": {
  2447. // "description": "The version number of the project to retrieve. If not provided, the\nproject's HEAD version is returned.",
  2448. // "format": "int32",
  2449. // "location": "query",
  2450. // "type": "integer"
  2451. // }
  2452. // },
  2453. // "path": "v1/projects/{scriptId}/content",
  2454. // "response": {
  2455. // "$ref": "Content"
  2456. // },
  2457. // "scopes": [
  2458. // "https://www.googleapis.com/auth/script.projects",
  2459. // "https://www.googleapis.com/auth/script.projects.readonly"
  2460. // ]
  2461. // }
  2462. }
  2463. // method id "script.projects.getMetrics":
  2464. type ProjectsGetMetricsCall struct {
  2465. s *Service
  2466. scriptId string
  2467. urlParams_ gensupport.URLParams
  2468. ifNoneMatch_ string
  2469. ctx_ context.Context
  2470. header_ http.Header
  2471. }
  2472. // GetMetrics: Get metrics data for scripts, such as number of
  2473. // executions and
  2474. // active users.
  2475. func (r *ProjectsService) GetMetrics(scriptId string) *ProjectsGetMetricsCall {
  2476. c := &ProjectsGetMetricsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2477. c.scriptId = scriptId
  2478. return c
  2479. }
  2480. // MetricsFilterDeploymentId sets the optional parameter
  2481. // "metricsFilter.deploymentId": Optional field indicating a specific
  2482. // deployment to retrieve metrics from.
  2483. func (c *ProjectsGetMetricsCall) MetricsFilterDeploymentId(metricsFilterDeploymentId string) *ProjectsGetMetricsCall {
  2484. c.urlParams_.Set("metricsFilter.deploymentId", metricsFilterDeploymentId)
  2485. return c
  2486. }
  2487. // MetricsGranularity sets the optional parameter "metricsGranularity":
  2488. // Required field indicating what granularity of metrics are returned.
  2489. //
  2490. // Possible values:
  2491. // "UNSPECIFIED_GRANULARITY"
  2492. // "WEEKLY"
  2493. // "DAILY"
  2494. func (c *ProjectsGetMetricsCall) MetricsGranularity(metricsGranularity string) *ProjectsGetMetricsCall {
  2495. c.urlParams_.Set("metricsGranularity", metricsGranularity)
  2496. return c
  2497. }
  2498. // Fields allows partial responses to be retrieved. See
  2499. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2500. // for more information.
  2501. func (c *ProjectsGetMetricsCall) Fields(s ...googleapi.Field) *ProjectsGetMetricsCall {
  2502. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2503. return c
  2504. }
  2505. // IfNoneMatch sets the optional parameter which makes the operation
  2506. // fail if the object's ETag matches the given value. This is useful for
  2507. // getting updates only after the object has changed since the last
  2508. // request. Use googleapi.IsNotModified to check whether the response
  2509. // error from Do is the result of In-None-Match.
  2510. func (c *ProjectsGetMetricsCall) IfNoneMatch(entityTag string) *ProjectsGetMetricsCall {
  2511. c.ifNoneMatch_ = entityTag
  2512. return c
  2513. }
  2514. // Context sets the context to be used in this call's Do method. Any
  2515. // pending HTTP request will be aborted if the provided context is
  2516. // canceled.
  2517. func (c *ProjectsGetMetricsCall) Context(ctx context.Context) *ProjectsGetMetricsCall {
  2518. c.ctx_ = ctx
  2519. return c
  2520. }
  2521. // Header returns an http.Header that can be modified by the caller to
  2522. // add HTTP headers to the request.
  2523. func (c *ProjectsGetMetricsCall) Header() http.Header {
  2524. if c.header_ == nil {
  2525. c.header_ = make(http.Header)
  2526. }
  2527. return c.header_
  2528. }
  2529. func (c *ProjectsGetMetricsCall) doRequest(alt string) (*http.Response, error) {
  2530. reqHeaders := make(http.Header)
  2531. for k, v := range c.header_ {
  2532. reqHeaders[k] = v
  2533. }
  2534. reqHeaders.Set("User-Agent", c.s.userAgent())
  2535. if c.ifNoneMatch_ != "" {
  2536. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2537. }
  2538. var body io.Reader = nil
  2539. c.urlParams_.Set("alt", alt)
  2540. c.urlParams_.Set("prettyPrint", "false")
  2541. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/metrics")
  2542. urls += "?" + c.urlParams_.Encode()
  2543. req, err := http.NewRequest("GET", urls, body)
  2544. if err != nil {
  2545. return nil, err
  2546. }
  2547. req.Header = reqHeaders
  2548. googleapi.Expand(req.URL, map[string]string{
  2549. "scriptId": c.scriptId,
  2550. })
  2551. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2552. }
  2553. // Do executes the "script.projects.getMetrics" call.
  2554. // Exactly one of *Metrics or error will be non-nil. Any non-2xx status
  2555. // code is an error. Response headers are in either
  2556. // *Metrics.ServerResponse.Header or (if a response was returned at all)
  2557. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2558. // check whether the returned error was because http.StatusNotModified
  2559. // was returned.
  2560. func (c *ProjectsGetMetricsCall) Do(opts ...googleapi.CallOption) (*Metrics, error) {
  2561. gensupport.SetOptions(c.urlParams_, opts...)
  2562. res, err := c.doRequest("json")
  2563. if res != nil && res.StatusCode == http.StatusNotModified {
  2564. if res.Body != nil {
  2565. res.Body.Close()
  2566. }
  2567. return nil, &googleapi.Error{
  2568. Code: res.StatusCode,
  2569. Header: res.Header,
  2570. }
  2571. }
  2572. if err != nil {
  2573. return nil, err
  2574. }
  2575. defer googleapi.CloseBody(res)
  2576. if err := googleapi.CheckResponse(res); err != nil {
  2577. return nil, err
  2578. }
  2579. ret := &Metrics{
  2580. ServerResponse: googleapi.ServerResponse{
  2581. Header: res.Header,
  2582. HTTPStatusCode: res.StatusCode,
  2583. },
  2584. }
  2585. target := &ret
  2586. if err := gensupport.DecodeResponse(target, res); err != nil {
  2587. return nil, err
  2588. }
  2589. return ret, nil
  2590. // {
  2591. // "description": "Get metrics data for scripts, such as number of executions and\nactive users.",
  2592. // "flatPath": "v1/projects/{scriptId}/metrics",
  2593. // "httpMethod": "GET",
  2594. // "id": "script.projects.getMetrics",
  2595. // "parameterOrder": [
  2596. // "scriptId"
  2597. // ],
  2598. // "parameters": {
  2599. // "metricsFilter.deploymentId": {
  2600. // "description": "Optional field indicating a specific deployment to retrieve metrics from.",
  2601. // "location": "query",
  2602. // "type": "string"
  2603. // },
  2604. // "metricsGranularity": {
  2605. // "description": "Required field indicating what granularity of metrics are returned.",
  2606. // "enum": [
  2607. // "UNSPECIFIED_GRANULARITY",
  2608. // "WEEKLY",
  2609. // "DAILY"
  2610. // ],
  2611. // "location": "query",
  2612. // "type": "string"
  2613. // },
  2614. // "scriptId": {
  2615. // "description": "Required field indicating the script to get metrics for.",
  2616. // "location": "path",
  2617. // "required": true,
  2618. // "type": "string"
  2619. // }
  2620. // },
  2621. // "path": "v1/projects/{scriptId}/metrics",
  2622. // "response": {
  2623. // "$ref": "Metrics"
  2624. // },
  2625. // "scopes": [
  2626. // "https://www.googleapis.com/auth/script.metrics"
  2627. // ]
  2628. // }
  2629. }
  2630. // method id "script.projects.updateContent":
  2631. type ProjectsUpdateContentCall struct {
  2632. s *Service
  2633. scriptId string
  2634. content *Content
  2635. urlParams_ gensupport.URLParams
  2636. ctx_ context.Context
  2637. header_ http.Header
  2638. }
  2639. // UpdateContent: Updates the content of the specified script
  2640. // project.
  2641. // This content is stored as the HEAD version, and is used when the
  2642. // script is
  2643. // executed as a trigger, in the script editor, in add-on preview mode,
  2644. // or as
  2645. // a web app or Apps Script API in development mode. This clears all
  2646. // the
  2647. // existing files in the project.
  2648. func (r *ProjectsService) UpdateContent(scriptId string, content *Content) *ProjectsUpdateContentCall {
  2649. c := &ProjectsUpdateContentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2650. c.scriptId = scriptId
  2651. c.content = content
  2652. return c
  2653. }
  2654. // Fields allows partial responses to be retrieved. See
  2655. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2656. // for more information.
  2657. func (c *ProjectsUpdateContentCall) Fields(s ...googleapi.Field) *ProjectsUpdateContentCall {
  2658. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2659. return c
  2660. }
  2661. // Context sets the context to be used in this call's Do method. Any
  2662. // pending HTTP request will be aborted if the provided context is
  2663. // canceled.
  2664. func (c *ProjectsUpdateContentCall) Context(ctx context.Context) *ProjectsUpdateContentCall {
  2665. c.ctx_ = ctx
  2666. return c
  2667. }
  2668. // Header returns an http.Header that can be modified by the caller to
  2669. // add HTTP headers to the request.
  2670. func (c *ProjectsUpdateContentCall) Header() http.Header {
  2671. if c.header_ == nil {
  2672. c.header_ = make(http.Header)
  2673. }
  2674. return c.header_
  2675. }
  2676. func (c *ProjectsUpdateContentCall) doRequest(alt string) (*http.Response, error) {
  2677. reqHeaders := make(http.Header)
  2678. for k, v := range c.header_ {
  2679. reqHeaders[k] = v
  2680. }
  2681. reqHeaders.Set("User-Agent", c.s.userAgent())
  2682. var body io.Reader = nil
  2683. body, err := googleapi.WithoutDataWrapper.JSONReader(c.content)
  2684. if err != nil {
  2685. return nil, err
  2686. }
  2687. reqHeaders.Set("Content-Type", "application/json")
  2688. c.urlParams_.Set("alt", alt)
  2689. c.urlParams_.Set("prettyPrint", "false")
  2690. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/content")
  2691. urls += "?" + c.urlParams_.Encode()
  2692. req, err := http.NewRequest("PUT", urls, body)
  2693. if err != nil {
  2694. return nil, err
  2695. }
  2696. req.Header = reqHeaders
  2697. googleapi.Expand(req.URL, map[string]string{
  2698. "scriptId": c.scriptId,
  2699. })
  2700. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2701. }
  2702. // Do executes the "script.projects.updateContent" call.
  2703. // Exactly one of *Content or error will be non-nil. Any non-2xx status
  2704. // code is an error. Response headers are in either
  2705. // *Content.ServerResponse.Header or (if a response was returned at all)
  2706. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2707. // check whether the returned error was because http.StatusNotModified
  2708. // was returned.
  2709. func (c *ProjectsUpdateContentCall) Do(opts ...googleapi.CallOption) (*Content, error) {
  2710. gensupport.SetOptions(c.urlParams_, opts...)
  2711. res, err := c.doRequest("json")
  2712. if res != nil && res.StatusCode == http.StatusNotModified {
  2713. if res.Body != nil {
  2714. res.Body.Close()
  2715. }
  2716. return nil, &googleapi.Error{
  2717. Code: res.StatusCode,
  2718. Header: res.Header,
  2719. }
  2720. }
  2721. if err != nil {
  2722. return nil, err
  2723. }
  2724. defer googleapi.CloseBody(res)
  2725. if err := googleapi.CheckResponse(res); err != nil {
  2726. return nil, err
  2727. }
  2728. ret := &Content{
  2729. ServerResponse: googleapi.ServerResponse{
  2730. Header: res.Header,
  2731. HTTPStatusCode: res.StatusCode,
  2732. },
  2733. }
  2734. target := &ret
  2735. if err := gensupport.DecodeResponse(target, res); err != nil {
  2736. return nil, err
  2737. }
  2738. return ret, nil
  2739. // {
  2740. // "description": "Updates the content of the specified script project.\nThis content is stored as the HEAD version, and is used when the script is\nexecuted as a trigger, in the script editor, in add-on preview mode, or as\na web app or Apps Script API in development mode. This clears all the\nexisting files in the project.",
  2741. // "flatPath": "v1/projects/{scriptId}/content",
  2742. // "httpMethod": "PUT",
  2743. // "id": "script.projects.updateContent",
  2744. // "parameterOrder": [
  2745. // "scriptId"
  2746. // ],
  2747. // "parameters": {
  2748. // "scriptId": {
  2749. // "description": "The script project's Drive ID.",
  2750. // "location": "path",
  2751. // "required": true,
  2752. // "type": "string"
  2753. // }
  2754. // },
  2755. // "path": "v1/projects/{scriptId}/content",
  2756. // "request": {
  2757. // "$ref": "Content"
  2758. // },
  2759. // "response": {
  2760. // "$ref": "Content"
  2761. // },
  2762. // "scopes": [
  2763. // "https://www.googleapis.com/auth/script.projects"
  2764. // ]
  2765. // }
  2766. }
  2767. // method id "script.projects.deployments.create":
  2768. type ProjectsDeploymentsCreateCall struct {
  2769. s *Service
  2770. scriptId string
  2771. deploymentconfig *DeploymentConfig
  2772. urlParams_ gensupport.URLParams
  2773. ctx_ context.Context
  2774. header_ http.Header
  2775. }
  2776. // Create: Creates a deployment of an Apps Script project.
  2777. func (r *ProjectsDeploymentsService) Create(scriptId string, deploymentconfig *DeploymentConfig) *ProjectsDeploymentsCreateCall {
  2778. c := &ProjectsDeploymentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2779. c.scriptId = scriptId
  2780. c.deploymentconfig = deploymentconfig
  2781. return c
  2782. }
  2783. // Fields allows partial responses to be retrieved. See
  2784. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2785. // for more information.
  2786. func (c *ProjectsDeploymentsCreateCall) Fields(s ...googleapi.Field) *ProjectsDeploymentsCreateCall {
  2787. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2788. return c
  2789. }
  2790. // Context sets the context to be used in this call's Do method. Any
  2791. // pending HTTP request will be aborted if the provided context is
  2792. // canceled.
  2793. func (c *ProjectsDeploymentsCreateCall) Context(ctx context.Context) *ProjectsDeploymentsCreateCall {
  2794. c.ctx_ = ctx
  2795. return c
  2796. }
  2797. // Header returns an http.Header that can be modified by the caller to
  2798. // add HTTP headers to the request.
  2799. func (c *ProjectsDeploymentsCreateCall) Header() http.Header {
  2800. if c.header_ == nil {
  2801. c.header_ = make(http.Header)
  2802. }
  2803. return c.header_
  2804. }
  2805. func (c *ProjectsDeploymentsCreateCall) doRequest(alt string) (*http.Response, error) {
  2806. reqHeaders := make(http.Header)
  2807. for k, v := range c.header_ {
  2808. reqHeaders[k] = v
  2809. }
  2810. reqHeaders.Set("User-Agent", c.s.userAgent())
  2811. var body io.Reader = nil
  2812. body, err := googleapi.WithoutDataWrapper.JSONReader(c.deploymentconfig)
  2813. if err != nil {
  2814. return nil, err
  2815. }
  2816. reqHeaders.Set("Content-Type", "application/json")
  2817. c.urlParams_.Set("alt", alt)
  2818. c.urlParams_.Set("prettyPrint", "false")
  2819. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/deployments")
  2820. urls += "?" + c.urlParams_.Encode()
  2821. req, err := http.NewRequest("POST", urls, body)
  2822. if err != nil {
  2823. return nil, err
  2824. }
  2825. req.Header = reqHeaders
  2826. googleapi.Expand(req.URL, map[string]string{
  2827. "scriptId": c.scriptId,
  2828. })
  2829. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2830. }
  2831. // Do executes the "script.projects.deployments.create" call.
  2832. // Exactly one of *Deployment or error will be non-nil. Any non-2xx
  2833. // status code is an error. Response headers are in either
  2834. // *Deployment.ServerResponse.Header or (if a response was returned at
  2835. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2836. // to check whether the returned error was because
  2837. // http.StatusNotModified was returned.
  2838. func (c *ProjectsDeploymentsCreateCall) Do(opts ...googleapi.CallOption) (*Deployment, error) {
  2839. gensupport.SetOptions(c.urlParams_, opts...)
  2840. res, err := c.doRequest("json")
  2841. if res != nil && res.StatusCode == http.StatusNotModified {
  2842. if res.Body != nil {
  2843. res.Body.Close()
  2844. }
  2845. return nil, &googleapi.Error{
  2846. Code: res.StatusCode,
  2847. Header: res.Header,
  2848. }
  2849. }
  2850. if err != nil {
  2851. return nil, err
  2852. }
  2853. defer googleapi.CloseBody(res)
  2854. if err := googleapi.CheckResponse(res); err != nil {
  2855. return nil, err
  2856. }
  2857. ret := &Deployment{
  2858. ServerResponse: googleapi.ServerResponse{
  2859. Header: res.Header,
  2860. HTTPStatusCode: res.StatusCode,
  2861. },
  2862. }
  2863. target := &ret
  2864. if err := gensupport.DecodeResponse(target, res); err != nil {
  2865. return nil, err
  2866. }
  2867. return ret, nil
  2868. // {
  2869. // "description": "Creates a deployment of an Apps Script project.",
  2870. // "flatPath": "v1/projects/{scriptId}/deployments",
  2871. // "httpMethod": "POST",
  2872. // "id": "script.projects.deployments.create",
  2873. // "parameterOrder": [
  2874. // "scriptId"
  2875. // ],
  2876. // "parameters": {
  2877. // "scriptId": {
  2878. // "description": "The script project's Drive ID.",
  2879. // "location": "path",
  2880. // "required": true,
  2881. // "type": "string"
  2882. // }
  2883. // },
  2884. // "path": "v1/projects/{scriptId}/deployments",
  2885. // "request": {
  2886. // "$ref": "DeploymentConfig"
  2887. // },
  2888. // "response": {
  2889. // "$ref": "Deployment"
  2890. // },
  2891. // "scopes": [
  2892. // "https://www.googleapis.com/auth/script.deployments"
  2893. // ]
  2894. // }
  2895. }
  2896. // method id "script.projects.deployments.delete":
  2897. type ProjectsDeploymentsDeleteCall struct {
  2898. s *Service
  2899. scriptId string
  2900. deploymentId string
  2901. urlParams_ gensupport.URLParams
  2902. ctx_ context.Context
  2903. header_ http.Header
  2904. }
  2905. // Delete: Deletes a deployment of an Apps Script project.
  2906. func (r *ProjectsDeploymentsService) Delete(scriptId string, deploymentId string) *ProjectsDeploymentsDeleteCall {
  2907. c := &ProjectsDeploymentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2908. c.scriptId = scriptId
  2909. c.deploymentId = deploymentId
  2910. return c
  2911. }
  2912. // Fields allows partial responses to be retrieved. See
  2913. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2914. // for more information.
  2915. func (c *ProjectsDeploymentsDeleteCall) Fields(s ...googleapi.Field) *ProjectsDeploymentsDeleteCall {
  2916. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2917. return c
  2918. }
  2919. // Context sets the context to be used in this call's Do method. Any
  2920. // pending HTTP request will be aborted if the provided context is
  2921. // canceled.
  2922. func (c *ProjectsDeploymentsDeleteCall) Context(ctx context.Context) *ProjectsDeploymentsDeleteCall {
  2923. c.ctx_ = ctx
  2924. return c
  2925. }
  2926. // Header returns an http.Header that can be modified by the caller to
  2927. // add HTTP headers to the request.
  2928. func (c *ProjectsDeploymentsDeleteCall) Header() http.Header {
  2929. if c.header_ == nil {
  2930. c.header_ = make(http.Header)
  2931. }
  2932. return c.header_
  2933. }
  2934. func (c *ProjectsDeploymentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2935. reqHeaders := make(http.Header)
  2936. for k, v := range c.header_ {
  2937. reqHeaders[k] = v
  2938. }
  2939. reqHeaders.Set("User-Agent", c.s.userAgent())
  2940. var body io.Reader = nil
  2941. c.urlParams_.Set("alt", alt)
  2942. c.urlParams_.Set("prettyPrint", "false")
  2943. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/deployments/{deploymentId}")
  2944. urls += "?" + c.urlParams_.Encode()
  2945. req, err := http.NewRequest("DELETE", urls, body)
  2946. if err != nil {
  2947. return nil, err
  2948. }
  2949. req.Header = reqHeaders
  2950. googleapi.Expand(req.URL, map[string]string{
  2951. "scriptId": c.scriptId,
  2952. "deploymentId": c.deploymentId,
  2953. })
  2954. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2955. }
  2956. // Do executes the "script.projects.deployments.delete" call.
  2957. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2958. // code is an error. Response headers are in either
  2959. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2960. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2961. // check whether the returned error was because http.StatusNotModified
  2962. // was returned.
  2963. func (c *ProjectsDeploymentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2964. gensupport.SetOptions(c.urlParams_, opts...)
  2965. res, err := c.doRequest("json")
  2966. if res != nil && res.StatusCode == http.StatusNotModified {
  2967. if res.Body != nil {
  2968. res.Body.Close()
  2969. }
  2970. return nil, &googleapi.Error{
  2971. Code: res.StatusCode,
  2972. Header: res.Header,
  2973. }
  2974. }
  2975. if err != nil {
  2976. return nil, err
  2977. }
  2978. defer googleapi.CloseBody(res)
  2979. if err := googleapi.CheckResponse(res); err != nil {
  2980. return nil, err
  2981. }
  2982. ret := &Empty{
  2983. ServerResponse: googleapi.ServerResponse{
  2984. Header: res.Header,
  2985. HTTPStatusCode: res.StatusCode,
  2986. },
  2987. }
  2988. target := &ret
  2989. if err := gensupport.DecodeResponse(target, res); err != nil {
  2990. return nil, err
  2991. }
  2992. return ret, nil
  2993. // {
  2994. // "description": "Deletes a deployment of an Apps Script project.",
  2995. // "flatPath": "v1/projects/{scriptId}/deployments/{deploymentId}",
  2996. // "httpMethod": "DELETE",
  2997. // "id": "script.projects.deployments.delete",
  2998. // "parameterOrder": [
  2999. // "scriptId",
  3000. // "deploymentId"
  3001. // ],
  3002. // "parameters": {
  3003. // "deploymentId": {
  3004. // "description": "The deployment ID to be undeployed.",
  3005. // "location": "path",
  3006. // "required": true,
  3007. // "type": "string"
  3008. // },
  3009. // "scriptId": {
  3010. // "description": "The script project's Drive ID.",
  3011. // "location": "path",
  3012. // "required": true,
  3013. // "type": "string"
  3014. // }
  3015. // },
  3016. // "path": "v1/projects/{scriptId}/deployments/{deploymentId}",
  3017. // "response": {
  3018. // "$ref": "Empty"
  3019. // },
  3020. // "scopes": [
  3021. // "https://www.googleapis.com/auth/script.deployments"
  3022. // ]
  3023. // }
  3024. }
  3025. // method id "script.projects.deployments.get":
  3026. type ProjectsDeploymentsGetCall struct {
  3027. s *Service
  3028. scriptId string
  3029. deploymentId string
  3030. urlParams_ gensupport.URLParams
  3031. ifNoneMatch_ string
  3032. ctx_ context.Context
  3033. header_ http.Header
  3034. }
  3035. // Get: Gets a deployment of an Apps Script project.
  3036. func (r *ProjectsDeploymentsService) Get(scriptId string, deploymentId string) *ProjectsDeploymentsGetCall {
  3037. c := &ProjectsDeploymentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3038. c.scriptId = scriptId
  3039. c.deploymentId = deploymentId
  3040. return c
  3041. }
  3042. // Fields allows partial responses to be retrieved. See
  3043. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3044. // for more information.
  3045. func (c *ProjectsDeploymentsGetCall) Fields(s ...googleapi.Field) *ProjectsDeploymentsGetCall {
  3046. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3047. return c
  3048. }
  3049. // IfNoneMatch sets the optional parameter which makes the operation
  3050. // fail if the object's ETag matches the given value. This is useful for
  3051. // getting updates only after the object has changed since the last
  3052. // request. Use googleapi.IsNotModified to check whether the response
  3053. // error from Do is the result of In-None-Match.
  3054. func (c *ProjectsDeploymentsGetCall) IfNoneMatch(entityTag string) *ProjectsDeploymentsGetCall {
  3055. c.ifNoneMatch_ = entityTag
  3056. return c
  3057. }
  3058. // Context sets the context to be used in this call's Do method. Any
  3059. // pending HTTP request will be aborted if the provided context is
  3060. // canceled.
  3061. func (c *ProjectsDeploymentsGetCall) Context(ctx context.Context) *ProjectsDeploymentsGetCall {
  3062. c.ctx_ = ctx
  3063. return c
  3064. }
  3065. // Header returns an http.Header that can be modified by the caller to
  3066. // add HTTP headers to the request.
  3067. func (c *ProjectsDeploymentsGetCall) Header() http.Header {
  3068. if c.header_ == nil {
  3069. c.header_ = make(http.Header)
  3070. }
  3071. return c.header_
  3072. }
  3073. func (c *ProjectsDeploymentsGetCall) doRequest(alt string) (*http.Response, error) {
  3074. reqHeaders := make(http.Header)
  3075. for k, v := range c.header_ {
  3076. reqHeaders[k] = v
  3077. }
  3078. reqHeaders.Set("User-Agent", c.s.userAgent())
  3079. if c.ifNoneMatch_ != "" {
  3080. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3081. }
  3082. var body io.Reader = nil
  3083. c.urlParams_.Set("alt", alt)
  3084. c.urlParams_.Set("prettyPrint", "false")
  3085. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/deployments/{deploymentId}")
  3086. urls += "?" + c.urlParams_.Encode()
  3087. req, err := http.NewRequest("GET", urls, body)
  3088. if err != nil {
  3089. return nil, err
  3090. }
  3091. req.Header = reqHeaders
  3092. googleapi.Expand(req.URL, map[string]string{
  3093. "scriptId": c.scriptId,
  3094. "deploymentId": c.deploymentId,
  3095. })
  3096. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3097. }
  3098. // Do executes the "script.projects.deployments.get" call.
  3099. // Exactly one of *Deployment or error will be non-nil. Any non-2xx
  3100. // status code is an error. Response headers are in either
  3101. // *Deployment.ServerResponse.Header or (if a response was returned at
  3102. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3103. // to check whether the returned error was because
  3104. // http.StatusNotModified was returned.
  3105. func (c *ProjectsDeploymentsGetCall) Do(opts ...googleapi.CallOption) (*Deployment, error) {
  3106. gensupport.SetOptions(c.urlParams_, opts...)
  3107. res, err := c.doRequest("json")
  3108. if res != nil && res.StatusCode == http.StatusNotModified {
  3109. if res.Body != nil {
  3110. res.Body.Close()
  3111. }
  3112. return nil, &googleapi.Error{
  3113. Code: res.StatusCode,
  3114. Header: res.Header,
  3115. }
  3116. }
  3117. if err != nil {
  3118. return nil, err
  3119. }
  3120. defer googleapi.CloseBody(res)
  3121. if err := googleapi.CheckResponse(res); err != nil {
  3122. return nil, err
  3123. }
  3124. ret := &Deployment{
  3125. ServerResponse: googleapi.ServerResponse{
  3126. Header: res.Header,
  3127. HTTPStatusCode: res.StatusCode,
  3128. },
  3129. }
  3130. target := &ret
  3131. if err := gensupport.DecodeResponse(target, res); err != nil {
  3132. return nil, err
  3133. }
  3134. return ret, nil
  3135. // {
  3136. // "description": "Gets a deployment of an Apps Script project.",
  3137. // "flatPath": "v1/projects/{scriptId}/deployments/{deploymentId}",
  3138. // "httpMethod": "GET",
  3139. // "id": "script.projects.deployments.get",
  3140. // "parameterOrder": [
  3141. // "scriptId",
  3142. // "deploymentId"
  3143. // ],
  3144. // "parameters": {
  3145. // "deploymentId": {
  3146. // "description": "The deployment ID.",
  3147. // "location": "path",
  3148. // "required": true,
  3149. // "type": "string"
  3150. // },
  3151. // "scriptId": {
  3152. // "description": "The script project's Drive ID.",
  3153. // "location": "path",
  3154. // "required": true,
  3155. // "type": "string"
  3156. // }
  3157. // },
  3158. // "path": "v1/projects/{scriptId}/deployments/{deploymentId}",
  3159. // "response": {
  3160. // "$ref": "Deployment"
  3161. // },
  3162. // "scopes": [
  3163. // "https://www.googleapis.com/auth/script.deployments",
  3164. // "https://www.googleapis.com/auth/script.deployments.readonly"
  3165. // ]
  3166. // }
  3167. }
  3168. // method id "script.projects.deployments.list":
  3169. type ProjectsDeploymentsListCall struct {
  3170. s *Service
  3171. scriptId string
  3172. urlParams_ gensupport.URLParams
  3173. ifNoneMatch_ string
  3174. ctx_ context.Context
  3175. header_ http.Header
  3176. }
  3177. // List: Lists the deployments of an Apps Script project.
  3178. func (r *ProjectsDeploymentsService) List(scriptId string) *ProjectsDeploymentsListCall {
  3179. c := &ProjectsDeploymentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3180. c.scriptId = scriptId
  3181. return c
  3182. }
  3183. // PageSize sets the optional parameter "pageSize": The maximum number
  3184. // of deployments on each returned page. Defaults to 50.
  3185. func (c *ProjectsDeploymentsListCall) PageSize(pageSize int64) *ProjectsDeploymentsListCall {
  3186. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3187. return c
  3188. }
  3189. // PageToken sets the optional parameter "pageToken": The token for
  3190. // continuing a previous list request on the next page. This
  3191. // should be set to the value of `nextPageToken` from a previous
  3192. // response.
  3193. func (c *ProjectsDeploymentsListCall) PageToken(pageToken string) *ProjectsDeploymentsListCall {
  3194. c.urlParams_.Set("pageToken", pageToken)
  3195. return c
  3196. }
  3197. // Fields allows partial responses to be retrieved. See
  3198. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3199. // for more information.
  3200. func (c *ProjectsDeploymentsListCall) Fields(s ...googleapi.Field) *ProjectsDeploymentsListCall {
  3201. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3202. return c
  3203. }
  3204. // IfNoneMatch sets the optional parameter which makes the operation
  3205. // fail if the object's ETag matches the given value. This is useful for
  3206. // getting updates only after the object has changed since the last
  3207. // request. Use googleapi.IsNotModified to check whether the response
  3208. // error from Do is the result of In-None-Match.
  3209. func (c *ProjectsDeploymentsListCall) IfNoneMatch(entityTag string) *ProjectsDeploymentsListCall {
  3210. c.ifNoneMatch_ = entityTag
  3211. return c
  3212. }
  3213. // Context sets the context to be used in this call's Do method. Any
  3214. // pending HTTP request will be aborted if the provided context is
  3215. // canceled.
  3216. func (c *ProjectsDeploymentsListCall) Context(ctx context.Context) *ProjectsDeploymentsListCall {
  3217. c.ctx_ = ctx
  3218. return c
  3219. }
  3220. // Header returns an http.Header that can be modified by the caller to
  3221. // add HTTP headers to the request.
  3222. func (c *ProjectsDeploymentsListCall) Header() http.Header {
  3223. if c.header_ == nil {
  3224. c.header_ = make(http.Header)
  3225. }
  3226. return c.header_
  3227. }
  3228. func (c *ProjectsDeploymentsListCall) doRequest(alt string) (*http.Response, error) {
  3229. reqHeaders := make(http.Header)
  3230. for k, v := range c.header_ {
  3231. reqHeaders[k] = v
  3232. }
  3233. reqHeaders.Set("User-Agent", c.s.userAgent())
  3234. if c.ifNoneMatch_ != "" {
  3235. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3236. }
  3237. var body io.Reader = nil
  3238. c.urlParams_.Set("alt", alt)
  3239. c.urlParams_.Set("prettyPrint", "false")
  3240. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/deployments")
  3241. urls += "?" + c.urlParams_.Encode()
  3242. req, err := http.NewRequest("GET", urls, body)
  3243. if err != nil {
  3244. return nil, err
  3245. }
  3246. req.Header = reqHeaders
  3247. googleapi.Expand(req.URL, map[string]string{
  3248. "scriptId": c.scriptId,
  3249. })
  3250. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3251. }
  3252. // Do executes the "script.projects.deployments.list" call.
  3253. // Exactly one of *ListDeploymentsResponse or error will be non-nil. Any
  3254. // non-2xx status code is an error. Response headers are in either
  3255. // *ListDeploymentsResponse.ServerResponse.Header or (if a response was
  3256. // returned at all) in error.(*googleapi.Error).Header. Use
  3257. // googleapi.IsNotModified to check whether the returned error was
  3258. // because http.StatusNotModified was returned.
  3259. func (c *ProjectsDeploymentsListCall) Do(opts ...googleapi.CallOption) (*ListDeploymentsResponse, error) {
  3260. gensupport.SetOptions(c.urlParams_, opts...)
  3261. res, err := c.doRequest("json")
  3262. if res != nil && res.StatusCode == http.StatusNotModified {
  3263. if res.Body != nil {
  3264. res.Body.Close()
  3265. }
  3266. return nil, &googleapi.Error{
  3267. Code: res.StatusCode,
  3268. Header: res.Header,
  3269. }
  3270. }
  3271. if err != nil {
  3272. return nil, err
  3273. }
  3274. defer googleapi.CloseBody(res)
  3275. if err := googleapi.CheckResponse(res); err != nil {
  3276. return nil, err
  3277. }
  3278. ret := &ListDeploymentsResponse{
  3279. ServerResponse: googleapi.ServerResponse{
  3280. Header: res.Header,
  3281. HTTPStatusCode: res.StatusCode,
  3282. },
  3283. }
  3284. target := &ret
  3285. if err := gensupport.DecodeResponse(target, res); err != nil {
  3286. return nil, err
  3287. }
  3288. return ret, nil
  3289. // {
  3290. // "description": "Lists the deployments of an Apps Script project.",
  3291. // "flatPath": "v1/projects/{scriptId}/deployments",
  3292. // "httpMethod": "GET",
  3293. // "id": "script.projects.deployments.list",
  3294. // "parameterOrder": [
  3295. // "scriptId"
  3296. // ],
  3297. // "parameters": {
  3298. // "pageSize": {
  3299. // "description": "The maximum number of deployments on each returned page. Defaults to 50.",
  3300. // "format": "int32",
  3301. // "location": "query",
  3302. // "type": "integer"
  3303. // },
  3304. // "pageToken": {
  3305. // "description": "The token for continuing a previous list request on the next page. This\nshould be set to the value of `nextPageToken` from a previous response.",
  3306. // "location": "query",
  3307. // "type": "string"
  3308. // },
  3309. // "scriptId": {
  3310. // "description": "The script project's Drive ID.",
  3311. // "location": "path",
  3312. // "required": true,
  3313. // "type": "string"
  3314. // }
  3315. // },
  3316. // "path": "v1/projects/{scriptId}/deployments",
  3317. // "response": {
  3318. // "$ref": "ListDeploymentsResponse"
  3319. // },
  3320. // "scopes": [
  3321. // "https://www.googleapis.com/auth/script.deployments",
  3322. // "https://www.googleapis.com/auth/script.deployments.readonly"
  3323. // ]
  3324. // }
  3325. }
  3326. // Pages invokes f for each page of results.
  3327. // A non-nil error returned from f will halt the iteration.
  3328. // The provided context supersedes any context provided to the Context method.
  3329. func (c *ProjectsDeploymentsListCall) Pages(ctx context.Context, f func(*ListDeploymentsResponse) error) error {
  3330. c.ctx_ = ctx
  3331. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3332. for {
  3333. x, err := c.Do()
  3334. if err != nil {
  3335. return err
  3336. }
  3337. if err := f(x); err != nil {
  3338. return err
  3339. }
  3340. if x.NextPageToken == "" {
  3341. return nil
  3342. }
  3343. c.PageToken(x.NextPageToken)
  3344. }
  3345. }
  3346. // method id "script.projects.deployments.update":
  3347. type ProjectsDeploymentsUpdateCall struct {
  3348. s *Service
  3349. scriptId string
  3350. deploymentId string
  3351. updatedeploymentrequest *UpdateDeploymentRequest
  3352. urlParams_ gensupport.URLParams
  3353. ctx_ context.Context
  3354. header_ http.Header
  3355. }
  3356. // Update: Updates a deployment of an Apps Script project.
  3357. func (r *ProjectsDeploymentsService) Update(scriptId string, deploymentId string, updatedeploymentrequest *UpdateDeploymentRequest) *ProjectsDeploymentsUpdateCall {
  3358. c := &ProjectsDeploymentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3359. c.scriptId = scriptId
  3360. c.deploymentId = deploymentId
  3361. c.updatedeploymentrequest = updatedeploymentrequest
  3362. return c
  3363. }
  3364. // Fields allows partial responses to be retrieved. See
  3365. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3366. // for more information.
  3367. func (c *ProjectsDeploymentsUpdateCall) Fields(s ...googleapi.Field) *ProjectsDeploymentsUpdateCall {
  3368. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3369. return c
  3370. }
  3371. // Context sets the context to be used in this call's Do method. Any
  3372. // pending HTTP request will be aborted if the provided context is
  3373. // canceled.
  3374. func (c *ProjectsDeploymentsUpdateCall) Context(ctx context.Context) *ProjectsDeploymentsUpdateCall {
  3375. c.ctx_ = ctx
  3376. return c
  3377. }
  3378. // Header returns an http.Header that can be modified by the caller to
  3379. // add HTTP headers to the request.
  3380. func (c *ProjectsDeploymentsUpdateCall) Header() http.Header {
  3381. if c.header_ == nil {
  3382. c.header_ = make(http.Header)
  3383. }
  3384. return c.header_
  3385. }
  3386. func (c *ProjectsDeploymentsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3387. reqHeaders := make(http.Header)
  3388. for k, v := range c.header_ {
  3389. reqHeaders[k] = v
  3390. }
  3391. reqHeaders.Set("User-Agent", c.s.userAgent())
  3392. var body io.Reader = nil
  3393. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatedeploymentrequest)
  3394. if err != nil {
  3395. return nil, err
  3396. }
  3397. reqHeaders.Set("Content-Type", "application/json")
  3398. c.urlParams_.Set("alt", alt)
  3399. c.urlParams_.Set("prettyPrint", "false")
  3400. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/deployments/{deploymentId}")
  3401. urls += "?" + c.urlParams_.Encode()
  3402. req, err := http.NewRequest("PUT", urls, body)
  3403. if err != nil {
  3404. return nil, err
  3405. }
  3406. req.Header = reqHeaders
  3407. googleapi.Expand(req.URL, map[string]string{
  3408. "scriptId": c.scriptId,
  3409. "deploymentId": c.deploymentId,
  3410. })
  3411. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3412. }
  3413. // Do executes the "script.projects.deployments.update" call.
  3414. // Exactly one of *Deployment or error will be non-nil. Any non-2xx
  3415. // status code is an error. Response headers are in either
  3416. // *Deployment.ServerResponse.Header or (if a response was returned at
  3417. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3418. // to check whether the returned error was because
  3419. // http.StatusNotModified was returned.
  3420. func (c *ProjectsDeploymentsUpdateCall) Do(opts ...googleapi.CallOption) (*Deployment, error) {
  3421. gensupport.SetOptions(c.urlParams_, opts...)
  3422. res, err := c.doRequest("json")
  3423. if res != nil && res.StatusCode == http.StatusNotModified {
  3424. if res.Body != nil {
  3425. res.Body.Close()
  3426. }
  3427. return nil, &googleapi.Error{
  3428. Code: res.StatusCode,
  3429. Header: res.Header,
  3430. }
  3431. }
  3432. if err != nil {
  3433. return nil, err
  3434. }
  3435. defer googleapi.CloseBody(res)
  3436. if err := googleapi.CheckResponse(res); err != nil {
  3437. return nil, err
  3438. }
  3439. ret := &Deployment{
  3440. ServerResponse: googleapi.ServerResponse{
  3441. Header: res.Header,
  3442. HTTPStatusCode: res.StatusCode,
  3443. },
  3444. }
  3445. target := &ret
  3446. if err := gensupport.DecodeResponse(target, res); err != nil {
  3447. return nil, err
  3448. }
  3449. return ret, nil
  3450. // {
  3451. // "description": "Updates a deployment of an Apps Script project.",
  3452. // "flatPath": "v1/projects/{scriptId}/deployments/{deploymentId}",
  3453. // "httpMethod": "PUT",
  3454. // "id": "script.projects.deployments.update",
  3455. // "parameterOrder": [
  3456. // "scriptId",
  3457. // "deploymentId"
  3458. // ],
  3459. // "parameters": {
  3460. // "deploymentId": {
  3461. // "description": "The deployment ID for this deployment.",
  3462. // "location": "path",
  3463. // "required": true,
  3464. // "type": "string"
  3465. // },
  3466. // "scriptId": {
  3467. // "description": "The script project's Drive ID.",
  3468. // "location": "path",
  3469. // "required": true,
  3470. // "type": "string"
  3471. // }
  3472. // },
  3473. // "path": "v1/projects/{scriptId}/deployments/{deploymentId}",
  3474. // "request": {
  3475. // "$ref": "UpdateDeploymentRequest"
  3476. // },
  3477. // "response": {
  3478. // "$ref": "Deployment"
  3479. // },
  3480. // "scopes": [
  3481. // "https://www.googleapis.com/auth/script.deployments"
  3482. // ]
  3483. // }
  3484. }
  3485. // method id "script.projects.versions.create":
  3486. type ProjectsVersionsCreateCall struct {
  3487. s *Service
  3488. scriptId string
  3489. version *Version
  3490. urlParams_ gensupport.URLParams
  3491. ctx_ context.Context
  3492. header_ http.Header
  3493. }
  3494. // Create: Creates a new immutable version using the current code, with
  3495. // a unique
  3496. // version number.
  3497. func (r *ProjectsVersionsService) Create(scriptId string, version *Version) *ProjectsVersionsCreateCall {
  3498. c := &ProjectsVersionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3499. c.scriptId = scriptId
  3500. c.version = version
  3501. return c
  3502. }
  3503. // Fields allows partial responses to be retrieved. See
  3504. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3505. // for more information.
  3506. func (c *ProjectsVersionsCreateCall) Fields(s ...googleapi.Field) *ProjectsVersionsCreateCall {
  3507. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3508. return c
  3509. }
  3510. // Context sets the context to be used in this call's Do method. Any
  3511. // pending HTTP request will be aborted if the provided context is
  3512. // canceled.
  3513. func (c *ProjectsVersionsCreateCall) Context(ctx context.Context) *ProjectsVersionsCreateCall {
  3514. c.ctx_ = ctx
  3515. return c
  3516. }
  3517. // Header returns an http.Header that can be modified by the caller to
  3518. // add HTTP headers to the request.
  3519. func (c *ProjectsVersionsCreateCall) Header() http.Header {
  3520. if c.header_ == nil {
  3521. c.header_ = make(http.Header)
  3522. }
  3523. return c.header_
  3524. }
  3525. func (c *ProjectsVersionsCreateCall) doRequest(alt string) (*http.Response, error) {
  3526. reqHeaders := make(http.Header)
  3527. for k, v := range c.header_ {
  3528. reqHeaders[k] = v
  3529. }
  3530. reqHeaders.Set("User-Agent", c.s.userAgent())
  3531. var body io.Reader = nil
  3532. body, err := googleapi.WithoutDataWrapper.JSONReader(c.version)
  3533. if err != nil {
  3534. return nil, err
  3535. }
  3536. reqHeaders.Set("Content-Type", "application/json")
  3537. c.urlParams_.Set("alt", alt)
  3538. c.urlParams_.Set("prettyPrint", "false")
  3539. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/versions")
  3540. urls += "?" + c.urlParams_.Encode()
  3541. req, err := http.NewRequest("POST", urls, body)
  3542. if err != nil {
  3543. return nil, err
  3544. }
  3545. req.Header = reqHeaders
  3546. googleapi.Expand(req.URL, map[string]string{
  3547. "scriptId": c.scriptId,
  3548. })
  3549. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3550. }
  3551. // Do executes the "script.projects.versions.create" call.
  3552. // Exactly one of *Version or error will be non-nil. Any non-2xx status
  3553. // code is an error. Response headers are in either
  3554. // *Version.ServerResponse.Header or (if a response was returned at all)
  3555. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3556. // check whether the returned error was because http.StatusNotModified
  3557. // was returned.
  3558. func (c *ProjectsVersionsCreateCall) Do(opts ...googleapi.CallOption) (*Version, error) {
  3559. gensupport.SetOptions(c.urlParams_, opts...)
  3560. res, err := c.doRequest("json")
  3561. if res != nil && res.StatusCode == http.StatusNotModified {
  3562. if res.Body != nil {
  3563. res.Body.Close()
  3564. }
  3565. return nil, &googleapi.Error{
  3566. Code: res.StatusCode,
  3567. Header: res.Header,
  3568. }
  3569. }
  3570. if err != nil {
  3571. return nil, err
  3572. }
  3573. defer googleapi.CloseBody(res)
  3574. if err := googleapi.CheckResponse(res); err != nil {
  3575. return nil, err
  3576. }
  3577. ret := &Version{
  3578. ServerResponse: googleapi.ServerResponse{
  3579. Header: res.Header,
  3580. HTTPStatusCode: res.StatusCode,
  3581. },
  3582. }
  3583. target := &ret
  3584. if err := gensupport.DecodeResponse(target, res); err != nil {
  3585. return nil, err
  3586. }
  3587. return ret, nil
  3588. // {
  3589. // "description": "Creates a new immutable version using the current code, with a unique\nversion number.",
  3590. // "flatPath": "v1/projects/{scriptId}/versions",
  3591. // "httpMethod": "POST",
  3592. // "id": "script.projects.versions.create",
  3593. // "parameterOrder": [
  3594. // "scriptId"
  3595. // ],
  3596. // "parameters": {
  3597. // "scriptId": {
  3598. // "description": "The script project's Drive ID.",
  3599. // "location": "path",
  3600. // "required": true,
  3601. // "type": "string"
  3602. // }
  3603. // },
  3604. // "path": "v1/projects/{scriptId}/versions",
  3605. // "request": {
  3606. // "$ref": "Version"
  3607. // },
  3608. // "response": {
  3609. // "$ref": "Version"
  3610. // },
  3611. // "scopes": [
  3612. // "https://www.googleapis.com/auth/script.projects"
  3613. // ]
  3614. // }
  3615. }
  3616. // method id "script.projects.versions.get":
  3617. type ProjectsVersionsGetCall struct {
  3618. s *Service
  3619. scriptId string
  3620. versionNumber int64
  3621. urlParams_ gensupport.URLParams
  3622. ifNoneMatch_ string
  3623. ctx_ context.Context
  3624. header_ http.Header
  3625. }
  3626. // Get: Gets a version of a script project.
  3627. func (r *ProjectsVersionsService) Get(scriptId string, versionNumber int64) *ProjectsVersionsGetCall {
  3628. c := &ProjectsVersionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3629. c.scriptId = scriptId
  3630. c.versionNumber = versionNumber
  3631. return c
  3632. }
  3633. // Fields allows partial responses to be retrieved. See
  3634. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3635. // for more information.
  3636. func (c *ProjectsVersionsGetCall) Fields(s ...googleapi.Field) *ProjectsVersionsGetCall {
  3637. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3638. return c
  3639. }
  3640. // IfNoneMatch sets the optional parameter which makes the operation
  3641. // fail if the object's ETag matches the given value. This is useful for
  3642. // getting updates only after the object has changed since the last
  3643. // request. Use googleapi.IsNotModified to check whether the response
  3644. // error from Do is the result of In-None-Match.
  3645. func (c *ProjectsVersionsGetCall) IfNoneMatch(entityTag string) *ProjectsVersionsGetCall {
  3646. c.ifNoneMatch_ = entityTag
  3647. return c
  3648. }
  3649. // Context sets the context to be used in this call's Do method. Any
  3650. // pending HTTP request will be aborted if the provided context is
  3651. // canceled.
  3652. func (c *ProjectsVersionsGetCall) Context(ctx context.Context) *ProjectsVersionsGetCall {
  3653. c.ctx_ = ctx
  3654. return c
  3655. }
  3656. // Header returns an http.Header that can be modified by the caller to
  3657. // add HTTP headers to the request.
  3658. func (c *ProjectsVersionsGetCall) Header() http.Header {
  3659. if c.header_ == nil {
  3660. c.header_ = make(http.Header)
  3661. }
  3662. return c.header_
  3663. }
  3664. func (c *ProjectsVersionsGetCall) doRequest(alt string) (*http.Response, error) {
  3665. reqHeaders := make(http.Header)
  3666. for k, v := range c.header_ {
  3667. reqHeaders[k] = v
  3668. }
  3669. reqHeaders.Set("User-Agent", c.s.userAgent())
  3670. if c.ifNoneMatch_ != "" {
  3671. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3672. }
  3673. var body io.Reader = nil
  3674. c.urlParams_.Set("alt", alt)
  3675. c.urlParams_.Set("prettyPrint", "false")
  3676. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/versions/{versionNumber}")
  3677. urls += "?" + c.urlParams_.Encode()
  3678. req, err := http.NewRequest("GET", urls, body)
  3679. if err != nil {
  3680. return nil, err
  3681. }
  3682. req.Header = reqHeaders
  3683. googleapi.Expand(req.URL, map[string]string{
  3684. "scriptId": c.scriptId,
  3685. "versionNumber": strconv.FormatInt(c.versionNumber, 10),
  3686. })
  3687. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3688. }
  3689. // Do executes the "script.projects.versions.get" call.
  3690. // Exactly one of *Version or error will be non-nil. Any non-2xx status
  3691. // code is an error. Response headers are in either
  3692. // *Version.ServerResponse.Header or (if a response was returned at all)
  3693. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3694. // check whether the returned error was because http.StatusNotModified
  3695. // was returned.
  3696. func (c *ProjectsVersionsGetCall) Do(opts ...googleapi.CallOption) (*Version, error) {
  3697. gensupport.SetOptions(c.urlParams_, opts...)
  3698. res, err := c.doRequest("json")
  3699. if res != nil && res.StatusCode == http.StatusNotModified {
  3700. if res.Body != nil {
  3701. res.Body.Close()
  3702. }
  3703. return nil, &googleapi.Error{
  3704. Code: res.StatusCode,
  3705. Header: res.Header,
  3706. }
  3707. }
  3708. if err != nil {
  3709. return nil, err
  3710. }
  3711. defer googleapi.CloseBody(res)
  3712. if err := googleapi.CheckResponse(res); err != nil {
  3713. return nil, err
  3714. }
  3715. ret := &Version{
  3716. ServerResponse: googleapi.ServerResponse{
  3717. Header: res.Header,
  3718. HTTPStatusCode: res.StatusCode,
  3719. },
  3720. }
  3721. target := &ret
  3722. if err := gensupport.DecodeResponse(target, res); err != nil {
  3723. return nil, err
  3724. }
  3725. return ret, nil
  3726. // {
  3727. // "description": "Gets a version of a script project.",
  3728. // "flatPath": "v1/projects/{scriptId}/versions/{versionNumber}",
  3729. // "httpMethod": "GET",
  3730. // "id": "script.projects.versions.get",
  3731. // "parameterOrder": [
  3732. // "scriptId",
  3733. // "versionNumber"
  3734. // ],
  3735. // "parameters": {
  3736. // "scriptId": {
  3737. // "description": "The script project's Drive ID.",
  3738. // "location": "path",
  3739. // "required": true,
  3740. // "type": "string"
  3741. // },
  3742. // "versionNumber": {
  3743. // "description": "The version number.",
  3744. // "format": "int32",
  3745. // "location": "path",
  3746. // "required": true,
  3747. // "type": "integer"
  3748. // }
  3749. // },
  3750. // "path": "v1/projects/{scriptId}/versions/{versionNumber}",
  3751. // "response": {
  3752. // "$ref": "Version"
  3753. // },
  3754. // "scopes": [
  3755. // "https://www.googleapis.com/auth/script.projects",
  3756. // "https://www.googleapis.com/auth/script.projects.readonly"
  3757. // ]
  3758. // }
  3759. }
  3760. // method id "script.projects.versions.list":
  3761. type ProjectsVersionsListCall struct {
  3762. s *Service
  3763. scriptId string
  3764. urlParams_ gensupport.URLParams
  3765. ifNoneMatch_ string
  3766. ctx_ context.Context
  3767. header_ http.Header
  3768. }
  3769. // List: List the versions of a script project.
  3770. func (r *ProjectsVersionsService) List(scriptId string) *ProjectsVersionsListCall {
  3771. c := &ProjectsVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3772. c.scriptId = scriptId
  3773. return c
  3774. }
  3775. // PageSize sets the optional parameter "pageSize": The maximum number
  3776. // of versions on each returned page. Defaults to 50.
  3777. func (c *ProjectsVersionsListCall) PageSize(pageSize int64) *ProjectsVersionsListCall {
  3778. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3779. return c
  3780. }
  3781. // PageToken sets the optional parameter "pageToken": The token for
  3782. // continuing a previous list request on the next page. This
  3783. // should be set to the value of `nextPageToken` from a previous
  3784. // response.
  3785. func (c *ProjectsVersionsListCall) PageToken(pageToken string) *ProjectsVersionsListCall {
  3786. c.urlParams_.Set("pageToken", pageToken)
  3787. return c
  3788. }
  3789. // Fields allows partial responses to be retrieved. See
  3790. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3791. // for more information.
  3792. func (c *ProjectsVersionsListCall) Fields(s ...googleapi.Field) *ProjectsVersionsListCall {
  3793. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3794. return c
  3795. }
  3796. // IfNoneMatch sets the optional parameter which makes the operation
  3797. // fail if the object's ETag matches the given value. This is useful for
  3798. // getting updates only after the object has changed since the last
  3799. // request. Use googleapi.IsNotModified to check whether the response
  3800. // error from Do is the result of In-None-Match.
  3801. func (c *ProjectsVersionsListCall) IfNoneMatch(entityTag string) *ProjectsVersionsListCall {
  3802. c.ifNoneMatch_ = entityTag
  3803. return c
  3804. }
  3805. // Context sets the context to be used in this call's Do method. Any
  3806. // pending HTTP request will be aborted if the provided context is
  3807. // canceled.
  3808. func (c *ProjectsVersionsListCall) Context(ctx context.Context) *ProjectsVersionsListCall {
  3809. c.ctx_ = ctx
  3810. return c
  3811. }
  3812. // Header returns an http.Header that can be modified by the caller to
  3813. // add HTTP headers to the request.
  3814. func (c *ProjectsVersionsListCall) Header() http.Header {
  3815. if c.header_ == nil {
  3816. c.header_ = make(http.Header)
  3817. }
  3818. return c.header_
  3819. }
  3820. func (c *ProjectsVersionsListCall) doRequest(alt string) (*http.Response, error) {
  3821. reqHeaders := make(http.Header)
  3822. for k, v := range c.header_ {
  3823. reqHeaders[k] = v
  3824. }
  3825. reqHeaders.Set("User-Agent", c.s.userAgent())
  3826. if c.ifNoneMatch_ != "" {
  3827. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3828. }
  3829. var body io.Reader = nil
  3830. c.urlParams_.Set("alt", alt)
  3831. c.urlParams_.Set("prettyPrint", "false")
  3832. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{scriptId}/versions")
  3833. urls += "?" + c.urlParams_.Encode()
  3834. req, err := http.NewRequest("GET", urls, body)
  3835. if err != nil {
  3836. return nil, err
  3837. }
  3838. req.Header = reqHeaders
  3839. googleapi.Expand(req.URL, map[string]string{
  3840. "scriptId": c.scriptId,
  3841. })
  3842. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3843. }
  3844. // Do executes the "script.projects.versions.list" call.
  3845. // Exactly one of *ListVersionsResponse or error will be non-nil. Any
  3846. // non-2xx status code is an error. Response headers are in either
  3847. // *ListVersionsResponse.ServerResponse.Header or (if a response was
  3848. // returned at all) in error.(*googleapi.Error).Header. Use
  3849. // googleapi.IsNotModified to check whether the returned error was
  3850. // because http.StatusNotModified was returned.
  3851. func (c *ProjectsVersionsListCall) Do(opts ...googleapi.CallOption) (*ListVersionsResponse, error) {
  3852. gensupport.SetOptions(c.urlParams_, opts...)
  3853. res, err := c.doRequest("json")
  3854. if res != nil && res.StatusCode == http.StatusNotModified {
  3855. if res.Body != nil {
  3856. res.Body.Close()
  3857. }
  3858. return nil, &googleapi.Error{
  3859. Code: res.StatusCode,
  3860. Header: res.Header,
  3861. }
  3862. }
  3863. if err != nil {
  3864. return nil, err
  3865. }
  3866. defer googleapi.CloseBody(res)
  3867. if err := googleapi.CheckResponse(res); err != nil {
  3868. return nil, err
  3869. }
  3870. ret := &ListVersionsResponse{
  3871. ServerResponse: googleapi.ServerResponse{
  3872. Header: res.Header,
  3873. HTTPStatusCode: res.StatusCode,
  3874. },
  3875. }
  3876. target := &ret
  3877. if err := gensupport.DecodeResponse(target, res); err != nil {
  3878. return nil, err
  3879. }
  3880. return ret, nil
  3881. // {
  3882. // "description": "List the versions of a script project.",
  3883. // "flatPath": "v1/projects/{scriptId}/versions",
  3884. // "httpMethod": "GET",
  3885. // "id": "script.projects.versions.list",
  3886. // "parameterOrder": [
  3887. // "scriptId"
  3888. // ],
  3889. // "parameters": {
  3890. // "pageSize": {
  3891. // "description": "The maximum number of versions on each returned page. Defaults to 50.",
  3892. // "format": "int32",
  3893. // "location": "query",
  3894. // "type": "integer"
  3895. // },
  3896. // "pageToken": {
  3897. // "description": "The token for continuing a previous list request on the next page. This\nshould be set to the value of `nextPageToken` from a previous response.",
  3898. // "location": "query",
  3899. // "type": "string"
  3900. // },
  3901. // "scriptId": {
  3902. // "description": "The script project's Drive ID.",
  3903. // "location": "path",
  3904. // "required": true,
  3905. // "type": "string"
  3906. // }
  3907. // },
  3908. // "path": "v1/projects/{scriptId}/versions",
  3909. // "response": {
  3910. // "$ref": "ListVersionsResponse"
  3911. // },
  3912. // "scopes": [
  3913. // "https://www.googleapis.com/auth/script.projects",
  3914. // "https://www.googleapis.com/auth/script.projects.readonly"
  3915. // ]
  3916. // }
  3917. }
  3918. // Pages invokes f for each page of results.
  3919. // A non-nil error returned from f will halt the iteration.
  3920. // The provided context supersedes any context provided to the Context method.
  3921. func (c *ProjectsVersionsListCall) Pages(ctx context.Context, f func(*ListVersionsResponse) error) error {
  3922. c.ctx_ = ctx
  3923. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3924. for {
  3925. x, err := c.Do()
  3926. if err != nil {
  3927. return err
  3928. }
  3929. if err := f(x); err != nil {
  3930. return err
  3931. }
  3932. if x.NextPageToken == "" {
  3933. return nil
  3934. }
  3935. c.PageToken(x.NextPageToken)
  3936. }
  3937. }
  3938. // method id "script.scripts.run":
  3939. type ScriptsRunCall struct {
  3940. s *Service
  3941. scriptId string
  3942. executionrequest *ExecutionRequest
  3943. urlParams_ gensupport.URLParams
  3944. ctx_ context.Context
  3945. header_ http.Header
  3946. }
  3947. // Run: Runs a function in an Apps Script project. The script project
  3948. // must be
  3949. // deployed for use with the Apps Script API and the calling application
  3950. // must
  3951. // share the same Cloud Platform project.
  3952. //
  3953. // This method requires authorization with an OAuth 2.0 token that
  3954. // includes at
  3955. // least one of the scopes listed in the
  3956. // [Authorization](#authorization)
  3957. // section; script projects that do not require authorization cannot
  3958. // be
  3959. // executed through this API. To find the correct scopes to include in
  3960. // the
  3961. // authentication token, open the project in the script editor, then
  3962. // select
  3963. // **File > Project properties** and click the **Scopes** tab.
  3964. //
  3965. // The error `403, PERMISSION_DENIED: The caller does not have
  3966. // permission`
  3967. // indicates that the Cloud Platform project used to authorize the
  3968. // request is
  3969. // not the same as the one used by the script.
  3970. func (r *ScriptsService) Run(scriptId string, executionrequest *ExecutionRequest) *ScriptsRunCall {
  3971. c := &ScriptsRunCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3972. c.scriptId = scriptId
  3973. c.executionrequest = executionrequest
  3974. return c
  3975. }
  3976. // Fields allows partial responses to be retrieved. See
  3977. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3978. // for more information.
  3979. func (c *ScriptsRunCall) Fields(s ...googleapi.Field) *ScriptsRunCall {
  3980. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3981. return c
  3982. }
  3983. // Context sets the context to be used in this call's Do method. Any
  3984. // pending HTTP request will be aborted if the provided context is
  3985. // canceled.
  3986. func (c *ScriptsRunCall) Context(ctx context.Context) *ScriptsRunCall {
  3987. c.ctx_ = ctx
  3988. return c
  3989. }
  3990. // Header returns an http.Header that can be modified by the caller to
  3991. // add HTTP headers to the request.
  3992. func (c *ScriptsRunCall) Header() http.Header {
  3993. if c.header_ == nil {
  3994. c.header_ = make(http.Header)
  3995. }
  3996. return c.header_
  3997. }
  3998. func (c *ScriptsRunCall) doRequest(alt string) (*http.Response, error) {
  3999. reqHeaders := make(http.Header)
  4000. for k, v := range c.header_ {
  4001. reqHeaders[k] = v
  4002. }
  4003. reqHeaders.Set("User-Agent", c.s.userAgent())
  4004. var body io.Reader = nil
  4005. body, err := googleapi.WithoutDataWrapper.JSONReader(c.executionrequest)
  4006. if err != nil {
  4007. return nil, err
  4008. }
  4009. reqHeaders.Set("Content-Type", "application/json")
  4010. c.urlParams_.Set("alt", alt)
  4011. c.urlParams_.Set("prettyPrint", "false")
  4012. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/scripts/{scriptId}:run")
  4013. urls += "?" + c.urlParams_.Encode()
  4014. req, err := http.NewRequest("POST", urls, body)
  4015. if err != nil {
  4016. return nil, err
  4017. }
  4018. req.Header = reqHeaders
  4019. googleapi.Expand(req.URL, map[string]string{
  4020. "scriptId": c.scriptId,
  4021. })
  4022. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4023. }
  4024. // Do executes the "script.scripts.run" call.
  4025. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4026. // status code is an error. Response headers are in either
  4027. // *Operation.ServerResponse.Header or (if a response was returned at
  4028. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4029. // to check whether the returned error was because
  4030. // http.StatusNotModified was returned.
  4031. func (c *ScriptsRunCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4032. gensupport.SetOptions(c.urlParams_, opts...)
  4033. res, err := c.doRequest("json")
  4034. if res != nil && res.StatusCode == http.StatusNotModified {
  4035. if res.Body != nil {
  4036. res.Body.Close()
  4037. }
  4038. return nil, &googleapi.Error{
  4039. Code: res.StatusCode,
  4040. Header: res.Header,
  4041. }
  4042. }
  4043. if err != nil {
  4044. return nil, err
  4045. }
  4046. defer googleapi.CloseBody(res)
  4047. if err := googleapi.CheckResponse(res); err != nil {
  4048. return nil, err
  4049. }
  4050. ret := &Operation{
  4051. ServerResponse: googleapi.ServerResponse{
  4052. Header: res.Header,
  4053. HTTPStatusCode: res.StatusCode,
  4054. },
  4055. }
  4056. target := &ret
  4057. if err := gensupport.DecodeResponse(target, res); err != nil {
  4058. return nil, err
  4059. }
  4060. return ret, nil
  4061. // {
  4062. // "description": "Runs a function in an Apps Script project. The script project must be\ndeployed for use with the Apps Script API and the calling application must\nshare the same Cloud Platform project.\n\nThis method requires authorization with an OAuth 2.0 token that includes at\nleast one of the scopes listed in the [Authorization](#authorization)\nsection; script projects that do not require authorization cannot be\nexecuted through this API. To find the correct scopes to include in the\nauthentication token, open the project in the script editor, then select\n**File \u003e Project properties** and click the **Scopes** tab.\n\nThe error `403, PERMISSION_DENIED: The caller does not have permission`\nindicates that the Cloud Platform project used to authorize the request is\nnot the same as the one used by the script.",
  4063. // "flatPath": "v1/scripts/{scriptId}:run",
  4064. // "httpMethod": "POST",
  4065. // "id": "script.scripts.run",
  4066. // "parameterOrder": [
  4067. // "scriptId"
  4068. // ],
  4069. // "parameters": {
  4070. // "scriptId": {
  4071. // "description": "The script ID of the script to be executed. To find the script ID, open\nthe project in the script editor and select **File \u003e Project properties**.",
  4072. // "location": "path",
  4073. // "required": true,
  4074. // "type": "string"
  4075. // }
  4076. // },
  4077. // "path": "v1/scripts/{scriptId}:run",
  4078. // "request": {
  4079. // "$ref": "ExecutionRequest"
  4080. // },
  4081. // "response": {
  4082. // "$ref": "Operation"
  4083. // },
  4084. // "scopes": [
  4085. // "https://mail.google.com/",
  4086. // "https://www.google.com/calendar/feeds",
  4087. // "https://www.google.com/m8/feeds",
  4088. // "https://www.googleapis.com/auth/admin.directory.group",
  4089. // "https://www.googleapis.com/auth/admin.directory.user",
  4090. // "https://www.googleapis.com/auth/documents",
  4091. // "https://www.googleapis.com/auth/drive",
  4092. // "https://www.googleapis.com/auth/forms",
  4093. // "https://www.googleapis.com/auth/forms.currentonly",
  4094. // "https://www.googleapis.com/auth/groups",
  4095. // "https://www.googleapis.com/auth/spreadsheets",
  4096. // "https://www.googleapis.com/auth/userinfo.email"
  4097. // ]
  4098. // }
  4099. }