You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

4367 lines
154 KiB

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