• Stars
    star
    562
  • Rank 79,281 (Top 2 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

NetworkResponse Retrofit adapter

Build Status Downloads

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.

More Repositories

1

WhatTheStack

See a pretty error screen when your Android app crashes
Kotlin
245
star
2

Vector

Kotlin Coroutines based MVI architecture library for Android
Kotlin
193
star
3

MoonShot

A SpaceX companion app for Android
Kotlin
161
star
4

lucilla

Fast, efficient, in-memory Full Text Search for Kotlin
Kotlin
127
star
5

MovieDB

A gorgeous TMDb client for Android
Kotlin
124
star
6

functions-differ

Tool to find Firebase Functions that changed for selective redeployments
TypeScript
39
star
7

Resumade

An Android app with a minimal material design that generates a resume for you
Kotlin
32
star
8

opengraphKt

A dead simple OpenGraph tags parser for Kotlin
Kotlin
21
star
9

json-formatter

Dead simple JSON formatter for the browser (Next.js, Tailwindcss, TypeScript)
TypeScript
8
star
10

getignore

Fetch gitignore files for your projects right from the command line
Go
7
star
11

dagger-mvrx-multimodule

Demonstrates usage of Dagger and MvRx in multi module apps
Kotlin
3
star
12

pathfix

Fixes the PATH environment variable of the current process
Go
3
star
13

EpoxyCarouselBugSample

Sample project for carousel scrolling bug in Epoxy
Kotlin
2
star
14

homebrew-pps

Homebrew Tap for the pps package
Ruby
2
star
15

translate_ref_generator

A Dart build plugin to make it easier to work with translation string files
Dart
2
star
16

UsageStatsManager-Sample

An app to demonstrate the usage of the UsageStatsManager API
Java
2
star
17

homebrew-getignore

Homebrew repository for getignore
Ruby
1
star
18

spacexkmp

A Kotlin Multiplatform wrapper for the SpaceX API
Kotlin
1
star
19

translate_ref

Annotations library for Translation Reference Generator
Dart
1
star
20

CMS

Semester project for Database Management System course (CO202)
JavaScript
1
star
21

UnitTestingSample

A sample app to help me learn unit testing through Junit 5 and Spek framework
Kotlin
1
star
22

MVRx-Lite

A lightweight state management library inspired from Airbnb's amazing MvRx library
Kotlin
1
star
23

pps

A parallel port scanner, not intended for real use
Go
1
star
24

Rosewood

An Android app to create a timeline of user interactions with their device
Kotlin
1
star