Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
Add documentation (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
martingagnon committed Nov 26, 2019
1 parent b13f344 commit 822e596
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 37 deletions.
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->

## Motivation and Context
<!--- Why is those changes required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
42 changes: 21 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ sudo: false

jobs:
include:
- name: Streams
env:
- JAVA_OPTS="-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m"
language: android
dist: trusty
components:
- tools
- platform-tools
- extra-android-m2repository
before_install:
- yes | sdkmanager "platforms;android-28"
- yes | sdkmanager "build-tools;29.0.0"
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_script:
- chmod +x gradlew
- chmod +x gradle/wrapper/gradle-wrapper.jar
script:
- ./gradlew test jvmTest ktlintCheck --parallel
- name: Http
env:
- JAVA_OPTS="-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m"
language: android
dist: trusty
components:
- tools
- platform-tools
- extra-android-m2repository
before_install:
- yes | sdkmanager "platforms;android-28"
- yes | sdkmanager "build-tools;29.0.0"
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_script:
- chmod +x gradlew
- chmod +x gradle/wrapper/gradle-wrapper.jar
script:
- ./gradlew check
38 changes: 38 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Code of Conduct

Contact: info@mirego.com

## Why have a Code of Conduct?

As contributors and maintainers of this project, we are committed to providing a friendly, safe and welcoming environment for all, regardless of age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.

The goal of the Code of Conduct is to specify a baseline standard of behavior so that people with different social values and communication styles can talk about the project effectively, productively, and respectfully, even in face of disagreements. The Code of Conduct also provides a mechanism for resolving conflicts in the community when they arise.

## Our Values

These are the values Trikot developers should aspire to:

* Be friendly and welcoming
* Be patient
* Remember that people have varying communication styles and that not everyone is using their native language. (Meaning and tone can be lost in translation.)
* Be thoughtful
* Productive communication requires effort. Think about how your words will be interpreted.
* Remember that sometimes it is best to refrain entirely from commenting.
* Be respectful
* In particular, respect differences of opinion. It is important that we resolve disagreements and differing views constructively.
* Avoid destructive behavior
* Derailing: stay on topic; if you want to talk about something else, start a new conversation.
* Unconstructive criticism: don't merely decry the current state of affairs; offer (or at least solicit) suggestions as to how things may be improved.
* Snarking (pithy, unproductive, sniping comments).

The following actions are explicitly forbidden:

* Insulting, demeaning, hateful, or threatening remarks.
* Discrimination based on age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.
* Bullying or systematic harassment.
* Unwelcome sexual advances.
* Incitement to any of these.

## Acknowledgements

This document was based on the Code of Conduct from the Elixir project.
26 changes: 26 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright (c) 2018-2019, Mirego
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of the Mirego nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
38 changes: 23 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# Trikot.http
**Incubating**

Multiplaform http networking abstraction.
- Default implementation for each platform
- Advanced Http Header management
- Default Http request implementation for each platform
- Solid Http Header management and Error management
- Connectivity (Reachability) management
- Deserialization of results using [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization)
- Abstract network in Kotlin Multiplatform making sure every bit of network code is testable.


## Sample Http request with deserialization usage
## Simple json request
```kotlin
@Serializable
data class Foo(val bar: String)

val executablePublisher = DeserializableHttpRequestPublisher<Foo>(Foo.serializer,
RequestBuilder().also { it.path = "/getFoo" }
)
executablePublisher.execute()
result.subscribe(cancellableManager) { foo ->
print(foo.bar)
}
@Serializable
data class Foo(val bar: String)

val executablePublisher = DeserializableHttpRequestPublisher<Foo>(Foo.serializer,
RequestBuilder().also { it.path = "/getFoo" }
)
executablePublisher.execute()
result.subscribe(cancellableManager) { foo ->
print(foo.bar)
}
```

# ConnectivityPublisher
Expand Down Expand Up @@ -51,3 +50,12 @@ Values are `WIFI`, `CELLULAR`, `NONE`
- [Swift extensions](./swift-extensions/README.md)
- [Android extensions](./android-ktx/README.md)

## License

Trikot.http is © 2018-2019 [Mirego](https://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/trikot.http/blob/master/LICENSE.md) file.

## About Mirego

[Mirego](https://www.mirego.com) is a team of passionate people who believe that work is a place where you can innovate and have fun. We’re a team of [talented people](https://life.mirego.com) who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://www.mirego.org).

We also [love open-source software](https://open.mirego.com) and we try to give back to the community as much as we can.
5 changes: 4 additions & 1 deletion swift-extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To use `Trikot.http` swift extensions, you must export `http` and `http-iosx64`
Then, run `pod install`.

##### Setup HTTPRequestFactory Implementation based on `URLSession`
`ktor` does not work that well on iOS as it relies on Coroutines on the mainThread (as of today). Trikot.http provides its own implementation based on `URLSession`
Trikot.http provides its own implementation based on `URLSession`.

```swift
import Trikot_http
Expand All @@ -27,3 +27,6 @@ TrikotConnectivityService.shared.start() // When app is running
...
TrikotConnectivityService.shared.stop() // When app is in background
```

##### Notes on Ktor
As of Kotlin 1.3.50, `Ktor` only runs on the mainThread limiting how requests are processed and content parsed. When Coroutines multithreading issues will be adressed in Kotlin Native, TrikotHttpRequestFactory might switch to a Ktor implementation.

0 comments on commit 822e596

Please sign in to comment.