{"id":13407071,"url":"https://github.com/icerockdev/moko-network","last_synced_at":"2026-02-23T06:16:21.313Z","repository":{"id":36219343,"uuid":"210245296","full_name":"icerockdev/moko-network","owner":"icerockdev","description":"OpenAPI client code generation for mobile (android \u0026 ios) Kotlin Multiplatform development","archived":false,"fork":false,"pushed_at":"2026-02-03T09:48:32.000Z","size":693,"stargazers_count":153,"open_issues_count":31,"forks_count":30,"subscribers_count":8,"default_branch":"master","last_synced_at":"2026-02-03T19:33:55.436Z","etag":null,"topics":["android","coroutines","gradle-plugin","ios","kotlin-multiplatform","kotlin-multiplatform-mobile","kotlin-native","ktor-client","moko","openapi","serialization"],"latest_commit_sha":null,"homepage":"https://moko.icerock.dev","language":"Kotlin","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/icerockdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2019-09-23T02:06:54.000Z","updated_at":"2026-02-03T09:09:43.000Z","dependencies_parsed_at":"2024-01-18T11:13:53.039Z","dependency_job_id":"f6f28a3c-4feb-4437-9e83-72bf9ac12497","html_url":"https://github.com/icerockdev/moko-network","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/icerockdev/moko-network","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-network","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-network/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-network/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-network/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icerockdev","download_url":"https://codeload.github.com/icerockdev/moko-network/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-network/sbom","scorecard":{"id":480081,"data":{"date":"2025-08-11","repo":{"name":"github.com/icerockdev/moko-network","commit":"c9c5c9c2488aa98c18b04d36af510107556cd6bb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/compilation-check.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":4,"reason":"Found 4/10 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/compilation-check.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-network/compilation-check.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/compilation-check.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-network/compilation-check.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-network/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-network/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-network/publish.yml/master?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T16:23:02.925Z","repository_id":36219343,"created_at":"2025-08-19T16:23:02.925Z","updated_at":"2025-08-19T16:23:02.925Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29738825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T04:51:08.365Z","status":"ssl_error","status_checked_at":"2026-02-23T04:49:15.865Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["android","coroutines","gradle-plugin","ios","kotlin-multiplatform","kotlin-multiplatform-mobile","kotlin-native","ktor-client","moko","openapi","serialization"],"created_at":"2024-07-30T20:00:19.155Z","updated_at":"2026-02-23T06:16:21.289Z","avatar_url":"https://github.com/icerockdev.png","language":"Kotlin","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"![moko-network](img/logo.png)  \n[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/network) ](https://repo1.maven.org/maven2/dev/icerock/moko/network) ![kotlin-version](https://kotlin-version.aws.icerock.dev/kotlin-version?group=dev.icerock.moko\u0026name=network)\n# Mobile Kotlin network components\nThis is a Kotlin MultiPlatform library that provide network components for iOS \u0026 Android. Library is\n addition to [ktor-client](https://github.com/ktorio/ktor) with gradle plugin to generate entities\n and api classes from OpenAPI (Swagger) specification file. Entities serialization done by\n [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization).\n\n## Table of Contents\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Samples](#samples)\n- [Set Up Locally](#set-up-locally)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n- **OpenAPI client code generation** - just configure plugin then use generated entities and api classes;\n- **TokenFeature** feature to ktor-client with auth token header support;\n- **ExceptionFeature** feature to ktor-client that parse errors from server to domain exceptions.\n- **RefreshTokenFeature** feature to ktor-client that handle Unauthorized response from server, try to update token and repeat failed request in case, when token update was successful;\n\n## Requirements\n- Gradle version 6.8+\n- Android API 16+\n- iOS version 11.0+\n\n## Installation\nroot build.gradle  \n```groovy\nbuildscript {\n    repositories {\n        gradlePluginPortal()\n    }\n\n    dependencies {\n        classpath \"dev.icerock.moko:network-generator:0.21.2\"\n    }\n}\n\n\nallprojects {\n    repositories {\n        mavenCentral()\n    }\n}\n```\n\nproject build.gradle\n```groovy\napply plugin: \"dev.icerock.mobile.multiplatform-network-generator\"\n\ndependencies {\n    commonMainApi(\"dev.icerock.moko:network:0.21.2\")\n    commonMainApi(\"dev.icerock.moko:network-engine:0.21.2\") // configured HttpClientEngine\n    commonMainApi(\"dev.icerock.moko:network-bignum:0.21.2\") // kbignum serializer\n    commonMainApi(\"dev.icerock.moko:network-errors:0.21.2\") // moko-errors integration\n}\n```\n\n## Usage\n\n1. E.g. put an OpenAPI Specification file to `src/swagger.json` path of the project Gradle module.\n\n2. Setup the project `build.gradle`:\n\n```groovy\nmokoNetwork {\n    spec(\"pets\") {\n        inputSpec = file(\"src/swagger.json\")\n    }\n    spec(\"news\") {\n        inputSpec = file(\"src/newsApi.yaml\")\n        packageName = \"news\"\n        isInternal = false\n        isOpen = true\n        configureTask {\n            // here can be configuration of https://github.com/OpenAPITools/openapi-generator GenerateTask\n        }\n        enumFallbackNull = false\n    }\n}\n```\n\n3. Then run `openApiGenerate` Gradle task and after completion you will get all generated classes in\n`build/generated/moko-network` directory.\n\n4. To import all generated classes of model put:\n\n```kotlin\nimport dev.icerock.moko.network.generated.models.*\n``` \n\n```kotlin\nimport dev.icerock.moko.network.generated.apis.*\n```\n\n5. Then you can use generated API's in your application in the common sourceset:\n\n```kotlin\nimport dev.icerock.moko.network.generated.apis.*\n\nclass TestViewModel : ViewModel() {\n    // ..\n    \n    private val petApi = PetApi(\n        basePath = \"https://petstore.swagger.io/v2/\", // Base API URL\n        httpClient = ktorHttpClient, // Reference to Ktor HTTP client object\n        json = kotlinxJsonParser // Reference to kotlinx.serialization.json parser object\n    )\n\n    fun apiRequest() {\n        viewModelScope.launch {\n            try {\n                val pet = petApi.findPetsByStatus(listOf(\"available\"))\n\n                // ...\n            } catch (error: Exception) {\n                // ...\n            }\n        }\n    }\n}\n```\n\nFor the moko-network specification generator, you can enable safe enum properties generation mode.\nTo turn on the mode in `build.gradle` to a `spec` block add flag:\n\n```\nenumFallbackNull = true\n```\n\nThe enabled mode will generate special wrapper `Safeable` for all properties with the enum type,\nthat which in a situation for an unexpected enum value will return null.\n\n\n#### Deprecated usage\nOld way with `OpenApi Generator Plugin` available by:\n```groovy\napply plugin: \"dev.icerock.mobile.multiplatform-network-generator-deprecated\"\n\nopenApiGenerate {\n    inputSpec.set(file(\"src/swagger.json\").path)\n    generatorName.set(\"kotlin-ktor-client\")\n}\n```\nbut this way limited to one spec in one time.\n\n#### moko-network-errors\n\nThere is module **moko-network-errors** for [moko-errors](https://github.com/icerockdev/moko-errors)\nlibrary that contains built-in mappers for mapping **moko-network** exception classes into \n`StringDesc` objects (there are built-in resources for text in English and Russian).\n\nTo use the **moko-network-errors** module just call the `registerAllNetworkMappers` extension of \n`ExceptionMappersStorage` object:\n\n```kotlin\nfun initExceptionMappersStorage() {\n    ExceptionMappersStorage.registerAllNetworkMappers()\n}\n```\n\nAnd then you can use `ExceptionHandler` to automatically handle exceptions for network requests: \n\n```kotlin\nviewModelScope.launch {\n    exceptionHandler.handle {\n        val pet = petApi.findPetsByStatus(listOf(\"available\"))\n\n        // ...\n    }.execute()\n}\n```\n\nFor more information about exception handling see [moko-errors](https://github.com/icerockdev/moko-errors).\n\n## Samples\nMore examples can be found in the [sample directory](sample).\n\n## Set Up Locally \n- In [network directory](network) contains `network` library;\n- In [network-errors directory](network-errors) contains `network-errors` module;\n- In [plugins directory](plugins) contains gradle plugin with OpenAPI implementation generator;\n- In [sample directory](sample) contains samples on android, ios \u0026 mpp-library connected to apps.\n\n## Contributing\nAll development (both new features and bug fixes) is performed in `develop` branch. This way `master` sources always contain sources of the most recently released version. Please send PRs with bug fixes to `develop` branch. Fixes to documentation in markdown files are an exception to this rule. They are updated directly in `master`.\n\nThe `develop` branch is pushed to `master` during release.\n\nMore detailed guide for contributers see in [contributing guide](CONTRIBUTING.md).\n\n## License\n        \n    Copyright 2019 IceRock MAG Inc\n    \n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n    \n       http://www.apache.org/licenses/LICENSE-2.0\n    \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficerockdev%2Fmoko-network","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficerockdev%2Fmoko-network","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficerockdev%2Fmoko-network/lists"}