12345678910111213141516171819202122232425262728293031323334353637383940414243(** Error detection in Slack API response. The web API communicates errors using
an [error] field rather than status codes. Note, on the other hand, that
webhooks do use status codes to communicate errors. *)moduleSlack_response_adapter:Atdgen_runtime.Json_adapter.S=structletnormalize(x:Yojson.Safe.t)=matchxwith|`Assocfields->beginmatchList.assoc"ok"fieldswith|`Booltrue->`List[`String"Ok";x]|`Boolfalse->beginmatchList.assoc"error"fieldswith|`Stringmsg->`List[`String"Error";`Stringmsg]|_->xend|_|(exceptionNot_found)->xend|_->xletrestore(x:Yojson.Safe.t)=letmk_fieldsokfields=("ok",`Boolok)::List.filter(fun(k,_)->k<>"ok")fieldsinmatchxwith|`List[`String"Ok";`Assocfields]->`Assoc(mk_fieldstruefields)|`List[`String"Error";`Stringmsg]->`Assoc(mk_fieldsfalse["error",`Stringmsg])|_->xendmoduleUnfurl_adapter:Atdgen_runtime.Json_adapter.S=structletnormalize(x:Yojson.Safe.t)=matchxwith|`Assocfields->beginmatchList.assoc"blocks"fieldswith|`Booltrue->`List[`String"Blocks";x]|`Boolfalse->`List[`String"Message_attachment";x]|_|(exceptionNot_found)->xend|_->xletrestore(x:Yojson.Safe.t)=matchxwith|`List[`String"Blocks";`Assocfields]->`Assocfields|`List[`String"Message_attachment";`Assocfields]->`Assocfields|_->xend