1046 lines
25 KiB
Smali
1046 lines
25 KiB
Smali
.class public final Lcom/discord/restapi/RestAPIBuilder;
|
|
.super Ljava/lang/Object;
|
|
.source "RestAPIBuilder.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/restapi/RestAPIBuilder$Companion;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final API_VERSION:I = 0x8
|
|
|
|
.field public static final CONTENT_TYPE_JSON:Ljava/lang/String; = "application/json"
|
|
|
|
.field public static final CONTENT_TYPE_TEXT:Ljava/lang/String; = "text/plain"
|
|
|
|
.field public static final Companion:Lcom/discord/restapi/RestAPIBuilder$Companion;
|
|
|
|
.field public static final DEFAULT_TIMEOUT_MILLIS:J = 0x2710L
|
|
|
|
.field public static clientCallback:Lkotlin/jvm/functions/Function2;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lkotlin/jvm/functions/Function2<",
|
|
"-",
|
|
"Ljava/lang/String;",
|
|
"-",
|
|
"Lf0/z;",
|
|
"Lkotlin/Unit;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# instance fields
|
|
.field public final baseApiUrl:Ljava/lang/String;
|
|
|
|
.field public final cookieJar:Lf0/q;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 2
|
|
|
|
new-instance v0, Lcom/discord/restapi/RestAPIBuilder$Companion;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, v1}, Lcom/discord/restapi/RestAPIBuilder$Companion;-><init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
|
|
|
sput-object v0, Lcom/discord/restapi/RestAPIBuilder;->Companion:Lcom/discord/restapi/RestAPIBuilder$Companion;
|
|
|
|
sget-object v0, Lcom/discord/restapi/RestAPIBuilder$Companion$clientCallback$1;->INSTANCE:Lcom/discord/restapi/RestAPIBuilder$Companion$clientCallback$1;
|
|
|
|
sput-object v0, Lcom/discord/restapi/RestAPIBuilder;->clientCallback:Lkotlin/jvm/functions/Function2;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Ljava/lang/String;Lf0/q;)V
|
|
.locals 1
|
|
|
|
const-string v0, "baseApiUrl"
|
|
|
|
invoke-static {p1, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "cookieJar"
|
|
|
|
invoke-static {p2, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/discord/restapi/RestAPIBuilder;->baseApiUrl:Ljava/lang/String;
|
|
|
|
iput-object p2, p0, Lcom/discord/restapi/RestAPIBuilder;->cookieJar:Lf0/q;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$getClientCallback$cp()Lkotlin/jvm/functions/Function2;
|
|
.locals 1
|
|
|
|
sget-object v0, Lcom/discord/restapi/RestAPIBuilder;->clientCallback:Lkotlin/jvm/functions/Function2;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static final synthetic access$setClientCallback$cp(Lkotlin/jvm/functions/Function2;)V
|
|
.locals 0
|
|
|
|
sput-object p0, Lcom/discord/restapi/RestAPIBuilder;->clientCallback:Lkotlin/jvm/functions/Function2;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static synthetic build$default(Lcom/discord/restapi/RestAPIBuilder;Ljava/lang/Class;ZJLjava/util/List;Ljava/lang/String;ZLjava/lang/String;ILjava/lang/Object;)Ljava/lang/Object;
|
|
.locals 7
|
|
|
|
and-int/lit8 v0, p9, 0x2
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move v0, p2
|
|
|
|
:goto_0
|
|
and-int/lit8 v1, p9, 0x4
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
const-wide/16 v1, 0x2710
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
move-wide v1, p3
|
|
|
|
:goto_1
|
|
and-int/lit8 v3, p9, 0x8
|
|
|
|
const/4 v4, 0x0
|
|
|
|
if-eqz v3, :cond_2
|
|
|
|
move-object v3, v4
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
move-object v3, p5
|
|
|
|
:goto_2
|
|
and-int/lit8 v5, p9, 0x10
|
|
|
|
if-eqz v5, :cond_3
|
|
|
|
goto :goto_3
|
|
|
|
:cond_3
|
|
move-object v4, p6
|
|
|
|
:goto_3
|
|
and-int/lit8 v5, p9, 0x20
|
|
|
|
if-eqz v5, :cond_4
|
|
|
|
const/4 v5, 0x1
|
|
|
|
goto :goto_4
|
|
|
|
:cond_4
|
|
move v5, p7
|
|
|
|
:goto_4
|
|
and-int/lit8 v6, p9, 0x40
|
|
|
|
if-eqz v6, :cond_5
|
|
|
|
const-string v6, "application/json"
|
|
|
|
goto :goto_5
|
|
|
|
:cond_5
|
|
move-object v6, p8
|
|
|
|
:goto_5
|
|
move-object p2, p0
|
|
|
|
move-object p3, p1
|
|
|
|
move p4, v0
|
|
|
|
move-wide p5, v1
|
|
|
|
move-object p7, v3
|
|
|
|
move-object p8, v4
|
|
|
|
move/from16 p9, v5
|
|
|
|
move-object/from16 p10, v6
|
|
|
|
invoke-virtual/range {p2 .. p10}, Lcom/discord/restapi/RestAPIBuilder;->build(Ljava/lang/Class;ZJLjava/util/List;Ljava/lang/String;ZLjava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private final buildApi(Lf0/z;Ljava/lang/Class;Ljava/lang/String;ZZLjava/lang/String;)Ljava/lang/Object;
|
|
.locals 20
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Lf0/z;",
|
|
"Ljava/lang/Class<",
|
|
"TT;>;",
|
|
"Ljava/lang/String;",
|
|
"ZZ",
|
|
"Ljava/lang/String;",
|
|
")TT;"
|
|
}
|
|
.end annotation
|
|
|
|
move-object/from16 v0, p2
|
|
|
|
sget-object v2, Lf/h/d/u/o;->i:Lf/h/d/u/o;
|
|
|
|
sget-object v12, Lf/h/d/r;->d:Lf/h/d/r;
|
|
|
|
new-instance v4, Ljava/util/HashMap;
|
|
|
|
invoke-direct {v4}, Ljava/util/HashMap;-><init>()V
|
|
|
|
new-instance v5, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v5}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
new-instance v3, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
sget-object v16, Lf/h/d/c;->g:Lf/h/d/c;
|
|
|
|
new-instance v1, Lcom/discord/models/domain/Model$TypeAdapterFactory;
|
|
|
|
invoke-direct {v1}, Lcom/discord/models/domain/Model$TypeAdapterFactory;-><init>()V
|
|
|
|
invoke-virtual {v5, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
sget-object v1, Lcom/discord/models/experiments/dto/UserExperimentDto$TypeAdapterFactory;->INSTANCE:Lcom/discord/models/experiments/dto/UserExperimentDto$TypeAdapterFactory;
|
|
|
|
invoke-virtual {v5, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
const-class v1, Lcom/discord/restapi/RestAPIParams$ChannelPosition;
|
|
|
|
new-instance v6, Lcom/discord/restapi/RestAPIParams$ChannelPosition$Serializer;
|
|
|
|
invoke-direct {v6}, Lcom/discord/restapi/RestAPIParams$ChannelPosition$Serializer;-><init>()V
|
|
|
|
const/4 v7, 0x1
|
|
|
|
invoke-static {v7}, Lf/h/a/f/e/n/f;->k(Z)V
|
|
|
|
instance-of v7, v6, Lf/h/d/j;
|
|
|
|
if-eqz v7, :cond_0
|
|
|
|
move-object v7, v6
|
|
|
|
check-cast v7, Lf/h/d/j;
|
|
|
|
invoke-virtual {v4, v1, v7}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:cond_0
|
|
invoke-static {v1}, Lcom/google/gson/reflect/TypeToken;->get(Ljava/lang/reflect/Type;)Lcom/google/gson/reflect/TypeToken;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v7}, Lcom/google/gson/reflect/TypeToken;->getType()Ljava/lang/reflect/Type;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v7}, Lcom/google/gson/reflect/TypeToken;->getRawType()Ljava/lang/Class;
|
|
|
|
move-result-object v9
|
|
|
|
if-ne v8, v9, :cond_1
|
|
|
|
const/4 v8, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const/4 v8, 0x0
|
|
|
|
:goto_0
|
|
new-instance v9, Lf/h/d/u/y/m$c;
|
|
|
|
const/4 v10, 0x0
|
|
|
|
invoke-direct {v9, v6, v7, v8, v10}, Lf/h/d/u/y/m$c;-><init>(Ljava/lang/Object;Lcom/google/gson/reflect/TypeToken;ZLjava/lang/Class;)V
|
|
|
|
invoke-virtual {v5, v9}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
instance-of v7, v6, Lcom/google/gson/TypeAdapter;
|
|
|
|
if-eqz v7, :cond_2
|
|
|
|
invoke-static {v1}, Lcom/google/gson/reflect/TypeToken;->get(Ljava/lang/reflect/Type;)Lcom/google/gson/reflect/TypeToken;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v6, Lcom/google/gson/TypeAdapter;
|
|
|
|
invoke-static {v1, v6}, Lf/h/d/u/y/o;->a(Lcom/google/gson/reflect/TypeToken;Lcom/google/gson/TypeAdapter;)Lf/h/d/s;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v5, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_2
|
|
new-instance v1, Ljava/util/ArrayList;
|
|
|
|
move-object/from16 v18, v1
|
|
|
|
invoke-virtual {v5}, Ljava/util/ArrayList;->size()I
|
|
|
|
move-result v6
|
|
|
|
invoke-virtual {v3}, Ljava/util/ArrayList;->size()I
|
|
|
|
move-result v7
|
|
|
|
add-int/2addr v7, v6
|
|
|
|
add-int/lit8 v7, v7, 0x3
|
|
|
|
invoke-direct {v1, v7}, Ljava/util/ArrayList;-><init>(I)V
|
|
|
|
invoke-virtual {v1, v5}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z
|
|
|
|
invoke-static {v1}, Ljava/util/Collections;->reverse(Ljava/util/List;)V
|
|
|
|
new-instance v6, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v6, v3}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
|
|
|
|
invoke-static {v6}, Ljava/util/Collections;->reverse(Ljava/util/List;)V
|
|
|
|
invoke-virtual {v1, v6}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z
|
|
|
|
new-instance v15, Lcom/google/gson/Gson;
|
|
|
|
move-object v1, v15
|
|
|
|
const/4 v13, 0x0
|
|
|
|
const/4 v7, 0x0
|
|
|
|
move v6, v7
|
|
|
|
move v9, v7
|
|
|
|
move v11, v7
|
|
|
|
move v10, v7
|
|
|
|
const/4 v8, 0x1
|
|
|
|
const/16 v17, 0x2
|
|
|
|
move/from16 v14, v17
|
|
|
|
move-object/from16 v19, v15
|
|
|
|
move/from16 v15, v17
|
|
|
|
move-object/from16 v17, v3
|
|
|
|
move-object/from16 v3, v16
|
|
|
|
move-object/from16 v16, v5
|
|
|
|
move/from16 v5, p4
|
|
|
|
invoke-direct/range {v1 .. v18}, Lcom/google/gson/Gson;-><init>(Lf/h/d/u/o;Lf/h/d/d;Ljava/util/Map;ZZZZZZZLf/h/d/r;Ljava/lang/String;IILjava/util/List;Ljava/util/List;Ljava/util/List;)V
|
|
|
|
const-string v1, ""
|
|
|
|
if-eqz p5, :cond_3
|
|
|
|
const-string/jumbo v2, "v8/"
|
|
|
|
move-object/from16 v3, p3
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
move-object/from16 v3, p3
|
|
|
|
move-object v2, v1
|
|
|
|
:goto_1
|
|
invoke-static {v3, v2}, Lf/e/c/a/a;->q(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
sget-object v3, Lj0/y;->c:Lj0/y;
|
|
|
|
new-instance v4, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
new-instance v5, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v5}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
const-string v6, "client == null"
|
|
|
|
move-object/from16 v7, p1
|
|
|
|
invoke-static {v7, v6}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v6
|
|
|
|
check-cast v6, Lf0/f$a;
|
|
|
|
const-string v7, "factory == null"
|
|
|
|
invoke-static {v6, v7}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v6
|
|
|
|
check-cast v6, Lf0/f$a;
|
|
|
|
new-instance v8, Lj0/i0/a/i;
|
|
|
|
const/4 v9, 0x0
|
|
|
|
const/4 v10, 0x0
|
|
|
|
invoke-direct {v8, v9, v10}, Lj0/i0/a/i;-><init>(Lrx/Scheduler;Z)V
|
|
|
|
invoke-static {v8, v7}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v8
|
|
|
|
check-cast v8, Lj0/e$a;
|
|
|
|
invoke-virtual {v5, v8}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
new-instance v8, Lj0/j0/b/k;
|
|
|
|
invoke-direct {v8}, Lj0/j0/b/k;-><init>()V
|
|
|
|
invoke-static {v8, v7}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v8
|
|
|
|
check-cast v8, Lj0/h$a;
|
|
|
|
invoke-virtual {v4, v8}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
const-string v8, "application/json"
|
|
|
|
move-object/from16 v11, p6
|
|
|
|
invoke-static {v11, v8}, Lb0/n/c/j;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v8
|
|
|
|
if-eqz v8, :cond_4
|
|
|
|
new-instance v8, Lj0/j0/a/a;
|
|
|
|
move-object/from16 v11, v19
|
|
|
|
invoke-direct {v8, v11}, Lj0/j0/a/a;-><init>(Lcom/google/gson/Gson;)V
|
|
|
|
invoke-static {v8, v7}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v7
|
|
|
|
check-cast v7, Lj0/h$a;
|
|
|
|
invoke-virtual {v4, v7}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_4
|
|
const-string v7, "baseUrl == null"
|
|
|
|
invoke-static {v2, v7}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
const-string v8, "$this$toHttpUrl"
|
|
|
|
invoke-static {v2, v8}, Lb0/n/c/j;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v8, Lf0/y$a;
|
|
|
|
invoke-direct {v8}, Lf0/y$a;-><init>()V
|
|
|
|
invoke-virtual {v8, v9, v2}, Lf0/y$a;->e(Lf0/y;Ljava/lang/String;)Lf0/y$a;
|
|
|
|
invoke-virtual {v8}, Lf0/y$a;->b()Lf0/y;
|
|
|
|
move-result-object v13
|
|
|
|
invoke-static {v13, v7}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
iget-object v2, v13, Lf0/y;->g:Ljava/util/List;
|
|
|
|
invoke-interface {v2}, Ljava/util/List;->size()I
|
|
|
|
move-result v7
|
|
|
|
add-int/lit8 v7, v7, -0x1
|
|
|
|
invoke-interface {v2, v7}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_f
|
|
|
|
if-nez v6, :cond_5
|
|
|
|
new-instance v6, Lf0/z;
|
|
|
|
invoke-direct {v6}, Lf0/z;-><init>()V
|
|
|
|
:cond_5
|
|
move-object v12, v6
|
|
|
|
invoke-virtual {v3}, Lj0/y;->a()Ljava/util/concurrent/Executor;
|
|
|
|
move-result-object v1
|
|
|
|
new-instance v2, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v2, v5}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
|
|
|
|
new-instance v5, Lj0/i;
|
|
|
|
invoke-direct {v5, v1}, Lj0/i;-><init>(Ljava/util/concurrent/Executor;)V
|
|
|
|
iget-boolean v6, v3, Lj0/y;->a:Z
|
|
|
|
if-eqz v6, :cond_6
|
|
|
|
const/4 v6, 0x2
|
|
|
|
new-array v6, v6, [Lj0/e$a;
|
|
|
|
sget-object v7, Lj0/g;->a:Lj0/e$a;
|
|
|
|
aput-object v7, v6, v10
|
|
|
|
const/4 v7, 0x1
|
|
|
|
aput-object v5, v6, v7
|
|
|
|
invoke-static {v6}, Ljava/util/Arrays;->asList([Ljava/lang/Object;)Ljava/util/List;
|
|
|
|
move-result-object v5
|
|
|
|
goto :goto_2
|
|
|
|
:cond_6
|
|
const/4 v7, 0x1
|
|
|
|
invoke-static {v5}, Ljava/util/Collections;->singletonList(Ljava/lang/Object;)Ljava/util/List;
|
|
|
|
move-result-object v5
|
|
|
|
:goto_2
|
|
invoke-virtual {v2, v5}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z
|
|
|
|
new-instance v5, Ljava/util/ArrayList;
|
|
|
|
invoke-virtual {v4}, Ljava/util/ArrayList;->size()I
|
|
|
|
move-result v6
|
|
|
|
add-int/2addr v6, v7
|
|
|
|
iget-boolean v8, v3, Lj0/y;->a:Z
|
|
|
|
add-int/2addr v6, v8
|
|
|
|
invoke-direct {v5, v6}, Ljava/util/ArrayList;-><init>(I)V
|
|
|
|
new-instance v6, Lj0/c;
|
|
|
|
invoke-direct {v6}, Lj0/c;-><init>()V
|
|
|
|
invoke-virtual {v5, v6}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
invoke-virtual {v5, v4}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z
|
|
|
|
iget-boolean v3, v3, Lj0/y;->a:Z
|
|
|
|
if-eqz v3, :cond_7
|
|
|
|
sget-object v3, Lj0/u;->a:Lj0/h$a;
|
|
|
|
invoke-static {v3}, Ljava/util/Collections;->singletonList(Ljava/lang/Object;)Ljava/util/List;
|
|
|
|
move-result-object v3
|
|
|
|
goto :goto_3
|
|
|
|
:cond_7
|
|
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
|
|
|
|
move-result-object v3
|
|
|
|
:goto_3
|
|
invoke-virtual {v5, v3}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z
|
|
|
|
new-instance v3, Lj0/d0;
|
|
|
|
invoke-static {v5}, Ljava/util/Collections;->unmodifiableList(Ljava/util/List;)Ljava/util/List;
|
|
|
|
move-result-object v14
|
|
|
|
invoke-static {v2}, Ljava/util/Collections;->unmodifiableList(Ljava/util/List;)Ljava/util/List;
|
|
|
|
move-result-object v15
|
|
|
|
const/16 v17, 0x0
|
|
|
|
move-object v11, v3
|
|
|
|
move-object/from16 v16, v1
|
|
|
|
invoke-direct/range {v11 .. v17}, Lj0/d0;-><init>(Lf0/f$a;Lf0/y;Ljava/util/List;Ljava/util/List;Ljava/util/concurrent/Executor;Z)V
|
|
|
|
invoke-virtual/range {p2 .. p2}, Ljava/lang/Class;->isInterface()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_e
|
|
|
|
new-instance v1, Ljava/util/ArrayDeque;
|
|
|
|
invoke-direct {v1, v7}, Ljava/util/ArrayDeque;-><init>(I)V
|
|
|
|
invoke-virtual {v1, v0}, Ljava/util/ArrayDeque;->add(Ljava/lang/Object;)Z
|
|
|
|
:goto_4
|
|
invoke-virtual {v1}, Ljava/util/ArrayDeque;->isEmpty()Z
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_a
|
|
|
|
invoke-virtual {v1}, Ljava/util/ArrayDeque;->removeFirst()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Ljava/lang/Class;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Class;->getTypeParameters()[Ljava/lang/reflect/TypeVariable;
|
|
|
|
move-result-object v4
|
|
|
|
array-length v4, v4
|
|
|
|
if-eqz v4, :cond_9
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
const-string v3, "Type parameters are unsupported on "
|
|
|
|
invoke-direct {v1, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
if-eq v2, v0, :cond_8
|
|
|
|
const-string v2, " which is an interface of "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual/range {p2 .. p2}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
:cond_8
|
|
new-instance v0, Ljava/lang/IllegalArgumentException;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_9
|
|
invoke-virtual {v2}, Ljava/lang/Class;->getInterfaces()[Ljava/lang/Class;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v1, v2}, Ljava/util/Collections;->addAll(Ljava/util/Collection;[Ljava/lang/Object;)Z
|
|
|
|
goto :goto_4
|
|
|
|
:cond_a
|
|
iget-boolean v1, v3, Lj0/d0;->f:Z
|
|
|
|
if-eqz v1, :cond_d
|
|
|
|
sget-object v1, Lj0/y;->c:Lj0/y;
|
|
|
|
invoke-virtual/range {p2 .. p2}, Ljava/lang/Class;->getDeclaredMethods()[Ljava/lang/reflect/Method;
|
|
|
|
move-result-object v2
|
|
|
|
array-length v4, v2
|
|
|
|
const/4 v5, 0x0
|
|
|
|
:goto_5
|
|
if-ge v5, v4, :cond_d
|
|
|
|
aget-object v6, v2, v5
|
|
|
|
iget-boolean v8, v1, Lj0/y;->a:Z
|
|
|
|
if-eqz v8, :cond_b
|
|
|
|
invoke-virtual {v6}, Ljava/lang/reflect/Method;->isDefault()Z
|
|
|
|
move-result v8
|
|
|
|
if-eqz v8, :cond_b
|
|
|
|
const/4 v8, 0x1
|
|
|
|
goto :goto_6
|
|
|
|
:cond_b
|
|
const/4 v8, 0x0
|
|
|
|
:goto_6
|
|
if-nez v8, :cond_c
|
|
|
|
invoke-virtual {v6}, Ljava/lang/reflect/Method;->getModifiers()I
|
|
|
|
move-result v8
|
|
|
|
invoke-static {v8}, Ljava/lang/reflect/Modifier;->isStatic(I)Z
|
|
|
|
move-result v8
|
|
|
|
if-nez v8, :cond_c
|
|
|
|
invoke-virtual {v3, v6}, Lj0/d0;->b(Ljava/lang/reflect/Method;)Lj0/e0;
|
|
|
|
:cond_c
|
|
add-int/lit8 v5, v5, 0x1
|
|
|
|
goto :goto_5
|
|
|
|
:cond_d
|
|
invoke-virtual/range {p2 .. p2}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;
|
|
|
|
move-result-object v1
|
|
|
|
new-array v2, v7, [Ljava/lang/Class;
|
|
|
|
aput-object v0, v2, v10
|
|
|
|
new-instance v4, Lj0/c0;
|
|
|
|
invoke-direct {v4, v3, v0}, Lj0/c0;-><init>(Lj0/d0;Ljava/lang/Class;)V
|
|
|
|
invoke-static {v1, v2, v4}, Ljava/lang/reflect/Proxy;->newProxyInstance(Ljava/lang/ClassLoader;[Ljava/lang/Class;Ljava/lang/reflect/InvocationHandler;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
|
|
:cond_e
|
|
new-instance v0, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string v1, "API declarations must be interfaces."
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_f
|
|
new-instance v0, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "baseUrl must end in /: "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static synthetic buildApi$default(Lcom/discord/restapi/RestAPIBuilder;Lf0/z;Ljava/lang/Class;Ljava/lang/String;ZZLjava/lang/String;ILjava/lang/Object;)Ljava/lang/Object;
|
|
.locals 7
|
|
|
|
and-int/lit8 p7, p7, 0x8
|
|
|
|
if-eqz p7, :cond_0
|
|
|
|
const/4 p4, 0x0
|
|
|
|
const/4 v4, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move v4, p4
|
|
|
|
:goto_0
|
|
move-object v0, p0
|
|
|
|
move-object v1, p1
|
|
|
|
move-object v2, p2
|
|
|
|
move-object v3, p3
|
|
|
|
move v5, p5
|
|
|
|
move-object v6, p6
|
|
|
|
invoke-direct/range {v0 .. v6}, Lcom/discord/restapi/RestAPIBuilder;->buildApi(Lf0/z;Ljava/lang/Class;Ljava/lang/String;ZZLjava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private final buildOkHttpClient(Ljava/lang/Long;Ljava/util/List;)Lf0/z;
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/Long;",
|
|
"Ljava/util/List<",
|
|
"+",
|
|
"Lokhttp3/Interceptor;",
|
|
">;)",
|
|
"Lf0/z;"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Lf0/z$a;
|
|
|
|
invoke-direct {v0}, Lf0/z$a;-><init>()V
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
invoke-interface {p2}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p2
|
|
|
|
:goto_0
|
|
invoke-interface {p2}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-interface {p2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lokhttp3/Interceptor;
|
|
|
|
const-string v2, "interceptor"
|
|
|
|
invoke-static {v1, v2}, Lb0/n/c/j;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
iget-object v2, v0, Lf0/z$a;->c:Ljava/util/List;
|
|
|
|
invoke-interface {v2, v1}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
if-eqz p1, :cond_1
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v1
|
|
|
|
sget-object p2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-virtual {v0, v1, v2, p2}, Lf0/z$a;->a(JLjava/util/concurrent/TimeUnit;)Lf0/z$a;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v1
|
|
|
|
sget-object p2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
const-string/jumbo v3, "unit"
|
|
|
|
invoke-static {p2, v3}, Lb0/n/c/j;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string/jumbo v4, "timeout"
|
|
|
|
invoke-static {v4, v1, v2, p2}, Lf0/h0/c;->d(Ljava/lang/String;JLjava/util/concurrent/TimeUnit;)I
|
|
|
|
move-result p2
|
|
|
|
iput p2, v0, Lf0/z$a;->A:I
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide p1
|
|
|
|
sget-object v1, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-static {v1, v3}, Lb0/n/c/j;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-static {v4, p1, p2, v1}, Lf0/h0/c;->d(Ljava/lang/String;JLjava/util/concurrent/TimeUnit;)I
|
|
|
|
move-result p1
|
|
|
|
iput p1, v0, Lf0/z$a;->y:I
|
|
|
|
:cond_1
|
|
iget-object p1, p0, Lcom/discord/restapi/RestAPIBuilder;->cookieJar:Lf0/q;
|
|
|
|
const-string p2, "cookieJar"
|
|
|
|
invoke-static {p1, p2}, Lb0/n/c/j;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
iput-object p1, v0, Lf0/z$a;->j:Lf0/q;
|
|
|
|
new-instance p1, Lf0/z;
|
|
|
|
invoke-direct {p1, v0}, Lf0/z;-><init>(Lf0/z$a;)V
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public static synthetic buildOkHttpClient$default(Lcom/discord/restapi/RestAPIBuilder;Ljava/lang/Long;Ljava/util/List;ILjava/lang/Object;)Lf0/z;
|
|
.locals 1
|
|
|
|
and-int/lit8 p4, p3, 0x1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p4, :cond_0
|
|
|
|
move-object p1, v0
|
|
|
|
:cond_0
|
|
and-int/lit8 p3, p3, 0x2
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
move-object p2, v0
|
|
|
|
:cond_1
|
|
invoke-direct {p0, p1, p2}, Lcom/discord/restapi/RestAPIBuilder;->buildOkHttpClient(Ljava/lang/Long;Ljava/util/List;)Lf0/z;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final build(Ljava/lang/Class;ZJLjava/util/List;Ljava/lang/String;ZLjava/lang/String;)Ljava/lang/Object;
|
|
.locals 7
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/lang/Class<",
|
|
"TT;>;ZJ",
|
|
"Ljava/util/List<",
|
|
"+",
|
|
"Lokhttp3/Interceptor;",
|
|
">;",
|
|
"Ljava/lang/String;",
|
|
"Z",
|
|
"Ljava/lang/String;",
|
|
")TT;"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "apiDefinition"
|
|
|
|
invoke-static {p1, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "contentType"
|
|
|
|
invoke-static {p8, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-static {p3, p4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-direct {p0, p3, p5}, Lcom/discord/restapi/RestAPIBuilder;->buildOkHttpClient(Ljava/lang/Long;Ljava/util/List;)Lf0/z;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz p6, :cond_0
|
|
|
|
sget-object p3, Lcom/discord/restapi/RestAPIBuilder;->clientCallback:Lkotlin/jvm/functions/Function2;
|
|
|
|
invoke-interface {p3, p6, v1}, Lkotlin/jvm/functions/Function2;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:cond_0
|
|
iget-object v3, p0, Lcom/discord/restapi/RestAPIBuilder;->baseApiUrl:Ljava/lang/String;
|
|
|
|
move-object v0, p0
|
|
|
|
move-object v2, p1
|
|
|
|
move v4, p2
|
|
|
|
move v5, p7
|
|
|
|
move-object v6, p8
|
|
|
|
invoke-direct/range {v0 .. v6}, Lcom/discord/restapi/RestAPIBuilder;->buildApi(Lf0/z;Ljava/lang/Class;Ljava/lang/String;ZZLjava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|