diff --git a/README.md b/README.md
index 67f2ea8..595c33d 100644
--- a/README.md
+++ b/README.md
@@ -4,44 +4,33 @@ Poller is a simple Kotlin library which runs a certain task at a regular interva
## Download
```kotlin
-implementation("dev.mslalith:poller:0.2.0")
+implementation("dev.mslalith:poller:0.3.0")
```
## Usage
### Create Poller
-An instance to Poller can be created in two ways:
+Use `Poller.new` method to create new Poller. This takes
-- Use `Poller.indefinite` method to run the forever until stopped explicitly
-```kotlin
-val poller: Poller = Poller.indefinite(
- coroutineScope = coroutineScope,
- pollInterval = 1_000
-)
-```
-
-- Use `Poller.create` method to create new Poller. This takes
-
-`coroutineScope` - The scope in which the poll should execute
-`pollInterval` - Time in millis for the next poll to execute after
-`pollRepeatCount` - Number of times for the poll to execute
-`maxRetries` - Maximum number of times the poll can retry within the poll lifecycle
-
-For example, let's take `pollInterval = 4_000` and `pollRepeatCount = 5`
-Then the total time of this poll would be `20_000 (4_000 * 5)`
-
-Poll will be stopped if retries are exhausted or its lifetime expires.
+`coroutineScope` - The scope in which the poll should execute
+`pollInterval` - Time in millis between each poll
+`pollStrategy` - The strategy for the poll to continue
```kotlin
-val poller: Poller = Poller.finite(
+val poller: Poller = Poller.new(
coroutineScope = coroutineScope,
pollInterval = 1_000,
- pollRepeatCount = 4,
- maxRetries = 2
+ pollStrategy = IndefiniteStrategy()
)
```
+### Poll Strategies
+
+- `IndefiniteStrategy` - runs indefinitely
+- `RetryLimitStrategy` - stop when retires are exhausted
+- `TimeoutStrategy` - stop when time is exhausted
+
### Consuming Poll events
Poller exposes a `StateFlow` which holds the current state of your Poll.
diff --git a/build.gradle.kts b/build.gradle.kts
index d156e32..9721af8 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,7 +7,7 @@ plugins {
}
group = "dev.mslalith"
-version = "0.3.0-alpha01"
+version = "0.3.0"
repositories {
mavenCentral()
diff --git a/src/main/kotlin/dev/mslalith/poller/Poller.kt b/src/main/kotlin/dev/mslalith/poller/Poller.kt
index 6776d9b..615eb6d 100644
--- a/src/main/kotlin/dev/mslalith/poller/Poller.kt
+++ b/src/main/kotlin/dev/mslalith/poller/Poller.kt
@@ -52,8 +52,8 @@ fun Poller.stopIfPolling() {
* Create a new Poller instance
*
* @param coroutineScope The scope in which the poll should execute
- * @param pollInterval Time in millis for the poll to run after
- * @param pollStrategy The strategy to continue the poll
+ * @param pollInterval Time in millis between each poll
+ * @param pollStrategy The strategy for the poll to continue
*/
fun Poller.Companion.new(
coroutineScope: CoroutineScope,