Skip to content

Commit

Permalink
Fix annotation KDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Foso committed Oct 21, 2023
1 parent d20b1ba commit c7ac992
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 28 deletions.
1 change: 1 addition & 0 deletions ktorfit-annotations/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Annotations

The annotations for Ktorfit
3 changes: 2 additions & 1 deletion ktorfit-annotations/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,6 @@ publishing {
}

rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class) {
rootProject.the(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension::class).nodeVersion = "18.0.0"
rootProject.the(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension::class).nodeVersion =
"18.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package de.jensklingenberg.ktorfit.http

/**
* Use this to upload data in an HTTP Body
*
Use this to upload data in an HTTP Body
@POST("createIssue")
fun upload(@Body issue: Issue)
* ```
* @POST("createIssue")
* fun upload(@Body issue: Issue)
* ```
*/
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class Body
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package de.jensklingenberg.ktorfit.http

/** Make a DELETE request.
*
* ```
* @DELETE("deleteIssue")
* fun deleteIssue(@Query("id") id: String)
* ```
* @param value relative url path, if empty, you need to have a parameter with [Url]
* */
*
*/
@Target(AnnotationTarget.FUNCTION)
annotation class DELETE(val value: String = "")
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package de.jensklingenberg.ktorfit.http
* Needs to be used in combination with [FormUrlEncoded]
* @param value The default value will be replaced with the name of the parameter that is annotated.
* @param encoded true means that this value is already URL encoded and will not be encoded again
* @see FormUrlEncoded
* @see FieldMap
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.jensklingenberg.ktorfit.http

/**
* Needs to be used in combination with [FormUrlEncoded]
* Needs to be used in combination with [FormUrlEncoded]
* @param encoded true means that this value is already URL encoded and will not be encoded again
*/
@Target(AnnotationTarget.VALUE_PARAMETER)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package de.jensklingenberg.ktorfit.http

/** Make a GET request.
* ```
* @GET("getIssue")
* fun getIssue(@Query("id") id: String) : Issue
* ```
* @param value relative url path, if empty, you need to have a parameter with [Url]
* */
@Target(AnnotationTarget.FUNCTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package de.jensklingenberg.ktorfit.http
/**
* Add a header to a request
*
* @ GET("comments")
*
* suspend fun request( @ Header("Content-Type") name: String): List< Comment>
* ```
* @GET("comments")
* suspend fun request( @Header("Content-Type") name: String): List<Comment>
* ```
*
* A request with request("Hello World") will have the header "Content-Type:Hello World"
* header with null values will be ignored
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package de.jensklingenberg.ktorfit.http
/**
* Add headers to a request
*
* @ GET("comments")
* suspend fun requestWithHeaders( @HeaderMap headerMap : Map<String,String>): List<Comment>
* ```
* @GET("comments")
* suspend fun requestWithHeaders(@HeaderMap headerMap : Map<String,String>): List<Comment>
* ```
*
* @see Headers
* @see Header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package de.jensklingenberg.ktorfit.http
/**
* Add headers to a request
*
* ```
* @Headers("Accept: application/json","Content-Type: application/json")
* @GET("comments")
* suspend fun requestWithHeaders(): List<Comment>
* ```
*/
@Target(AnnotationTarget.FUNCTION)
annotation class Headers(vararg val value: String)
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ package de.jensklingenberg.ktorfit.http
* <p>Path parameters type may not be nullable.
*
*
<pre><code>
@GET("post/{postId}")
suspend fun getPosts(@Path("postId") postId: Int): List< Post>
</code></pre>
* ```
* @GET("post/{postId}")
* suspend fun getPosts(@Path("postId") postId: Int): List< Post>
* ```
*/

@Target(AnnotationTarget.VALUE_PARAMETER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ package de.jensklingenberg.ktorfit.http
/**
* Used for query parameters
*
* @ GET("comments")
* ```
* @GET("comments")
* suspend fun getCommentsById(@Query("postId") postId: String): List<Comment>
*
* ```
* A request with getCommentsById(3) will result in the relative URL “comments?postId=3”
*
* @ GET("comments")
* ```
* @GET("comments")
* suspend fun getCommentsById(@Query("postId") postId: List<String?>): List<Comment>
* ```
*
* A request with getCommentsById(listOf("3",null,"4")) will result in the relative URL “comments?postId=3&postId=4”
*
* =====
* @param value The default value will be replaced with the name of the parameter that is annotated.It is the key of the query parameter
* @param value The default value will be replaced with the name of the parameter that is annotated.It is the key of the query parameter.
* null values are ignored
* @param encoded true means that this value is already URL encoded and will not be encoded again
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package de.jensklingenberg.ktorfit.http


/**
* ```
* @GET
* suspend fun request(@Url url: String): List<Comment>
*
&#64;GET()
suspend fun request(@Url url: String): List< Comment>
*/
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class Url

0 comments on commit c7ac992

Please sign in to comment.