on ce42607 help sign in
113 lines 3.4 kB history raw
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 #-}
11{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
12{-# OPTIONS_GHC -fno-warn-unused-binds #-}
13{-# OPTIONS_GHC -fno-warn-unused-imports #-}
15-- |
16-- Module : Network.Google.Resource.TaskQueue.Tasks.Insert
17-- Copyright : (c) 2015-2016 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-- Insert a new task in a TaskQueue
24--
25-- /See:/ <https://developers.google.com/appengine/docs/python/taskqueue/rest TaskQueue API Reference> for @taskqueue.tasks.insert@.
26module Network.Google.Resource.TaskQueue.Tasks.Insert
27 (
28 -- * REST Resource
29 TasksInsertResource
31 -- * Creating a Request
32 , tasksInsert
33 , TasksInsert
35 -- * Request Lenses
36 , tiTaskQueue
37 , tiProject
38 , tiPayload
39 ) where
41import Network.Google.Prelude
42import Network.Google.TaskQueue.Types
44-- | A resource alias for @taskqueue.tasks.insert@ method which the
45-- 'TasksInsert' request conforms to.
46type TasksInsertResource =
47 "taskqueue" :>
48 "v1beta2" :>
49 "projects" :>
50 Capture "project" Text :>
51 "taskqueues" :>
52 Capture "taskqueue" Text :>
53 "tasks" :>
54 QueryParam "alt" AltJSON :>
55 ReqBody '[JSON] Task :> Post '[JSON] Task
57-- | Insert a new task in a TaskQueue
58--
59-- /See:/ 'tasksInsert' smart constructor.
60data TasksInsert = TasksInsert'
61 { _tiTaskQueue :: !Text
62 , _tiProject :: !Text
63 , _tiPayload :: !Task
64 } deriving (Eq,Show,Data,Typeable,Generic)
66-- | Creates a value of 'TasksInsert' with the minimum fields required to make a request.
67--
68-- Use one of the following lenses to modify other fields as desired:
69--
70-- * 'tiTaskQueue'
71--
72-- * 'tiProject'
73--
74-- * 'tiPayload'
75tasksInsert
76 :: Text -- ^ 'tiTaskQueue'
77 -> Text -- ^ 'tiProject'
78 -> Task -- ^ 'tiPayload'
79 -> TasksInsert
80tasksInsert pTiTaskQueue_ pTiProject_ pTiPayload_ =
81 TasksInsert'
82 { _tiTaskQueue = pTiTaskQueue_
83 , _tiProject = pTiProject_
84 , _tiPayload = pTiPayload_
85 }
87-- | The taskqueue to insert the task into
88tiTaskQueue :: Lens' TasksInsert Text
89tiTaskQueue
90 = lens _tiTaskQueue (\ s a -> s{_tiTaskQueue = a})
92-- | The project under which the queue lies
93tiProject :: Lens' TasksInsert Text
94tiProject
95 = lens _tiProject (\ s a -> s{_tiProject = a})
97-- | Multipart request metadata.
98tiPayload :: Lens' TasksInsert Task
99tiPayload
100 = lens _tiPayload (\ s a -> s{_tiPayload = a})
102instance GoogleRequest TasksInsert where
103 type Rs TasksInsert = Task
104 type Scopes TasksInsert =
105 '["https://www.googleapis.com/auth/taskqueue",
106 "https://www.googleapis.com/auth/taskqueue.consumer"]
107 requestClient TasksInsert'{..}
108 = go _tiProject _tiTaskQueue (Just AltJSON)
109 _tiPayload
110 taskQueueService
111 where go
112 = buildClient (Proxy :: Proxy TasksInsertResource)
113 mempty