Skip to content

Commit

Permalink
Add @jvmoverloads to AvatarUrl.url() function (#385)
Browse files Browse the repository at this point in the history
* Add @jvmoverloads to AvatarUrl.url() function

* Add @jvmoverloads to AvatarUrl constructors

* Generate gravatar.api file
  • Loading branch information
AdamGrzybkowski authored Oct 11, 2024
1 parent 9b0793f commit 86e3564
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gravatar/api/gravatar.api
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ public final class com/gravatar/AvatarQueryOptionsKt {

public final class com/gravatar/AvatarUrl {
public static final field Companion Lcom/gravatar/AvatarUrl$Companion;
public fun <init> (Lcom/gravatar/types/Email;)V
public fun <init> (Lcom/gravatar/types/Email;Lcom/gravatar/AvatarQueryOptions;)V
public synthetic fun <init> (Lcom/gravatar/types/Email;Lcom/gravatar/AvatarQueryOptions;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Lcom/gravatar/types/Hash;)V
public fun <init> (Lcom/gravatar/types/Hash;Lcom/gravatar/AvatarQueryOptions;)V
public synthetic fun <init> (Lcom/gravatar/types/Hash;Lcom/gravatar/AvatarQueryOptions;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/net/URL;)V
public fun <init> (Ljava/net/URL;Lcom/gravatar/AvatarQueryOptions;)V
public synthetic fun <init> (Ljava/net/URL;Lcom/gravatar/AvatarQueryOptions;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getAvatarQueryOptions ()Lcom/gravatar/AvatarQueryOptions;
public final fun getCanonicalUrl ()Ljava/net/URL;
public final fun getHash ()Lcom/gravatar/types/Hash;
public final fun isAvatarUrl ()Z
public final fun setAvatarQueryOptions (Lcom/gravatar/AvatarQueryOptions;)V
public final fun url ()Ljava/net/URL;
public final fun url (Ljava/lang/String;)Ljava/net/URL;
public static synthetic fun url$default (Lcom/gravatar/AvatarUrl;Ljava/lang/String;ILjava/lang/Object;)Ljava/net/URL;
}
Expand Down
5 changes: 5 additions & 0 deletions gravatar/src/main/java/com/gravatar/AvatarUrl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class AvatarUrl {
* @param hash Gravatar hash
* @param avatarQueryOptions Avatar query options
*/
@JvmOverloads
public constructor(hash: Hash, avatarQueryOptions: AvatarQueryOptions? = null) {
this.hash = hash
this.avatarQueryOptions = avatarQueryOptions
Expand All @@ -70,6 +71,7 @@ public class AvatarUrl {
* @param email Email address
* @param avatarQueryOptions Avatar query options
*/
@JvmOverloads
public constructor(
email: Email,
avatarQueryOptions: AvatarQueryOptions? = null,
Expand All @@ -81,6 +83,7 @@ public class AvatarUrl {
* @param url Gravatar URL
* @param avatarQueryOptions Avatar query options
*/
@JvmOverloads
public constructor(url: URL, avatarQueryOptions: AvatarQueryOptions? = null) {
this.hash = hashFromUrl(url)
// Force the removal of query parameters as we can't be sure they are valid and won't interfere with
Expand All @@ -104,8 +107,10 @@ public class AvatarUrl {
/**
* Get the [URL] for the avatar.
*
* @param cacheBuster Random string value to force a cache bust
* @return [URL] for the avatar
*/
@JvmOverloads
public fun url(cacheBuster: String? = null): URL {
return URL(
canonicalUrl.protocol,
Expand Down

0 comments on commit 86e3564

Please sign in to comment.