protected override string GetQuery(CodeActivityContext context)
        {
            long card  = CardID.Get(context);
            long phase = PhaseID.Get(context);

            return(string.Format(MoveCardToPhaseQuery, card, phase));
        }
Example #2
0
        protected override string GetQuery(CodeActivityContext context)
        {
            var card      = CardID.Get(context);
            var assignees = AssigneeIDs.Get(context);
            var dueDate   = DueDate.Get(context);
            var labels    = LabelIDs.Get(context);
            var title     = Title.Get(context);

            var cardFields = new List <string>();

            if (assignees?.Length > 0)
            {
                cardFields.Add(string.Format("assignee_ids: {0}", assignees.ToQueryValue()));
            }

            if (dueDate != null && dueDate != DateTime.MinValue)
            {
                cardFields.Add(string.Format("due_date: {0}", dueDate.ToQueryValue()));
            }

            if (labels?.Length > 0)
            {
                cardFields.Add(string.Format("label_ids: {0}", labels.ToQueryValue()));
            }

            if (!string.IsNullOrWhiteSpace(title))
            {
                cardFields.Add(string.Format("title: {0}", title.ToQueryValue()));
            }

            var paramsStr = string.Join(" ", cardFields);

            return(string.Format(UpdateCardQuery, card, paramsStr));
        }
Example #3
0
        protected override string GetQuery(CodeActivityContext context)
        {
            long   id         = CardID.Get(context);
            string fieldId    = FieldID.Get(context);
            object fieldValue = Value.Get(context);

            return(string.Format(UpdateCardFieldQuery, id, fieldId, fieldValue.ToQueryValue()));
        }
Example #4
0
        protected override string GetQuery(CodeActivityContext context)
        {
            var cardId = CardID.Get(context);

            return(string.Format(GetCardQuery, cardId));
        }
Example #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\": \"mutation{ deleteCard(input: {id: " + CardID.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());
        }
Example #6
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());
        }