{"id":20988495,"url":"https://github.com/engagesoftware/elm-dnn-http","last_synced_at":"2025-07-18T10:34:35.160Z","repository":{"id":52413370,"uuid":"117151871","full_name":"EngageSoftware/elm-dnn-http","owner":"EngageSoftware","description":"Helpers for working with DNN Web API","archived":false,"fork":false,"pushed_at":"2024-09-11T13:06:16.000Z","size":95,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-09-11T20:16:43.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/EngageSoftware/elm-dnn-http/latest","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EngageSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-11T20:49:25.000Z","updated_at":"2024-09-11T13:09:31.000Z","dependencies_parsed_at":"2024-07-29T16:13:29.080Z","dependency_job_id":null,"html_url":"https://github.com/EngageSoftware/elm-dnn-http","commit_stats":{"total_commits":69,"total_committers":5,"mean_commits":13.8,"dds":"0.42028985507246375","last_synced_commit":"68207b4a75367fc11d177f00e38a1cd1138e67ce"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngageSoftware%2Felm-dnn-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngageSoftware%2Felm-dnn-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngageSoftware%2Felm-dnn-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngageSoftware%2Felm-dnn-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngageSoftware","download_url":"https://codeload.github.com/EngageSoftware/elm-dnn-http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225304473,"owners_count":17453164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T06:21:28.985Z","updated_at":"2024-11-19T06:21:30.149Z","avatar_url":"https://github.com/EngageSoftware.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-dnn-http\n\nHelpers for working with Engage's DNN Web API.\n\nProvides a decoder to extract necessary API details from your flags:\n\n```elm\nflagsDecoder : Json.Decode.Decoder { httpConfig : Engage.Http.Config, localization : Engage.Localization.Localization }\nflagsDecoder =\n    Json.Decode.map2\n        (\\httpConfig localization -\u003e { httpConfig = httpConfig, localization = localization })\n        (Json.Decode.field \"httpConfig\" Engage.Http.configDecoder)\n        (Json.Decode.field \"localization\" Engage.Localization.decoder)\n\ninit : Json.Encode.Value -\u003e ( Model, Cmd Msg )\ninit flagsJson =\n    case Json.Decode.decodeValue flagsDecoder flagsJson of\n        Ok { httpConfig, localization } -\u003e\n            ( { model | httpConfig = httpConfig, localization = localization }, Cmd.none )\n\n        Err error -\u003e\n            ( { model | errorMessage = Just (Json.Decode.errorToString error) }, Cmd.none )\n```\n\nUsed within DNN, your initializing code may look like this:\n\n```asp\n\u003c%@ Register TagPrefix=\"dnn\" Namespace=\"DotNetNuke.Web.Client.ClientResourceManagement\" Assembly=\"DotNetNuke.Web.Client\" %\u003e\n\u003c%@ Import Namespace=\"Engage.Dnn.Framework\" %\u003e\n\u003c%@ Import Namespace=\"Engage.Util\" %\u003e\n\n\u003cdnn:DnnJsInclude runat=\"server\" FilePath=\"DesktopModules/MyClient/elm.min.js\" /\u003e\n\n\u003casp:Panel runat=\"server\" ID=\"ApplicationPanel\" /\u003e\n\n\u003cscript\u003e\njQuery(function ($) {\n    var sf = $.ServicesFramework(\u003c%:this.ModuleId%\u003e);\n    Elm.MyClient.ViewMyProject.Main.init({\n        node: document.getElementById(\u003c%: ApplicationPanel.ClientID.AsQuotedJavaScriptString() %\u003e),\n        flags: {\n            httpConfig: {\n                baseUrl: sf.getServiceRoot('MyClient') + 'MyProject',\n                headers: {\n                    TabId: \u003c%:ModuleContext.TabId.ToString(CultureInfo.InvariantCulture).AsQuotedJavaScriptString()%\u003e,\n                    ModuleId: \u003c%:ModuleContext.ModuleId.ToString(CultureInfo.InvariantCulture).AsQuotedJavaScriptString()%\u003e,\n                    RequestVerificationToken: sf.getAntiForgeryValue()\n                }\n            },\n            localization: \u003c%: LocalizationJson %\u003e\n        }\n    });\n});\n\u003c/script\u003e\n\n\u003cscript runat=\"server\"\u003e\n/// \u003csummary\u003eGets a JSON array with localized text for this control's resource file.\u003c/summary\u003e\n/// \u003cvalue\u003eAn HTML string with a JSON array of objects with \u003cc\u003ekey\u003c/c\u003e and \u003cc\u003evalue\u003c/c\u003e properties.\u003c/value\u003e\nprivate IHtmlString LocalizationJson =\u003e LocalizationUtility.GetResources(this.LocalResourceFile)\n                                                                .Where(keyValue =\u003e !string.IsNullOrEmpty(keyValue.Value))\n                                                                .Select(keyValue =\u003e new { key = keyValue.Key, value = keyValue.Value })\n                                                                .ToJson()\n                                                                .AsRawHtml();\n\u003c/script\u003e\n```\n\nProvides opinionated methods for calling HTTP endpoints:\n\n```elm\nupdateProfile : Engage.Http.Config -\u003e Json.Encode.Value -\u003e Cmd Msg\nupdateProfile httpConfig body =\n    Engage.Http.post\n        httpConfig\n        ProfileUpdated\n        (decodeUpdateResponse)\n        { methodName = \"Profile\", value = body }\n```\n\nProvides opinionated method for retrieving error messages from a response:\n\n```elm\nupdate : Msg -\u003e Model -\u003e ( Model, Cmd Msg )\nupdate msg model =\n    case msg of\n        ProfileUpdated response -\u003e\n            case response of\n                NotAsked -\u003e\n                    ( { model | currentRequest = response }, Cmd.none )\n                Loading -\u003e\n                    ( { model | currentRequest = response }, Cmd.none )\n                Failure error -\u003e\n                    ( { model | currentRequest = response, errorMessage = Just (Engage.Http.getErrorMessage model error) }, Cmd.none )\n                Success result -\u003e\n                    ( { model | currentRequest = response }, Cmd.none )\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengagesoftware%2Felm-dnn-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengagesoftware%2Felm-dnn-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengagesoftware%2Felm-dnn-http/lists"}