Skip to content

Commit

Permalink
Added kDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-cebo committed Dec 5, 2024
1 parent 92958e2 commit 99e03de
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
package com.pubnub.api.java.models.consumer.objects_api.member

/**
* Represents the options for including additional details in member-related operations.
*
* This interface extends [com.pubnub.api.models.consumer.objects.member.MemberInclude]
* and provides a flexible builder pattern to configure the desired inclusion options.
*/
interface MemberInclude : com.pubnub.api.models.consumer.objects.member.MemberInclude {
companion object {
/**
* Creates a new [Builder] for constructing a [MemberInclude] instance.
*
* @return a new [Builder] instance.
*/
@JvmStatic
fun builder() = Builder()
}

/**
* Builder class for configuring and creating instances of [MemberInclude].
*/
class Builder internal constructor() {
var includeCustom: Boolean = false
var includeStatus: Boolean = false
Expand All @@ -16,46 +30,99 @@ interface MemberInclude : com.pubnub.api.models.consumer.objects.member.MemberIn
var includeUserType: Boolean = false
var includeUserStatus: Boolean = false

/**
* Specifies whether to include custom data in the member data.
*
* @param includeCustom `true` to include custom fields, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeCustom(includeCustom: Boolean): Builder {
this.includeCustom = includeCustom
return this
}

/**
* Specifies whether to include the status of the member.
*
* @param includeStatus `true` to include status, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeStatus(includeStatus: Boolean): Builder {
this.includeStatus = includeStatus
return this
}

/**
* Specifies whether to include the type of the member.
*
* @param includeType `true` to include type, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeType(includeType: Boolean): Builder {
this.includeType = includeType
return this
}

/**
* Specifies whether to include the total count of members.
*
* @param includeTotalCount `true` to include the total count, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeTotalCount(includeTotalCount: Boolean): Builder {
this.includeTotalCount = includeTotalCount
return this
}

/**
* Specifies whether to include user information in the member data.
*
* @param includeUser `true` to include user information, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeUser(includeUser: Boolean): Builder {
this.includeUser = includeUser
return this
}

/**
* Specifies whether to include custom fields for the user in the member data.
*
* @param includeUserCustom `true` to include user custom fields, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeUserCustom(includeUserCustom: Boolean): Builder {
this.includeUserCustom = includeUserCustom
return this
}

/**
* Specifies whether to include the type of the user in the member data.
*
* @param includeUserType `true` to include user type, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeUserType(includeUserType: Boolean): Builder {
this.includeUserType = includeUserType
return this
}

/**
* Specifies whether to include the status of the user in the member data.
*
* @param includeUserStatus `true` to include user status, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeUserStatus(includeUserStatus: Boolean): Builder {
this.includeUserStatus = includeUserStatus
return this
}

/**
* Builds and returns a new [MemberInclude] instance with the configured options.
*
* @return a new [MemberInclude] instance.
*/
fun build(): MemberInclude {
return object : MemberInclude {
override val includeCustom: Boolean = this@Builder.includeCustom
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
package com.pubnub.api.java.models.consumer.objects_api.membership

/**
* Represents the options for including additional details in membership-related operations.
*
* This interface extends [com.pubnub.api.models.consumer.objects.membership.MembershipInclude]
* and provides a flexible builder pattern to configure the desired inclusion options.
*/
interface MembershipInclude : com.pubnub.api.models.consumer.objects.membership.MembershipInclude {
companion object {
/**
* Creates a new [Builder] for constructing a [MembershipInclude] instance.
*
* @return a new [Builder] instance.
*/
@JvmStatic
fun builder() = Builder()
}

/**
* Builder class for configuring and creating instances of [MembershipInclude].
*/
class Builder internal constructor() {
var includeCustom: Boolean = false
var includeStatus: Boolean = false
Expand All @@ -16,46 +30,99 @@ interface MembershipInclude : com.pubnub.api.models.consumer.objects.membership.
var includeChannelType: Boolean = false
var includeChannelStatus: Boolean = false

/**
* Specifies whether to include custom fields in the membership data.
*
* @param includeCustom `true` to include custom data, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeCustom(includeCustom: Boolean): Builder {
this.includeCustom = includeCustom
return this
}

/**
* Specifies whether to include the status of the membership.
*
* @param includeStatus `true` to include status, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeStatus(includeStatus: Boolean): Builder {
this.includeStatus = includeStatus
return this
}

/**
* Specifies whether to include the type of the membership.
*
* @param includeType `true` to include type, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeType(includeType: Boolean): Builder {
this.includeType = includeType
return this
}

/**
* Specifies whether to include the total count of memberships.
*
* @param includeTotalCount `true` to include the total count, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeTotalCount(includeTotalCount: Boolean): Builder {
this.includeTotalCount = includeTotalCount
return this
}

/**
* Specifies whether to include channel information in the membership data.
*
* @param includeChannel `true` to include channel information, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeChannel(includeChannel: Boolean): Builder {
this.includeChannel = includeChannel
return this
}

/**
* Specifies whether to include custom data for the channel in the membership data.
*
* @param includeChannelCustom `true` to include channel custom fields, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeChannelCustom(includeChannelCustom: Boolean): Builder {
this.includeChannelCustom = includeChannelCustom
return this
}

/**
* Specifies whether to include the type of the channel in the membership data.
*
* @param includeChannelType `true` to include channel type, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeChannelType(includeChannelType: Boolean): Builder {
this.includeChannelType = includeChannelType
return this
}

/**
* Specifies whether to include the status of the channel in the membership data.
*
* @param includeChannelStatus `true` to include channel status, `false` otherwise.
* @return the current [Builder] instance.
*/
fun includeChannelStatus(includeChannelStatus: Boolean): Builder {
this.includeChannelStatus = includeChannelStatus
return this
}

/**
* Builds and returns a new [MembershipInclude] instance with the configured options.
*
* @return a new [MembershipInclude] instance.
*/
fun build(): MembershipInclude {
return object : MembershipInclude {
override val includeCustom: Boolean = this@Builder.includeCustom
Expand Down
4 changes: 2 additions & 2 deletions pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
<file name="src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/member/MemberInclude.kt">
<error line="3" column="5" source="standard:function-naming" />
<error line="20" column="5" source="standard:function-naming" />
</file>
<file name="src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/membership/MembershipInclude.kt">
<error line="3" column="5" source="standard:function-naming" />
<error line="20" column="5" source="standard:function-naming" />
</file>
<file name="src/jsMain/kotlin/Pubnub.d.kt">
<error line="156" column="40" source="standard:comment-wrapping" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
package com.pubnub.api.models.consumer.objects.member

/**
* Factory function to create an instance of [MemberInclude].
*
* This function provides default values for all inclusion flags and returns an
* implementation of the [MemberInclude] interface with the specified options.
*
* @param includeCustom Whether to include custom properties in the result. Default is `false`.
* @param includeStatus Whether to include the status of the Members in the result. Default is `false`.
* @param includeType Whether to include the type of the Members in the result. Default is `false`.
* @param includeTotalCount Whether to include the total count of Members in the result. Default is `false`.
* @param includeUser Whether to include user information in the result. Default is `false`.
* @param includeUserCustom Whether to include custom properties of the user in the result. Default is `false`.
* @param includeUserType Whether to include the type of the user in the result. Default is `false`.
* @param includeUserStatus Whether to include the status of the user in the result. Default is `false`.
*
* @return An instance of [MemberInclude] with the specified inclusion options.
*/
fun MemberInclude(
includeCustom: Boolean = false,
includeStatus: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
package com.pubnub.api.models.consumer.objects.membership

/**
* Factory function to create an instance of [MembershipInclude].
*
* This function provides default values for all inclusion flags and returns an
* implementation of the [MembershipInclude] interface with the specified options.
*
* @param includeCustom Whether to include custom properties in the result. Default is `false`.
* @param includeStatus Whether to include the status of the Memberships in the result. Default is `false`.
* @param includeType Whether to include the type of the Memberships in the result. Default is `false`.
* @param includeTotalCount Whether to include the total count of Memberships in the result. Default is `false`.
* @param includeChannel Whether to include channel information in the result. Default is `false`.
* @param includeChannelCustom Whether to include custom properties of the channel in the result. Default is `false`.
* @param includeChannelType Whether to include the type of the channel in the result. Default is `false`.
* @param includeChannelStatus Whether to include the status of the channel in the result. Default is `false`.
*
* @return An instance of [MembershipInclude] with the specified inclusion options.
*/
fun MembershipInclude(
includeCustom: Boolean = false,
includeStatus: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
<file name="src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/membership/MembershipInclude.kt">
<error line="9" column="1" source="standard:no-empty-first-line-in-class-body" />
</file>
</baseline>
Original file line number Diff line number Diff line change
@@ -1,15 +1,51 @@
package com.pubnub.api.models.consumer.objects.member

/**
* Base interface defining options to include additional data when using Memberships API and ChannelMembers.
*/
interface Include {
/**
* Whether to include custom data of the Membership in the result.
*/
val includeCustom: Boolean

/**
* Whether to include the status of the Membership in the result.
*/
val includeStatus: Boolean

/**
* Whether to include the type of the Membership in the result.
*/
val includeType: Boolean

/**
* Whether to include the total count of Memberships in the result.
*/
val includeTotalCount: Boolean
}

/**
* Interface representing options to include additional data when using Channel Members API.
*/
interface MemberInclude : Include {
/**
* Whether to include user information in the result.
*/
val includeUser: Boolean

/**
* Whether to include custom properties of the user in the result.
*/
val includeUserCustom: Boolean

/**
* Whether to include the type of the user in the result.
*/
val includeUserType: Boolean

/**
* Whether to include the status of the user in the result.
*/
val includeUserStatus: Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,28 @@ package com.pubnub.api.models.consumer.objects.membership

import com.pubnub.api.models.consumer.objects.member.Include

/**
* Interface representing options to include additional data when using Memberships API.
*/
interface MembershipInclude : Include {

/**
* Whether to include channel information in the result.
*/
val includeChannel: Boolean

/**
* Whether to include custom properties of the channel in the result.
*/
val includeChannelCustom: Boolean

/**
* Whether to include the type of the channel in the result.
*/
val includeChannelType: Boolean

/**
* Whether to include the status of the channel in the result.
*/
val includeChannelStatus: Boolean
}

0 comments on commit 99e03de

Please sign in to comment.