Skip to content

Commit

Permalink
feat: Write docs for Layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
mayorJAY committed Jun 19, 2024
1 parent 802fc36 commit ef4eaad
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/main/kotlin/extensions/LayoutsExtentions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ import java.math.BigInteger

private val logger = KotlinLogging.logger {}

/**
* Retrieve a list of Layouts This function supports pagination.
* @param page the page number to be retrieved
* @param pageSize the size of the page to be retrieved
* @param orderBy direction of the sorting query param. Either ascending (1) or descending (-1)
* @param sortBy sort field. Currently only supports **createdAt**
* @return [PaginatedResponseWrapper] with a list of [GetLayoutsResponse] as the response data
* @throws [Exception] if a problem occurred talking to the server or if there is a connection error
*/
suspend fun Novu.filterLayouts(
page: BigInteger,
pageSize: BigInteger,
Expand All @@ -24,21 +33,46 @@ suspend fun Novu.filterLayouts(
return response.extractResponse(logger, config.enableLogging)
}

/**
* Create a Layout.
* @param request an instance of [CreateLayoutRequest]
* @return [ResponseWrapper] with [CreateLayoutResponse] as the response data
* @throws [Exception] if a problem occurred talking to the server or if there is a connection error
*/
suspend fun Novu.createLayout(request: CreateLayoutRequest): ResponseWrapper<CreateLayoutResponse>? {
val response = layoutsApi.createLayout(request)
return response.extractResponse(logger, config.enableLogging)
}

/**
* Retrieve a Layout.
* @param layoutId the ID of the Layout to be retrieved
* @return [ResponseWrapper] with [GetLayoutsResponse] as the response data
* @throws [Exception] if a problem occurred talking to the server or if there is a connection error
*/
suspend fun Novu.layout(layoutId: String): ResponseWrapper<GetLayoutsResponse>? {
val response = layoutsApi.getLayout(layoutId)
return response.extractResponse(logger, config.enableLogging)
}

/**
* Delete a Layout.
* @param layoutId the ID of the Layout to be deleted
* @return [DeleteLayoutResponse]
* @throws [Exception] if a problem occurred talking to the server or if there is a connection error
*/
suspend fun Novu.deleteLayout(layoutId: String): DeleteLayoutResponse {
val response = layoutsApi.deleteLayout(layoutId)
return response.extractResponse(logger, config.enableLogging, DeleteLayoutResponse())
}

/**
* Update a Layout.
* @param layoutId the ID of the Layout to be updated
* @param request an instance of [CreateLayoutRequest]
* @return [ResponseWrapper] with [GetLayoutsResponse] as the response data
* @throws [Exception] if a problem occurred talking to the server or if there is a connection error
*/
suspend fun Novu.updateLayout(
layoutId: String,
request: CreateLayoutRequest,
Expand All @@ -47,6 +81,12 @@ suspend fun Novu.updateLayout(
return response.extractResponse(logger, config.enableLogging)
}

/**
* Set a Layout as the default Layout.
* @param layoutId the ID of the Layout to be set as default
* @return [SetDefaultLayoutResponse]
* @throws [Exception] if a problem occurred talking to the server or if there is a connection error
*/
suspend fun Novu.setDefaultLayout(layoutId: String): SetDefaultLayoutResponse {
val response = layoutsApi.setDefaultLayout(layoutId)
return response.extractResponse(logger, config.enableLogging, SetDefaultLayoutResponse())
Expand Down

0 comments on commit ef4eaad

Please sign in to comment.