package ez_api
Easy API library and tools
Install
Dune Dependency
github.com
Readme
LGPL-2.1-only WITH OCaml-LGPL-linking-exception License
Edit opam file
Versions (6)
Authors
Maintainers
Sources
v1.0.0.tar.gz
md5=d4dcb8a0be9cf87fca6471cecf083d9a
sha512=452a5de00bf0b51926d9c4c5c9062981c372ebce9ccfd0586b1e1b9b42c96721035dc7cd405e4bdd936ae0a7e69f442e4063713756b7cdac246319198fb89e2c
doc/src/ez_api.sendgrid_encoding/ezSendgrid_encoding.ml.html
Source file ezSendgrid_encoding.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
open EzSendgrid_types open Json_encoding let opt_encoding encoding = let unit_opt_encoding = case unit (function None -> Some () | Some _ -> None) (fun _ -> None) in match encoding with | None -> union [ unit_opt_encoding ] | Some encoding -> union [ case encoding (fun x -> x) (fun x -> Some x); unit_opt_encoding ] let email_address = conv (fun {email; name} -> (email, name)) (fun (email, name) -> {email; name}) @@ obj2 (req "email" string) (opt "name" string) let content_element = conv (fun {content_type; content_value} -> (content_type, content_value)) (fun (content_type, content_value) -> {content_type; content_value}) @@ obj2 (req "type" string) (req "value" string) let person = conv (fun {dst; cc; bcc; psubject; data} -> (dst, cc, bcc, psubject, data)) (fun (dst, cc, bcc, psubject, data) -> {dst; cc; bcc; psubject; data}) @@ obj5 (req "to" (list email_address)) (opt "cc" (list email_address)) (opt "bcc" (list email_address)) (opt "subject" string) (opt "dynamic_template_data" any_value) let mail more_encoding = conv (fun {person; from; subject; content; template_id; more_fields} -> (person, from, subject, content, template_id), more_fields) (fun ((person, from, subject, content, template_id), more_fields) -> {person; from; subject; content; template_id; more_fields}) @@ merge_objs (obj5 (req "personalizations" (list person)) (req "from" email_address) (opt "subject" string) (opt "content" (list content_element)) (opt "template_id" string)) (opt_encoding more_encoding) let contact = conv (fun {addr_line1; addr_line2; alternate_emails; city; country; c_email; first_name; last_name; postal_code; state_province_region; custom_field } -> (c_email, addr_line1, addr_line2, alternate_emails, city, country, first_name, last_name, postal_code, state_province_region, custom_field)) (fun (c_email, addr_line1, addr_line2, alternate_emails, city, country, first_name, last_name, postal_code, state_province_region, custom_field) -> {addr_line1; addr_line2; alternate_emails; city; country; c_email; first_name; last_name; postal_code; state_province_region; custom_field }) @@ EzEncoding.obj11 (req "email" string) (opt "address_line_1" string) (opt "address_line_2" string) (opt "alternate_emails" (list string)) (opt "city" string) (opt "country" string) (opt "first_name" string) (opt "last_name" string) (opt "postal_code" string) (opt "state_province_region" string) (opt "custom_fields" Json_encoding.any_value) let contact_more = conv (fun {c_id; phone_number; whatsapp; line; facebook; unique_name; list_ids; segment_ids; created_at; updated_at} -> (c_id, phone_number, whatsapp, line, facebook, unique_name, list_ids, segment_ids, created_at, updated_at)) (fun (c_id, phone_number, whatsapp, line, facebook, unique_name, list_ids, segment_ids, created_at, updated_at) -> {c_id; phone_number; whatsapp; line; facebook; unique_name; list_ids; segment_ids; created_at; updated_at}) @@ obj10 (req "id" string) (opt "phone_number" string) (opt "whatsapp" string) (opt "line" string) (opt "facebook" string) (opt "unique_nname" string) (req "list_ids" (list string)) (dft "segment_ids" (option @@ list string) None) (req "created_at" string) (req "updated_at" string) let add_contacts_enc = obj2 (opt "list_ids" (list string)) (req "contacts" (list contact)) let job_output = obj1 (req "job_id" string) let contacts_count = EzEncoding.ignore_enc (obj1 (req "contact_count" int)) let get_contact = EzEncoding.ignore_enc (merge_objs contact contact_more) let search_output encoding = EzEncoding.ignore_enc @@ obj2 (req "contact_count" int) (dft "result" (list encoding) []) let query = obj1 (req "query" string)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>