protected override void SafeExecute(CodeActivityContext context)
        {
            // Create URL

            string bearer    = Bearer.Get(context);
            var    queryText = GetQuery(context);
            var    query     = new PipefyQuery(queryText, bearer);

            int timeout = Timeout.Get(context);

            query.SetTimeout(timeout);

            string result = query.Execute();

            CheckStatusCode(query.StatusCode);

            JObject json = PipefyQuery.ParseJson(result);

            ParseResult(context, json["data"] as JObject);

            // Upload File

            UploadFile(fileInfo);
            var resultUrl = new Uri(amazonUrl);

            FileUrl.Set(context, resultUrl.LocalPath.TrimStart('\\', '/'));
        }
Ejemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            System.Net.WebRequest req = System.Net.WebRequest.Create("https://app.pipefy.com/queries");
            req.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
            req.Timeout           = 120000;
            req.Headers.Add("authorization", "Bearer " + Bearer.Get(context));
            req.ContentType = "application/json";
            req.Method      = "POST";
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes("{ \"query\": \"{ pipe(id: " + PipeID.Get(context) + ") { id name start_form_fields { label id } labels { name id } phases { name fields { label id } cards(first: 5) { edges { node { id, title } } } } } }\" }");
            req.ContentLength = bytes.Length;
            System.IO.Stream os = req.GetRequestStream();
            os.Write(bytes, 0, bytes.Length);
            os.Close();
            System.Net.WebResponse resp = req.GetResponse();
            System.IO.StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
            JArray  array      = new JArray();
            JObject joResponse = JObject.Parse(sr.ReadToEnd());

            Return.Set(context, joResponse.ToString());
        }
Ejemplo n.º 3
0
        protected override void Execute(CodeActivityContext context)
        {
            System.Net.WebRequest req = System.Net.WebRequest.Create("https://app.pipefy.com/queries");
            req.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
            req.Timeout           = 120000;
            req.Headers.Add("authorization", "Bearer " + Bearer.Get(context));
            req.ContentType = "application/json";
            req.Method      = "POST";
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes("{ \"query\": \"mutation { deletePhase(input: { id: " + PhaseID.Get(context) + " }) { success } }\" }");
            req.ContentLength = bytes.Length;
            System.IO.Stream os = req.GetRequestStream();
            os.Write(bytes, 0, bytes.Length);
            os.Close();
            System.Net.WebResponse resp = req.GetResponse();
            System.IO.StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
            JArray  array      = new JArray();
            JObject joResponse = JObject.Parse(sr.ReadToEnd());

            Return.Set(context, joResponse.ToString());
        }
Ejemplo n.º 4
0
        protected override void Execute(CodeActivityContext context)
        {
            System.Net.WebRequest req = System.Net.WebRequest.Create("https://app.pipefy.com/queries");
            req.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
            req.Timeout           = 120000;
            req.Headers.Add("authorization", "Bearer " + Bearer.Get(context));
            req.ContentType = "application/json";
            req.Method      = "POST";
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes("{ \"query\": \"{ card(id: " + CardID.Get(context) + ") { title assignees { id } comments { id } comments_count current_phase { name } done due_date fields { name value } labels { name } phases_history { phase { name } firstTimeIn lastTimeOut } url } }\" }");
            req.ContentLength = bytes.Length;
            System.IO.Stream os = req.GetRequestStream();
            os.Write(bytes, 0, bytes.Length);
            os.Close();
            System.Net.WebResponse resp = req.GetResponse();
            System.IO.StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
            JArray  array      = new JArray();
            JObject joResponse = JObject.Parse(sr.ReadToEnd());

            Return.Set(context, joResponse.ToString());
        }
Ejemplo n.º 5
0
        protected override void Execute(CodeActivityContext context)
        {
            System.Net.WebRequest req = System.Net.WebRequest.Create("https://app.pipefy.com/queries");
            req.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
            req.Timeout           = 120000;
            req.Headers.Add("authorization", "Bearer " + Bearer.Get(context));
            req.ContentType = "application/json";
            req.Method      = "POST";
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes("{ \"query\": \"{ table_record(id: " + TableRecordID.Get(context) + ") { assignees { id name } created_at created_by { id name } due_date finished_at id labels { id name } parent_relations { name source_type } record_fields { array_value date_value datetime_value filled_at float_value name required updated_at value } summary { title value } table { id } title updated_at url } }\" }");
            req.ContentLength = bytes.Length;
            System.IO.Stream os = req.GetRequestStream();
            os.Write(bytes, 0, bytes.Length);
            os.Close();
            System.Net.WebResponse resp = req.GetResponse();
            System.IO.StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
            JArray  array      = new JArray();
            JObject joResponse = JObject.Parse(sr.ReadToEnd());

            Return.Set(context, joResponse.ToString());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Only the main part of the execution. Will be run inside of a try / catch statement
        /// </summary>
        protected virtual void SafeExecute(CodeActivityContext context)
        {
            string bearer    = Bearer.Get(context);
            var    queryText = GetQuery(context);
            var    query     = new PipefyQuery(queryText, bearer);

            int timeout = Timeout.Get(context);

            if (timeout > 100)
            {
                query.SetTimeout(timeout);
            }

            string result = query.Execute();

            CheckStatusCode(query.StatusCode);

            JObject json = PipefyQuery.ParseJson(result);

            ParseResult(context, json["data"] as JObject);
        }