예제 #1
0
        // update an existing Field
        public LapostaField Update(string fieldId, LapostaField field)
        {
            // only add changed fields
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("list_id", this.listId);
            if (field.Name != null)
            {
                data.Add("name", field.Name);
            }
            if (field.Datatype != null)
            {
                data.Add("datatype", field.Datatype);
            }
            if (field.Required != null)
            {
                data.Add("required", LapostaUtil.convertBool(field.Required));
            }
            if (field.InForm != null)
            {
                data.Add("in_form", LapostaUtil.convertBool(field.InForm));
            }
            if (field.InList != null)
            {
                data.Add("in_list", LapostaUtil.convertBool(field.InList));
            }

            List <string> path = new List <string>();

            path.Add(fieldId);
            var response = base.Connect("POST", path, this.parameters, data);

            return(Mapper <LapostaField> .MapFromJson(response, "field"));
        }
예제 #2
0
        // update an existing Webhook
        public LapostaWebhook Update(string webhookId, LapostaWebhook webhook)
        {
            // only add changed webhooks
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("list_id", this.listId);
            if (webhook.Event != null)
            {
                data.Add("event", webhook.Event);
            }
            if (webhook.Url != null)
            {
                data.Add("url", webhook.Url);
            }
            if (webhook.Blocked != null)
            {
                data.Add("blocked", LapostaUtil.convertBool(webhook.Blocked));
            }

            List <string> path = new List <string>();

            path.Add(webhookId);
            var response = base.Connect("POST", path, this.parameters, data);

            return(Mapper <LapostaWebhook> .MapFromJson(response, "webhook"));
        }
예제 #3
0
        // create a new Webhook
        public LapostaWebhook Create(LapostaWebhook webhook)
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("list_id", this.listId);
            data.Add("event", webhook.Event);
            data.Add("url", webhook.Url);
            data.Add("blocked", LapostaUtil.convertBool(webhook.Blocked));
            var response = base.Connect("POST", null, this.parameters, data);

            return(Mapper <LapostaWebhook> .MapFromJson(response, "webhook"));
        }
예제 #4
0
        // create a new Field
        public LapostaField Create(LapostaField field)
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("list_id", this.listId);
            data.Add("name", field.Name);
            data.Add("datatype", field.Datatype);
            data.Add("required", LapostaUtil.convertBool(field.Required));
            data.Add("in_form", LapostaUtil.convertBool(field.InForm));
            data.Add("in_list", LapostaUtil.convertBool(field.InList));
            var response = base.Connect("POST", null, this.parameters, data);

            return(Mapper <LapostaField> .MapFromJson(response, "field"));
        }
        // create a new Field
        public LapostaField Create(LapostaField field)
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("list_id", this.listId);
            data.Add("name", field.Name);
            data.Add("datatype", field.Datatype);
            if (field.Options != null)
            {
                int i = 0;
                foreach (var item in field.Options)
                {
                    data.Add("options[" + i++ + "]", item);
                }
            }
            data.Add("defaultvalue", field.DefaultValue);
            data.Add("required", LapostaUtil.convertBool(field.Required));
            data.Add("in_form", LapostaUtil.convertBool(field.InForm));
            data.Add("in_list", LapostaUtil.convertBool(field.InList));
            var response = base.Connect("POST", null, this.parameters, data);

            return(Mapper <LapostaField> .MapFromJson(response, "field"));
        }