protected override string GetQuery(CodeActivityContext context)
        {
            var pipe = PipeID.Get(context);

            string cardFieldsString = GetCardFieldsQuery(context);
            string customFields     = GetCardCustomFieldsQuery(context);

            return(string.Format(CreateCardQuery, pipe, cardFieldsString, customFields, CreateCardReturnQuery));
        }
Example #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());
        }
        protected override string GetQuery(CodeActivityContext context)
        {
            var pipeId = PipeID.Get(context);

            return(string.Format(GetPipeQuery, pipeId));
        }