Skip to content
Projects

haroldadmin/NetworkResponseAdapter

View on GitHub

haroldadmin/NetworkResponseAdapter has 557 GitHub stars and 62 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-15 21:54 UTC. Last push 2024-04-17.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

Retrofit call adapter to model success/failed responses as sealed types

Developer Tools

README.md

Original

NetworkResponse Retrofit adapter

Build Status

This library provides a Kotlin Coroutines based Retrofit call adapter for wrapping your API responses in a NetworkResponse sealed type.

Documentation

https://haroldadmin.github.io/NetworkResponseAdapter

Network Response

NetworkResponse<S, E> is a Kotlin sealed interface with the following states:

  • Success: Represents successful network calls (2xx response codes)
  • Error: Represents unsuccessful network calls
    • ServerError: Server errors (non 2xx responses)
    • NetworkError: IO Errors, connectivity problems
    • UnknownError: Any other errors, like serialization exceptions

It is generic on two types: a success response (S), and an error response (E).

  • S: Kotlin representation of a successful API response
  • E: Representation of an unsuccessful API response

Find complete documentation at https://haroldadmin.github.io/NetworkResponseAdapter.

Installation

Add the Jitpack repository to your list of repositories:

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

And then add the dependency in your gradle file:

dependencies {
    implementation "com.github.haroldadmin:NetworkResponseAdapter:(latest-version)"
}

Release

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.