on develop help sign in
Generating script API library
b3fd66aBrendan Hay
gogol-script/LICENSEnew file+367
@@ -0,0 +1,367 @@
1+Mozilla Public License Version 2.0
2+==================================
3+
4+1. Definitions
5+--------------
6+
7+1.1. "Contributor"
8+ means each individual or legal entity that creates, contributes to
9+ the creation of, or owns Covered Software.
10+
11+1.2. "Contributor Version"
12+ means the combination of the Contributions of others (if any) used
13+ by a Contributor and that particular Contributor's Contribution.
14+
15+1.3. "Contribution"
16+ means Covered Software of a particular Contributor.
17+
18+1.4. "Covered Software"
19+ means Source Code Form to which the initial Contributor has attached
20+ the notice in Exhibit A, the Executable Form of such Source Code
21+ Form, and Modifications of such Source Code Form, in each case
22+ including portions thereof.
23+
24+1.5. "Incompatible With Secondary Licenses"
25+ means
26+
27+ (a) that the initial Contributor has attached the notice described
28+ in Exhibit B to the Covered Software; or
29+
30+ (b) that the Covered Software was made available under the terms of
31+ version 1.1 or earlier of the License, but not also under the
32+ terms of a Secondary License.
33+
34+1.6. "Executable Form"
35+ means any form of the work other than Source Code Form.
36+
37+1.7. "Larger Work"
38+ means a work that combines Covered Software with other material, in
39+ a separate file or files, that is not Covered Software.
40+
41+1.8. "License"
42+ means this document.
43+
44+1.9. "Licensable"
45+ means having the right to grant, to the maximum extent possible,
46+ whether at the time of the initial grant or subsequently, any and
47+ all of the rights conveyed by this License.
48+
49+1.10. "Modifications"
50+ means any of the following:
51+
52+ (a) any file in Source Code Form that results from an addition to,
53+ deletion from, or modification of the contents of Covered
54+ Software; or
55+
56+ (b) any new file in Source Code Form that contains any Covered
57+ Software.
58+
59+1.11. "Patent Claims" of a Contributor
60+ means any patent claim(s), including without limitation, method,
61+ process, and apparatus claims, in any patent Licensable by such
62+ Contributor that would be infringed, but for the grant of the
63+ License, by the making, using, selling, offering for sale, having
64+ made, import, or transfer of either its Contributions or its
65+ Contributor Version.
66+
67+1.12. "Secondary License"
68+ means either the GNU General Public License, Version 2.0, the GNU
69+ Lesser General Public License, Version 2.1, the GNU Affero General
70+ Public License, Version 3.0, or any later versions of those
71+ licenses.
72+
73+1.13. "Source Code Form"
74+ means the form of the work preferred for making modifications.
75+
76+1.14. "You" (or "Your")
77+ means an individual or a legal entity exercising rights under this
78+ License. For legal entities, "You" includes any entity that
79+ controls, is controlled by, or is under common control with You. For
80+ purposes of this definition, "control" means (a) the power, direct
81+ or indirect, to cause the direction or management of such entity,
82+ whether by contract or otherwise, or (b) ownership of more than
83+ fifty percent (50%) of the outstanding shares or beneficial
84+ ownership of such entity.
85+
86+2. License Grants and Conditions
87+--------------------------------
88+
89+2.1. Grants
90+
91+Each Contributor hereby grants You a world-wide, royalty-free,
92+non-exclusive license:
93+
94+(a) under intellectual property rights (other than patent or trademark)
95+ Licensable by such Contributor to use, reproduce, make available,
96+ modify, display, perform, distribute, and otherwise exploit its
97+ Contributions, either on an unmodified basis, with Modifications, or
98+ as part of a Larger Work; and
99+
100+(b) under Patent Claims of such Contributor to make, use, sell, offer
101+ for sale, have made, import, and otherwise transfer either its
102+ Contributions or its Contributor Version.
103+
104+2.2. Effective Date
105+
106+The licenses granted in Section 2.1 with respect to any Contribution
107+become effective for each Contribution on the date the Contributor first
108+distributes such Contribution.
109+
110+2.3. Limitations on Grant Scope
111+
112+The licenses granted in this Section 2 are the only rights granted under
113+this License. No additional rights or licenses will be implied from the
114+distribution or licensing of Covered Software under this License.
115+Notwithstanding Section 2.1(b) above, no patent license is granted by a
116+Contributor:
117+
118+(a) for any code that a Contributor has removed from Covered Software;
119+ or
120+
121+(b) for infringements caused by: (i) Your and any other third party's
122+ modifications of Covered Software, or (ii) the combination of its
123+ Contributions with other software (except as part of its Contributor
124+ Version); or
125+
126+(c) under Patent Claims infringed by Covered Software in the absence of
127+ its Contributions.
128+
129+This License does not grant any rights in the trademarks, service marks,
130+or logos of any Contributor (except as may be necessary to comply with
131+the notice requirements in Section 3.4).
132+
133+2.4. Subsequent Licenses
134+
135+No Contributor makes additional grants as a result of Your choice to
136+distribute the Covered Software under a subsequent version of this
137+License (see Section 10.2) or under the terms of a Secondary License (if
138+permitted under the terms of Section 3.3).
139+
140+2.5. Representation
141+
142+Each Contributor represents that the Contributor believes its
143+Contributions are its original creation(s) or it has sufficient rights
144+to grant the rights to its Contributions conveyed by this License.
145+
146+2.6. Fair Use
147+
148+This License is not intended to limit any rights You have under
149+applicable copyright doctrines of fair use, fair dealing, or other
150+equivalents.
151+
152+2.7. Conditions
153+
154+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155+in Section 2.1.
156+
157+3. Responsibilities
158+-------------------
159+
160+3.1. Distribution of Source Form
161+
162+All distribution of Covered Software in Source Code Form, including any
163+Modifications that You create or to which You contribute, must be under
164+the terms of this License. You must inform recipients that the Source
165+Code Form of the Covered Software is governed by the terms of this
166+License, and how they can obtain a copy of this License. You may not
167+attempt to alter or restrict the recipients' rights in the Source Code
168+Form.
169+
170+3.2. Distribution of Executable Form
171+
172+If You distribute Covered Software in Executable Form then:
173+
174+(a) such Covered Software must also be made available in Source Code
175+ Form, as described in Section 3.1, and You must inform recipients of
176+ the Executable Form how they can obtain a copy of such Source Code
177+ Form by reasonable means in a timely manner, at a charge no more
178+ than the cost of distribution to the recipient; and
179+
180+(b) You may distribute such Executable Form under the terms of this
181+ License, or sublicense it under different terms, provided that the
182+ license for the Executable Form does not attempt to limit or alter
183+ the recipients' rights in the Source Code Form under this License.
184+
185+3.3. Distribution of a Larger Work
186+
187+You may create and distribute a Larger Work under terms of Your choice,
188+provided that You also comply with the requirements of this License for
189+the Covered Software. If the Larger Work is a combination of Covered
190+Software with a work governed by one or more Secondary Licenses, and the
191+Covered Software is not Incompatible With Secondary Licenses, this
192+License permits You to additionally distribute such Covered Software
193+under the terms of such Secondary License(s), so that the recipient of
194+the Larger Work may, at their option, further distribute the Covered
195+Software under the terms of either this License or such Secondary
196+License(s).
197+
198+3.4. Notices
199+
200+You may not remove or alter the substance of any license notices
201+(including copyright notices, patent notices, disclaimers of warranty,
202+or limitations of liability) contained within the Source Code Form of
203+the Covered Software, except that You may alter any license notices to
204+the extent required to remedy known factual inaccuracies.
205+
206+3.5. Application of Additional Terms
207+
208+You may choose to offer, and to charge a fee for, warranty, support,
209+indemnity or liability obligations to one or more recipients of Covered
210+Software. However, You may do so only on Your own behalf, and not on
211+behalf of any Contributor. You must make it absolutely clear that any
212+such warranty, support, indemnity, or liability obligation is offered by
213+You alone, and You hereby agree to indemnify every Contributor for any
214+liability incurred by such Contributor as a result of warranty, support,
215+indemnity or liability terms You offer. You may include additional
216+disclaimers of warranty and limitations of liability specific to any
217+jurisdiction.
218+
219+4. Inability to Comply Due to Statute or Regulation
220+---------------------------------------------------
221+
222+If it is impossible for You to comply with any of the terms of this
223+License with respect to some or all of the Covered Software due to
224+statute, judicial order, or regulation then You must: (a) comply with
225+the terms of this License to the maximum extent possible; and (b)
226+describe the limitations and the code they affect. Such description must
227+be placed in a text file included with all distributions of the Covered
228+Software under this License. Except to the extent prohibited by statute
229+or regulation, such description must be sufficiently detailed for a
230+recipient of ordinary skill to be able to understand it.
231+
232+5. Termination
233+--------------
234+
235+5.1. The rights granted under this License will terminate automatically
236+if You fail to comply with any of its terms. However, if You become
237+compliant, then the rights granted under this License from a particular
238+Contributor are reinstated (a) provisionally, unless and until such
239+Contributor explicitly and finally terminates Your grants, and (b) on an
240+ongoing basis, if such Contributor fails to notify You of the
241+non-compliance by some reasonable means prior to 60 days after You have
242+come back into compliance. Moreover, Your grants from a particular
243+Contributor are reinstated on an ongoing basis if such Contributor
244+notifies You of the non-compliance by some reasonable means, this is the
245+first time You have received notice of non-compliance with this License
246+from such Contributor, and You become compliant prior to 30 days after
247+Your receipt of the notice.
248+
249+5.2. If You initiate litigation against any entity by asserting a patent
250+infringement claim (excluding declaratory judgment actions,
251+counter-claims, and cross-claims) alleging that a Contributor Version
252+directly or indirectly infringes any patent, then the rights granted to
253+You by any and all Contributors for the Covered Software under Section
254+2.1 of this License shall terminate.
255+
256+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257+end user license agreements (excluding distributors and resellers) which
258+have been validly granted by You or Your distributors under this License
259+prior to termination shall survive termination.
260+
261+************************************************************************
262+* *
263+* 6. Disclaimer of Warranty *
264+* ------------------------- *
265+* *
266+* Covered Software is provided under this License on an "as is" *
267+* basis, without warranty of any kind, either expressed, implied, or *
268+* statutory, including, without limitation, warranties that the *
269+* Covered Software is free of defects, merchantable, fit for a *
270+* particular purpose or non-infringing. The entire risk as to the *
271+* quality and performance of the Covered Software is with You. *
272+* Should any Covered Software prove defective in any respect, You *
273+* (not any Contributor) assume the cost of any necessary servicing, *
274+* repair, or correction. This disclaimer of warranty constitutes an *
275+* essential part of this License. No use of any Covered Software is *
276+* authorized under this License except under this disclaimer. *
277+* *
278+************************************************************************
279+
280+************************************************************************
281+* *
282+* 7. Limitation of Liability *
283+* -------------------------- *
284+* *
285+* Under no circumstances and under no legal theory, whether tort *
286+* (including negligence), contract, or otherwise, shall any *
287+* Contributor, or anyone who distributes Covered Software as *
288+* permitted above, be liable to You for any direct, indirect, *
289+* special, incidental, or consequential damages of any character *
290+* including, without limitation, damages for lost profits, loss of *
291+* goodwill, work stoppage, computer failure or malfunction, or any *
292+* and all other commercial damages or losses, even if such party *
293+* shall have been informed of the possibility of such damages. This *
294+* limitation of liability shall not apply to liability for death or *
295+* personal injury resulting from such party's negligence to the *
296+* extent applicable law prohibits such limitation. Some *
297+* jurisdictions do not allow the exclusion or limitation of *
298+* incidental or consequential damages, so this exclusion and *
299+* limitation may not apply to You. *
300+* *
301+************************************************************************
302+
303+8. Litigation
304+-------------
305+
306+Any litigation relating to this License may be brought only in the
307+courts of a jurisdiction where the defendant maintains its principal
308+place of business and such litigation shall be governed by laws of that
309+jurisdiction, without reference to its conflict-of-law provisions.
310+Nothing in this Section shall prevent a party's ability to bring
311+cross-claims or counter-claims.
312+
313+9. Miscellaneous
314+----------------
315+
316+This License represents the complete agreement concerning the subject
317+matter hereof. If any provision of this License is held to be
318+unenforceable, such provision shall be reformed only to the extent
319+necessary to make it enforceable. Any law or regulation which provides
320+that the language of a contract shall be construed against the drafter
321+shall not be used to construe this License against a Contributor.
322+
323+10. Versions of the License
324+---------------------------
325+
326+10.1. New Versions
327+
328+Mozilla Foundation is the license steward. Except as provided in Section
329+10.3, no one other than the license steward has the right to modify or
330+publish new versions of this License. Each version will be given a
331+distinguishing version number.
332+
333+10.2. Effect of New Versions
334+
335+You may distribute the Covered Software under the terms of the version
336+of the License under which You originally received the Covered Software,
337+or under the terms of any subsequent version published by the license
338+steward.
339+
340+10.3. Modified Versions
341+
342+If you create software not governed by this License, and you want to
343+create a new license for such software, you may create and use a
344+modified version of this License if you rename the license and remove
345+any references to the name of the license steward (except to note that
346+such modified license differs from this License).
347+
348+10.4. Distributing Source Code Form that is Incompatible With Secondary
349+Licenses
350+
351+If You choose to distribute Source Code Form that is Incompatible With
352+Secondary Licenses under the terms of this version of the License, the
353+notice described in Exhibit B of this License must be attached.
354+
355+Exhibit A - Source Code Form License Notice
356+-------------------------------------------
357+
358+ This Source Code Form is subject to the terms of the Mozilla Public
359+ License, v. 2.0. If a copy of the MPL was not distributed with this
360+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
361+
362+If it is not possible or desirable to put the notice in a particular
363+file, then You may include the notice in a location (such as a LICENSE
364+file in a relevant directory) where a recipient would be likely to look
365+for such a notice.
366+
367+You may add additional accurate notices of copyright ownership.
gogol-script/Makefilenew file+1
@@ -0,0 +1 @@
1+include ../share/library.mk
gogol-script/README.mdnew file+28
@@ -0,0 +1,28 @@
1+# gogol-script
2+
3+* [Version](#version)
4+* [Description](#description)
5+* [Contribute](#contribute)
6+* [Licence](#licence)
7+
8+
9+## Version
10+
11+`0.0.1`
12+
13+
14+## Description
15+
16+A client library for the Google Apps Script Execution.
17+
18+
19+## Contribute
20+
21+For any problems, comments, or feedback please create an issue [here on GitHub](https://github.com/brendanhay/gogol/issues).
22+
23+> _Note:_ this library is an auto-generated Haskell package. Please see `gogol-gen` for more information.
24+
25+
26+## Licence
27+
28+`gogol-script` is released under the [Mozilla Public License Version 2.0](http://www.mozilla.org/MPL/).
gogol-script/Setup.hsnew file+2
@@ -0,0 +1,2 @@
1+import Distribution.Simple
2+main = defaultMain
gogol-script/gen/Network/Google/Resource/Script/Scripts/Run.hsnew file+196
@@ -0,0 +1,196 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DeriveDataTypeable #-}
3+{-# LANGUAGE DeriveGeneric #-}
4+{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE NoImplicitPrelude #-}
6+{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE RecordWildCards #-}
8+{-# LANGUAGE TypeFamilies #-}
9+{-# LANGUAGE TypeOperators #-}
10+
11+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
12+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
13+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
14+
15+-- |
16+-- Module : Network.Google.Resource.Script.Scripts.Run
17+-- Copyright : (c) 2015 Brendan Hay
18+-- License : Mozilla Public License, v. 2.0.
19+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
20+-- Stability : auto-generated
21+-- Portability : non-portable (GHC extensions)
22+--
23+-- Runs a function in an Apps Script project that has been deployed for use
24+-- with the Apps Script Execution API. This method requires authorization
25+-- with an OAuth 2.0 token that includes at least one of the scopes listed
26+-- in the [Authentication](#authentication) section; script projects that
27+-- do not require authorization cannot be executed through this API. To
28+-- find the correct scopes to include in the authentication token, open the
29+-- project in the script editor, then select **File > Project properties**
30+-- and click the **Scopes** tab.
31+--
32+-- /See:/ <https://developers.google.com/apps-script/execution/rest/v1/run Google Apps Script Execution API Reference> for @script.scripts.run@.
33+module Network.Google.Resource.Script.Scripts.Run
34+ (
35+ -- * REST Resource
36+ ScriptsRunResource
37+
38+ -- * Creating a Request
39+ , scriptsRun
40+ , ScriptsRun
41+
42+ -- * Request Lenses
43+ , srXgafv
44+ , srUploadProtocol
45+ , srPp
46+ , srAccessToken
47+ , srUploadType
48+ , srPayload
49+ , srBearerToken
50+ , srScriptId
51+ , srCallback
52+ ) where
53+
54+import Network.Google.Prelude
55+import Network.Google.Script.Types
56+
57+-- | A resource alias for @script.scripts.run@ method which the
58+-- 'ScriptsRun' request conforms to.
59+type ScriptsRunResource =
60+ "v1" :>
61+ "scripts" :>
62+ CaptureMode "scriptId" "run" Text :>
63+ QueryParam "$.xgafv" Text :>
64+ QueryParam "upload_protocol" Text :>
65+ QueryParam "pp" Bool :>
66+ QueryParam "access_token" Text :>
67+ QueryParam "uploadType" Text :>
68+ QueryParam "bearer_token" Text :>
69+ QueryParam "callback" Text :>
70+ QueryParam "alt" AltJSON :>
71+ ReqBody '[JSON] ExecutionRequest :>
72+ Post '[JSON] Operation
73+
74+-- | Runs a function in an Apps Script project that has been deployed for use
75+-- with the Apps Script Execution API. This method requires authorization
76+-- with an OAuth 2.0 token that includes at least one of the scopes listed
77+-- in the [Authentication](#authentication) section; script projects that
78+-- do not require authorization cannot be executed through this API. To
79+-- find the correct scopes to include in the authentication token, open the
80+-- project in the script editor, then select **File > Project properties**
81+-- and click the **Scopes** tab.
82+--
83+-- /See:/ 'scriptsRun' smart constructor.
84+data ScriptsRun = ScriptsRun
85+ { _srXgafv :: !(Maybe Text)
86+ , _srUploadProtocol :: !(Maybe Text)
87+ , _srPp :: !Bool
88+ , _srAccessToken :: !(Maybe Text)
89+ , _srUploadType :: !(Maybe Text)
90+ , _srPayload :: !ExecutionRequest
91+ , _srBearerToken :: !(Maybe Text)
92+ , _srScriptId :: !Text
93+ , _srCallback :: !(Maybe Text)
94+ } deriving (Eq,Show,Data,Typeable,Generic)
95+
96+-- | Creates a value of 'ScriptsRun' with the minimum fields required to make a request.
97+--
98+-- Use one of the following lenses to modify other fields as desired:
99+--
100+-- * 'srXgafv'
101+--
102+-- * 'srUploadProtocol'
103+--
104+-- * 'srPp'
105+--
106+-- * 'srAccessToken'
107+--
108+-- * 'srUploadType'
109+--
110+-- * 'srPayload'
111+--
112+-- * 'srBearerToken'
113+--
114+-- * 'srScriptId'
115+--
116+-- * 'srCallback'
117+scriptsRun
118+ :: ExecutionRequest -- ^ 'srPayload'
119+ -> Text -- ^ 'srScriptId'
120+ -> ScriptsRun
121+scriptsRun pSrPayload_ pSrScriptId_ =
122+ ScriptsRun
123+ { _srXgafv = Nothing
124+ , _srUploadProtocol = Nothing
125+ , _srPp = True
126+ , _srAccessToken = Nothing
127+ , _srUploadType = Nothing
128+ , _srPayload = pSrPayload_
129+ , _srBearerToken = Nothing
130+ , _srScriptId = pSrScriptId_
131+ , _srCallback = Nothing
132+ }
133+
134+-- | V1 error format.
135+srXgafv :: Lens' ScriptsRun (Maybe Text)
136+srXgafv = lens _srXgafv (\ s a -> s{_srXgafv = a})
137+
138+-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
139+srUploadProtocol :: Lens' ScriptsRun (Maybe Text)
140+srUploadProtocol
141+ = lens _srUploadProtocol
142+ (\ s a -> s{_srUploadProtocol = a})
143+
144+-- | Pretty-print response.
145+srPp :: Lens' ScriptsRun Bool
146+srPp = lens _srPp (\ s a -> s{_srPp = a})
147+
148+-- | OAuth access token.
149+srAccessToken :: Lens' ScriptsRun (Maybe Text)
150+srAccessToken
151+ = lens _srAccessToken
152+ (\ s a -> s{_srAccessToken = a})
153+
154+-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
155+srUploadType :: Lens' ScriptsRun (Maybe Text)
156+srUploadType
157+ = lens _srUploadType (\ s a -> s{_srUploadType = a})
158+
159+-- | Multipart request metadata.
160+srPayload :: Lens' ScriptsRun ExecutionRequest
161+srPayload
162+ = lens _srPayload (\ s a -> s{_srPayload = a})
163+
164+-- | OAuth bearer token.
165+srBearerToken :: Lens' ScriptsRun (Maybe Text)
166+srBearerToken
167+ = lens _srBearerToken
168+ (\ s a -> s{_srBearerToken = a})
169+
170+-- | The project key of the script to be executed. To find the project key,
171+-- open the project in the script editor, then select **File > Project
172+-- properties**.
173+srScriptId :: Lens' ScriptsRun Text
174+srScriptId
175+ = lens _srScriptId (\ s a -> s{_srScriptId = a})
176+
177+-- | JSONP
178+srCallback :: Lens' ScriptsRun (Maybe Text)
179+srCallback
180+ = lens _srCallback (\ s a -> s{_srCallback = a})
181+
182+instance GoogleRequest ScriptsRun where
183+ type Rs ScriptsRun = Operation
184+ requestClient ScriptsRun{..}
185+ = go _srScriptId _srXgafv _srUploadProtocol
186+ (Just _srPp)
187+ _srAccessToken
188+ _srUploadType
189+ _srBearerToken
190+ _srCallback
191+ (Just AltJSON)
192+ _srPayload
193+ scriptService
194+ where go
195+ = buildClient (Proxy :: Proxy ScriptsRunResource)
196+ mempty
gogol-script/gen/Network/Google/Script.hsnew file+113
@@ -0,0 +1,113 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE NoImplicitPrelude #-}
3+{-# LANGUAGE TypeOperators #-}
4+
5+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
6+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
7+
8+-- |
9+-- Module : Network.Google.Script
10+-- Copyright : (c) 2015 Brendan Hay
11+-- License : Mozilla Public License, v. 2.0.
12+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
13+-- Stability : auto-generated
14+-- Portability : non-portable (GHC extensions)
15+--
16+-- An API for executing Google Apps Script projects.
17+--
18+-- /See:/ <https://developers.google.com/apps-script/execution/rest/v1/run Google Apps Script Execution API Reference>
19+module Network.Google.Script
20+ (
21+ -- * Service Configuration
22+ scriptService
23+
24+ -- * OAuth Scopes
25+ , scriptAllScope
26+ , feedsScope
27+ , adminDirectoryUserScope
28+ , userinfoEmailScope
29+ , formsCurrentonlyScope
30+ , driveScope
31+ , adminDirectoryGroupScope
32+ , feedsScope
33+ , formsScope
34+ , groupsScope
35+
36+ -- * API Declaration
37+ , ScriptAPI
38+
39+ -- * Resources
40+
41+ -- ** script.scripts.run
42+ , module Network.Google.Resource.Script.Scripts.Run
43+
44+ -- * Types
45+
46+ -- ** Status
47+ , Status
48+ , status
49+ , sDetails
50+ , sCode
51+ , sMessage
52+
53+ -- ** Operation
54+ , Operation
55+ , operation
56+ , oDone
57+ , oError
58+ , oResponse
59+ , oName
60+ , oMetadata
61+
62+ -- ** ExecutionRequest
63+ , ExecutionRequest
64+ , executionRequest
65+ , erFunction
66+ , erSessionState
67+ , erDevMode
68+ , erParameters
69+
70+ -- ** StatusDetailsItem
71+ , StatusDetailsItem
72+ , statusDetailsItem
73+ , sdiAddtional
74+
75+ -- ** ScriptStackTraceElement
76+ , ScriptStackTraceElement
77+ , scriptStackTraceElement
78+ , ssteFunction
79+ , ssteLineNumber
80+
81+ -- ** ExecutionError
82+ , ExecutionError
83+ , executionError
84+ , eeScriptStackTraceElements
85+ , eeErrorType
86+ , eeErrorMessage
87+
88+ -- ** OperationMetadata
89+ , OperationMetadata
90+ , operationMetadata
91+ , omAddtional
92+
93+ -- ** OperationResponse
94+ , OperationResponse
95+ , operationResponse
96+ , orAddtional
97+
98+ -- ** ExecutionResponse
99+ , ExecutionResponse
100+ , executionResponse
101+ , erResult
102+ ) where
103+
104+import Network.Google.Prelude
105+import Network.Google.Resource.Script.Scripts.Run
106+import Network.Google.Script.Types
107+
108+{- $resources
109+TODO
110+-}
111+
112+-- | Represents the entirety of the methods and resources available for the Google Apps Script Execution API service.
113+type ScriptAPI = ScriptsRunResource
gogol-script/gen/Network/Google/Script/Types.hsnew file+139
@@ -0,0 +1,139 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE DeriveGeneric #-}
3+{-# LANGUAGE NoImplicitPrelude #-}
4+{-# LANGUAGE OverloadedStrings #-}
5+
6+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
7+
8+-- |
9+-- Module : Network.Google.Script.Types
10+-- Copyright : (c) 2015 Brendan Hay
11+-- License : Mozilla Public License, v. 2.0.
12+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
13+-- Stability : auto-generated
14+-- Portability : non-portable (GHC extensions)
15+--
16+module Network.Google.Script.Types
17+ (
18+ -- * Service Configuration
19+ scriptService
20+
21+ -- * OAuth Scopes
22+ , scriptAllScope
23+ , feedsScope
24+ , adminDirectoryUserScope
25+ , userinfoEmailScope
26+ , formsCurrentonlyScope
27+ , driveScope
28+ , adminDirectoryGroupScope
29+ , feedsScope
30+ , formsScope
31+ , groupsScope
32+
33+ -- * Status
34+ , Status
35+ , status
36+ , sDetails
37+ , sCode
38+ , sMessage
39+
40+ -- * Operation
41+ , Operation
42+ , operation
43+ , oDone
44+ , oError
45+ , oResponse
46+ , oName
47+ , oMetadata
48+
49+ -- * ExecutionRequest
50+ , ExecutionRequest
51+ , executionRequest
52+ , erFunction
53+ , erSessionState
54+ , erDevMode
55+ , erParameters
56+
57+ -- * StatusDetailsItem
58+ , StatusDetailsItem
59+ , statusDetailsItem
60+ , sdiAddtional
61+
62+ -- * ScriptStackTraceElement
63+ , ScriptStackTraceElement
64+ , scriptStackTraceElement
65+ , ssteFunction
66+ , ssteLineNumber
67+
68+ -- * ExecutionError
69+ , ExecutionError
70+ , executionError
71+ , eeScriptStackTraceElements
72+ , eeErrorType
73+ , eeErrorMessage
74+
75+ -- * OperationMetadata
76+ , OperationMetadata
77+ , operationMetadata
78+ , omAddtional
79+
80+ -- * OperationResponse
81+ , OperationResponse
82+ , operationResponse
83+ , orAddtional
84+
85+ -- * ExecutionResponse
86+ , ExecutionResponse
87+ , executionResponse
88+ , erResult
89+ ) where
90+
91+import Network.Google.Prelude
92+import Network.Google.Script.Types.Product
93+import Network.Google.Script.Types.Sum
94+
95+-- | Default request referring to version 'v1' of the Google Apps Script Execution API. This contains the host and root path used as a starting point for constructing service requests.
96+scriptService :: ServiceConfig
97+scriptService
98+ = defaultService (ServiceId "script:v1")
99+ "script.googleapis.com"
100+
101+-- | View and manage your mail
102+scriptAllScope :: OAuthScope
103+scriptAllScope = "https://mail.google.com/";
104+
105+-- | Manage your contacts
106+feedsScope :: OAuthScope
107+feedsScope = "https://www.google.com/m8/feeds";
108+
109+-- | View and manage the provisioning of users on your domain
110+adminDirectoryUserScope :: OAuthScope
111+adminDirectoryUserScope = "https://www.googleapis.com/auth/admin.directory.user";
112+
113+-- | View your email address
114+userinfoEmailScope :: OAuthScope
115+userinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email";
116+
117+-- | View and manage forms that this application has been installed in
118+formsCurrentonlyScope :: OAuthScope
119+formsCurrentonlyScope = "https://www.googleapis.com/auth/forms.currentonly";
120+
121+-- | View and manage the files in your Google Drive
122+driveScope :: OAuthScope
123+driveScope = "https://www.googleapis.com/auth/drive";
124+
125+-- | View and manage the provisioning of groups on your domain
126+adminDirectoryGroupScope :: OAuthScope
127+adminDirectoryGroupScope = "https://www.googleapis.com/auth/admin.directory.group";
128+
129+-- | Manage your calendars
130+feedsScope :: OAuthScope
131+feedsScope = "https://www.google.com/calendar/feeds";
132+
133+-- | View and manage your forms in Google Drive
134+formsScope :: OAuthScope
135+formsScope = "https://www.googleapis.com/auth/forms";
136+
137+-- | View and manage your Google Groups
138+groupsScope :: OAuthScope
139+groupsScope = "https://www.googleapis.com/auth/groups";
gogol-script/gen/Network/Google/Script/Types/Product.hsnew file+525
@@ -0,0 +1,525 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE DeriveGeneric #-}
3+{-# LANGUAGE NoImplicitPrelude #-}
4+{-# LANGUAGE OverloadedStrings #-}
5+{-# LANGUAGE RecordWildCards #-}
6+
7+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
8+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
9+
10+-- |
11+-- Module : Network.Google.Script.Types.Product
12+-- Copyright : (c) 2015 Brendan Hay
13+-- License : Mozilla Public License, v. 2.0.
14+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
15+-- Stability : auto-generated
16+-- Portability : non-portable (GHC extensions)
17+--
18+module Network.Google.Script.Types.Product where
19+
20+import Network.Google.Prelude
21+import Network.Google.Script.Types.Sum
22+
23+-- | If a \`run\` call succeeds but the script function (or Apps Script
24+-- itself) throws an exception, the response body\'s \`error\` field will
25+-- contain this \`Status\` object.
26+--
27+-- /See:/ 'status' smart constructor.
28+data Status = Status
29+ { _sDetails :: !(Maybe [StatusDetailsItem])
30+ , _sCode :: !(Maybe (Textual Int32))
31+ , _sMessage :: !(Maybe Text)
32+ } deriving (Eq,Show,Data,Typeable,Generic)
33+
34+-- | Creates a value of 'Status' with the minimum fields required to make a request.
35+--
36+-- Use one of the following lenses to modify other fields as desired:
37+--
38+-- * 'sDetails'
39+--
40+-- * 'sCode'
41+--
42+-- * 'sMessage'
43+status
44+ :: Status
45+status =
46+ Status
47+ { _sDetails = Nothing
48+ , _sCode = Nothing
49+ , _sMessage = Nothing
50+ }
51+
52+-- | An array that contains a single \`ExecutionError\` object that provides
53+-- information about the nature of the error.
54+sDetails :: Lens' Status [StatusDetailsItem]
55+sDetails
56+ = lens _sDetails (\ s a -> s{_sDetails = a}) .
57+ _Default
58+ . _Coerce
59+
60+-- | The status code, which should be an enum value of google.rpc.Code.
61+sCode :: Lens' Status (Maybe Int32)
62+sCode
63+ = lens _sCode (\ s a -> s{_sCode = a}) .
64+ mapping _Coerce
65+
66+-- | A developer-facing error message, which should be in English. Any
67+-- user-facing error message should be localized and sent in the
68+-- google.rpc.Status.details field, or localized by the client.
69+sMessage :: Lens' Status (Maybe Text)
70+sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
71+
72+instance FromJSON Status where
73+ parseJSON
74+ = withObject "Status"
75+ (\ o ->
76+ Status <$>
77+ (o .:? "details" .!= mempty) <*> (o .:? "code") <*>
78+ (o .:? "message"))
79+
80+instance ToJSON Status where
81+ toJSON Status{..}
82+ = object
83+ (catMaybes
84+ [("details" .=) <$> _sDetails,
85+ ("code" .=) <$> _sCode,
86+ ("message" .=) <$> _sMessage])
87+
88+-- | The response will not arrive until the function finishes executing. The
89+-- maximum runtime is listed in the guide to [limitations in Apps
90+-- Script](https:\/\/developers.google.com\/apps-script\/guides\/services\/quotas#current_limitations).
91+-- If the script function returns successfully, the \`response\` field will
92+-- contain an \`ExecutionResponse\` object with the function\'s return
93+-- value in the object\'s \`result\` field. If the script function (or Apps
94+-- Script itself) throws an exception, the \`error\` field will contain a
95+-- \`Status\` object. The \`Status\` object\'s \`details\` field will
96+-- contain an array with a single \`ExecutionError\` object that provides
97+-- information about the nature of the error. If the \`run\` call itself
98+-- fails (for example, because of a malformed request or an authorization
99+-- error), the method will return an HTTP response code in the 4XX range
100+-- with a different format for the response body. Client libraries will
101+-- automatically convert a 4XX response into an exception class.
102+--
103+-- /See:/ 'operation' smart constructor.
104+data Operation = Operation
105+ { _oDone :: !(Maybe Bool)
106+ , _oError :: !(Maybe Status)
107+ , _oResponse :: !(Maybe OperationResponse)
108+ , _oName :: !(Maybe Text)
109+ , _oMetadata :: !(Maybe OperationMetadata)
110+ } deriving (Eq,Show,Data,Typeable,Generic)
111+
112+-- | Creates a value of 'Operation' with the minimum fields required to make a request.
113+--
114+-- Use one of the following lenses to modify other fields as desired:
115+--
116+-- * 'oDone'
117+--
118+-- * 'oError'
119+--
120+-- * 'oResponse'
121+--
122+-- * 'oName'
123+--
124+-- * 'oMetadata'
125+operation
126+ :: Operation
127+operation =
128+ Operation
129+ { _oDone = Nothing
130+ , _oError = Nothing
131+ , _oResponse = Nothing
132+ , _oName = Nothing
133+ , _oMetadata = Nothing
134+ }
135+
136+-- | This field is not used.
137+oDone :: Lens' Operation (Maybe Bool)
138+oDone = lens _oDone (\ s a -> s{_oDone = a})
139+
140+-- | If a \`run\` call succeeds but the script function (or Apps Script
141+-- itself) throws an exception, this field will contain a \`Status\`
142+-- object. The \`Status\` object\'s \`details\` field will contain an array
143+-- with a single \`ExecutionError\` object that provides information about
144+-- the nature of the error.
145+oError :: Lens' Operation (Maybe Status)
146+oError = lens _oError (\ s a -> s{_oError = a})
147+
148+-- | If the script function returns successfully, this field will contain an
149+-- \`ExecutionResponse\` object with the function\'s return value as the
150+-- object\'s \`result\` field.
151+oResponse :: Lens' Operation (Maybe OperationResponse)
152+oResponse
153+ = lens _oResponse (\ s a -> s{_oResponse = a})
154+
155+-- | This field is not used.
156+oName :: Lens' Operation (Maybe Text)
157+oName = lens _oName (\ s a -> s{_oName = a})
158+
159+-- | This field is not used.
160+oMetadata :: Lens' Operation (Maybe OperationMetadata)
161+oMetadata
162+ = lens _oMetadata (\ s a -> s{_oMetadata = a})
163+
164+instance FromJSON Operation where
165+ parseJSON
166+ = withObject "Operation"
167+ (\ o ->
168+ Operation <$>
169+ (o .:? "done") <*> (o .:? "error") <*>
170+ (o .:? "response")
171+ <*> (o .:? "name")
172+ <*> (o .:? "metadata"))
173+
174+instance ToJSON Operation where
175+ toJSON Operation{..}
176+ = object
177+ (catMaybes
178+ [("done" .=) <$> _oDone, ("error" .=) <$> _oError,
179+ ("response" .=) <$> _oResponse,
180+ ("name" .=) <$> _oName,
181+ ("metadata" .=) <$> _oMetadata])
182+
183+-- | A request to run the function in a script. The script is identified by
184+-- the specified \`script_id\`. Executing a function on a script will
185+-- return results based on the implementation of the script.
186+--
187+-- /See:/ 'executionRequest' smart constructor.
188+data ExecutionRequest = ExecutionRequest
189+ { _erFunction :: !(Maybe Text)
190+ , _erSessionState :: !(Maybe Text)
191+ , _erDevMode :: !(Maybe Bool)
192+ , _erParameters :: !(Maybe [JSONValue])
193+ } deriving (Eq,Show,Data,Typeable,Generic)
194+
195+-- | Creates a value of 'ExecutionRequest' with the minimum fields required to make a request.
196+--
197+-- Use one of the following lenses to modify other fields as desired:
198+--
199+-- * 'erFunction'
200+--
201+-- * 'erSessionState'
202+--
203+-- * 'erDevMode'
204+--
205+-- * 'erParameters'
206+executionRequest
207+ :: ExecutionRequest
208+executionRequest =
209+ ExecutionRequest
210+ { _erFunction = Nothing
211+ , _erSessionState = Nothing
212+ , _erDevMode = Nothing
213+ , _erParameters = Nothing
214+ }
215+
216+-- | The name of the function to execute in the given script. The name does
217+-- not include parentheses or parameters.
218+erFunction :: Lens' ExecutionRequest (Maybe Text)
219+erFunction
220+ = lens _erFunction (\ s a -> s{_erFunction = a})
221+
222+-- | This field is not used.
223+erSessionState :: Lens' ExecutionRequest (Maybe Text)
224+erSessionState
225+ = lens _erSessionState
226+ (\ s a -> s{_erSessionState = a})
227+
228+-- | If \`true\` and the user is an owner of the script, the script runs at
229+-- the most recently saved version rather than the version deployed for use
230+-- with the Execution API. Optional; default is \`false\`.
231+erDevMode :: Lens' ExecutionRequest (Maybe Bool)
232+erDevMode
233+ = lens _erDevMode (\ s a -> s{_erDevMode = a})
234+
235+-- | The parameters to be passed to the function being executed. The type for
236+-- each parameter should match the expected type in Apps Script. Parameters
237+-- cannot be Apps Script-specific objects (such as a \`Document\` or
238+-- \`Calendar\`); they can only be primitive types such as a \`string\`,
239+-- \`number\`, \`array\`, \`object\`, or \`boolean\`. Optional.
240+erParameters :: Lens' ExecutionRequest [JSONValue]
241+erParameters
242+ = lens _erParameters (\ s a -> s{_erParameters = a})
243+ . _Default
244+ . _Coerce
245+
246+instance FromJSON ExecutionRequest where
247+ parseJSON
248+ = withObject "ExecutionRequest"
249+ (\ o ->
250+ ExecutionRequest <$>
251+ (o .:? "function") <*> (o .:? "sessionState") <*>
252+ (o .:? "devMode")
253+ <*> (o .:? "parameters" .!= mempty))
254+
255+instance ToJSON ExecutionRequest where
256+ toJSON ExecutionRequest{..}
257+ = object
258+ (catMaybes
259+ [("function" .=) <$> _erFunction,
260+ ("sessionState" .=) <$> _erSessionState,
261+ ("devMode" .=) <$> _erDevMode,
262+ ("parameters" .=) <$> _erParameters])
263+
264+--
265+-- /See:/ 'statusDetailsItem' smart constructor.
266+newtype StatusDetailsItem = StatusDetailsItem
267+ { _sdiAddtional :: HashMap Text JSONValue
268+ } deriving (Eq,Show,Data,Typeable,Generic)
269+
270+-- | Creates a value of 'StatusDetailsItem' with the minimum fields required to make a request.
271+--
272+-- Use one of the following lenses to modify other fields as desired:
273+--
274+-- * 'sdiAddtional'
275+statusDetailsItem
276+ :: HashMap Text JSONValue -- ^ 'sdiAddtional'
277+ -> StatusDetailsItem
278+statusDetailsItem pSdiAddtional_ =
279+ StatusDetailsItem
280+ { _sdiAddtional = _Coerce # pSdiAddtional_
281+ }
282+
283+-- | Properties of the object. Contains field \'ype with type URL.
284+sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue)
285+sdiAddtional
286+ = lens _sdiAddtional (\ s a -> s{_sdiAddtional = a})
287+ . _Coerce
288+
289+instance FromJSON StatusDetailsItem where
290+ parseJSON
291+ = withObject "StatusDetailsItem"
292+ (\ o -> StatusDetailsItem <$> (parseJSONObject o))
293+
294+instance ToJSON StatusDetailsItem where
295+ toJSON = toJSON . _sdiAddtional
296+
297+-- | A stack trace through the script that shows where the execution failed.
298+--
299+-- /See:/ 'scriptStackTraceElement' smart constructor.
300+data ScriptStackTraceElement = ScriptStackTraceElement
301+ { _ssteFunction :: !(Maybe Text)
302+ , _ssteLineNumber :: !(Maybe (Textual Int32))
303+ } deriving (Eq,Show,Data,Typeable,Generic)
304+
305+-- | Creates a value of 'ScriptStackTraceElement' with the minimum fields required to make a request.
306+--
307+-- Use one of the following lenses to modify other fields as desired:
308+--
309+-- * 'ssteFunction'
310+--
311+-- * 'ssteLineNumber'
312+scriptStackTraceElement
313+ :: ScriptStackTraceElement
314+scriptStackTraceElement =
315+ ScriptStackTraceElement
316+ { _ssteFunction = Nothing
317+ , _ssteLineNumber = Nothing
318+ }
319+
320+-- | The name of the function that failed.
321+ssteFunction :: Lens' ScriptStackTraceElement (Maybe Text)
322+ssteFunction
323+ = lens _ssteFunction (\ s a -> s{_ssteFunction = a})
324+
325+-- | The line number where the script failed.
326+ssteLineNumber :: Lens' ScriptStackTraceElement (Maybe Int32)
327+ssteLineNumber
328+ = lens _ssteLineNumber
329+ (\ s a -> s{_ssteLineNumber = a})
330+ . mapping _Coerce
331+
332+instance FromJSON ScriptStackTraceElement where
333+ parseJSON
334+ = withObject "ScriptStackTraceElement"
335+ (\ o ->
336+ ScriptStackTraceElement <$>
337+ (o .:? "function") <*> (o .:? "lineNumber"))
338+
339+instance ToJSON ScriptStackTraceElement where
340+ toJSON ScriptStackTraceElement{..}
341+ = object
342+ (catMaybes
343+ [("function" .=) <$> _ssteFunction,
344+ ("lineNumber" .=) <$> _ssteLineNumber])
345+
346+-- | An object that provides information about the nature of an error in the
347+-- Apps Script Execution API. If an \`run\` call succeeds but the script
348+-- function (or Apps Script itself) throws an exception, the response
349+-- body\'s \`error\` field will contain a \`Status\` object. The \`Status\`
350+-- object\'s \`details\` field will contain an array with a single one of
351+-- these \`ExecutionError\` objects.
352+--
353+-- /See:/ 'executionError' smart constructor.
354+data ExecutionError = ExecutionError
355+ { _eeScriptStackTraceElements :: !(Maybe [ScriptStackTraceElement])
356+ , _eeErrorType :: !(Maybe Text)
357+ , _eeErrorMessage :: !(Maybe Text)
358+ } deriving (Eq,Show,Data,Typeable,Generic)
359+
360+-- | Creates a value of 'ExecutionError' with the minimum fields required to make a request.
361+--
362+-- Use one of the following lenses to modify other fields as desired:
363+--
364+-- * 'eeScriptStackTraceElements'
365+--
366+-- * 'eeErrorType'
367+--
368+-- * 'eeErrorMessage'
369+executionError
370+ :: ExecutionError
371+executionError =
372+ ExecutionError
373+ { _eeScriptStackTraceElements = Nothing
374+ , _eeErrorType = Nothing
375+ , _eeErrorMessage = Nothing
376+ }
377+
378+-- | An array of objects that provide a stack trace through the script to
379+-- show where the execution failed, with the deepest call first.
380+eeScriptStackTraceElements :: Lens' ExecutionError [ScriptStackTraceElement]
381+eeScriptStackTraceElements
382+ = lens _eeScriptStackTraceElements
383+ (\ s a -> s{_eeScriptStackTraceElements = a})
384+ . _Default
385+ . _Coerce
386+
387+-- | The error type, for example \`TypeError\` or \`ReferenceError\`. If the
388+-- error type is unavailable, this field is not included.
389+eeErrorType :: Lens' ExecutionError (Maybe Text)
390+eeErrorType
391+ = lens _eeErrorType (\ s a -> s{_eeErrorType = a})
392+
393+-- | The error message thrown by Apps Script, usually localized into the
394+-- user\'s language.
395+eeErrorMessage :: Lens' ExecutionError (Maybe Text)
396+eeErrorMessage
397+ = lens _eeErrorMessage
398+ (\ s a -> s{_eeErrorMessage = a})
399+
400+instance FromJSON ExecutionError where
401+ parseJSON
402+ = withObject "ExecutionError"
403+ (\ o ->
404+ ExecutionError <$>
405+ (o .:? "scriptStackTraceElements" .!= mempty) <*>
406+ (o .:? "errorType")
407+ <*> (o .:? "errorMessage"))
408+
409+instance ToJSON ExecutionError where
410+ toJSON ExecutionError{..}
411+ = object
412+ (catMaybes
413+ [("scriptStackTraceElements" .=) <$>
414+ _eeScriptStackTraceElements,
415+ ("errorType" .=) <$> _eeErrorType,
416+ ("errorMessage" .=) <$> _eeErrorMessage])
417+
418+-- | This field is not used.
419+--
420+-- /See:/ 'operationMetadata' smart constructor.
421+newtype OperationMetadata = OperationMetadata
422+ { _omAddtional :: HashMap Text JSONValue
423+ } deriving (Eq,Show,Data,Typeable,Generic)
424+
425+-- | Creates a value of 'OperationMetadata' with the minimum fields required to make a request.
426+--
427+-- Use one of the following lenses to modify other fields as desired:
428+--
429+-- * 'omAddtional'
430+operationMetadata
431+ :: HashMap Text JSONValue -- ^ 'omAddtional'
432+ -> OperationMetadata
433+operationMetadata pOmAddtional_ =
434+ OperationMetadata
435+ { _omAddtional = _Coerce # pOmAddtional_
436+ }
437+
438+-- | Properties of the object. Contains field \'ype with type URL.
439+omAddtional :: Lens' OperationMetadata (HashMap Text JSONValue)
440+omAddtional
441+ = lens _omAddtional (\ s a -> s{_omAddtional = a}) .
442+ _Coerce
443+
444+instance FromJSON OperationMetadata where
445+ parseJSON
446+ = withObject "OperationMetadata"
447+ (\ o -> OperationMetadata <$> (parseJSONObject o))
448+
449+instance ToJSON OperationMetadata where
450+ toJSON = toJSON . _omAddtional
451+
452+-- | If the script function returns successfully, this field will contain an
453+-- \`ExecutionResponse\` object with the function\'s return value as the
454+-- object\'s \`result\` field.
455+--
456+-- /See:/ 'operationResponse' smart constructor.
457+newtype OperationResponse = OperationResponse
458+ { _orAddtional :: HashMap Text JSONValue
459+ } deriving (Eq,Show,Data,Typeable,Generic)
460+
461+-- | Creates a value of 'OperationResponse' with the minimum fields required to make a request.
462+--
463+-- Use one of the following lenses to modify other fields as desired:
464+--
465+-- * 'orAddtional'
466+operationResponse
467+ :: HashMap Text JSONValue -- ^ 'orAddtional'
468+ -> OperationResponse
469+operationResponse pOrAddtional_ =
470+ OperationResponse
471+ { _orAddtional = _Coerce # pOrAddtional_
472+ }
473+
474+-- | Properties of the object. Contains field \'ype with type URL.
475+orAddtional :: Lens' OperationResponse (HashMap Text JSONValue)
476+orAddtional
477+ = lens _orAddtional (\ s a -> s{_orAddtional = a}) .
478+ _Coerce
479+
480+instance FromJSON OperationResponse where
481+ parseJSON
482+ = withObject "OperationResponse"
483+ (\ o -> OperationResponse <$> (parseJSONObject o))
484+
485+instance ToJSON OperationResponse where
486+ toJSON = toJSON . _orAddtional
487+
488+-- | An object that provides the return value of a function executed through
489+-- the Apps Script Execution API. If an \`run\` call succeeds and the
490+-- script function returns successfully, the response body\'s \`response\`
491+-- field will contain this \`ExecutionResponse\` object.
492+--
493+-- /See:/ 'executionResponse' smart constructor.
494+newtype ExecutionResponse = ExecutionResponse
495+ { _erResult :: Maybe JSONValue
496+ } deriving (Eq,Show,Data,Typeable,Generic)
497+
498+-- | Creates a value of 'ExecutionResponse' with the minimum fields required to make a request.
499+--
500+-- Use one of the following lenses to modify other fields as desired:
501+--
502+-- * 'erResult'
503+executionResponse
504+ :: ExecutionResponse
505+executionResponse =
506+ ExecutionResponse
507+ { _erResult = Nothing
508+ }
509+
510+-- | The return value of the script function. The type will match the type
511+-- returned in Apps Script. Functions called through the Execution API
512+-- cannot return Apps Script-specific objects (such as a \`Document\` or
513+-- \`Calendar\`); they can only return primitive types such as a
514+-- \`string\`, \`number\`, \`array\`, \`object\`, or \`boolean\`.
515+erResult :: Lens' ExecutionResponse (Maybe JSONValue)
516+erResult = lens _erResult (\ s a -> s{_erResult = a})
517+
518+instance FromJSON ExecutionResponse where
519+ parseJSON
520+ = withObject "ExecutionResponse"
521+ (\ o -> ExecutionResponse <$> (o .:? "result"))
522+
523+instance ToJSON ExecutionResponse where
524+ toJSON ExecutionResponse{..}
525+ = object (catMaybes [("result" .=) <$> _erResult])
gogol-script/gen/Network/Google/Script/Types/Sum.hsnew file+19
@@ -0,0 +1,19 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE DeriveGeneric #-}
3+{-# LANGUAGE LambdaCase #-}
4+{-# LANGUAGE NoImplicitPrelude #-}
5+{-# LANGUAGE OverloadedStrings #-}
6+
7+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
8+
9+-- |
10+-- Module : Network.Google.Script.Types.Sum
11+-- Copyright : (c) 2015 Brendan Hay
12+-- License : Mozilla Public License, v. 2.0.
13+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
14+-- Stability : auto-generated
15+-- Portability : non-portable (GHC extensions)
16+--
17+module Network.Google.Script.Types.Sum where
18+
19+import Network.Google.Prelude
gogol-script/gogol-script.cabalnew file+46
@@ -0,0 +1,46 @@
1+name: gogol-script
2+version: 0.0.1
3+synopsis: Google Apps Script Execution SDK.
4+homepage: https://github.com/brendanhay/gogol
5+bug-reports: https://github.com/brendanhay/gogol/issues
6+license: OtherLicense
7+license-file: LICENSE
8+author: Brendan Hay
9+maintainer: Brendan Hay <brendan.g.hay@gmail.com>
10+copyright: Copyright (c) 2015 Brendan Hay
11+category: Network, Google, Cloud
12+build-type: Simple
13+cabal-version: >= 1.10
14+extra-source-files: README.md
15+
16+description:
17+ An API for executing Google Apps Script projects.
18+ .
19+ /Warning:/ This is an experimental prototype/preview release which is still
20+ under exploratory development and not intended for public use, caveat emptor!
21+ .
22+ This library is compatible with version @v1@
23+ of the API.
24+
25+source-repository head
26+ type: git
27+ location: git://github.com/brendanhay/gogol.git
28+
29+library
30+ default-language: Haskell2010
31+ hs-source-dirs: src gen
32+
33+ ghc-options: -Wall
34+
35+ exposed-modules:
36+ Network.Google.Resource.Script.Scripts.Run
37+ , Network.Google.Script
38+ , Network.Google.Script.Types
39+
40+ other-modules:
41+ Network.Google.Script.Types.Product
42+ , Network.Google.Script.Types.Sum
43+
44+ build-depends:
45+ gogol-core == 0.0.1.*
46+ , base >= 4.7 && < 5
gogol-script/src/.gitkeepnew file

No changes to the content.