2021-08-03 07:33:18 +00:00
|
|
|
package c.i.c.m.d.n;
|
|
|
|
|
|
|
|
import c.c.a.y.b;
|
2021-10-15 06:18:26 +00:00
|
|
|
import c0.z.d.m;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.models.domain.ModelAuditLogEntry;
|
2021-10-15 06:18:26 +00:00
|
|
|
import e0.d;
|
|
|
|
import e0.e0.c;
|
|
|
|
import e0.e0.g.e;
|
|
|
|
import e0.w;
|
|
|
|
import e0.x;
|
2021-08-03 07:33:18 +00:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import okhttp3.MediaType;
|
|
|
|
import okhttp3.MultipartBody;
|
2021-08-10 21:19:22 +00:00
|
|
|
import okhttp3.Request;
|
2021-08-03 07:33:18 +00:00
|
|
|
import okhttp3.RequestBody;
|
|
|
|
import okhttp3.Response;
|
|
|
|
import okhttp3.ResponseBody;
|
|
|
|
/* compiled from: HttpRequest */
|
|
|
|
public class a {
|
|
|
|
public static final x a;
|
|
|
|
public final int b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-10-28 19:31:20 +00:00
|
|
|
public final String f1426c;
|
2021-08-03 07:33:18 +00:00
|
|
|
public final Map<String, String> d;
|
|
|
|
public final Map<String, String> e;
|
|
|
|
public MultipartBody.a f = null;
|
|
|
|
|
|
|
|
static {
|
|
|
|
x.a f = new x().f();
|
|
|
|
TimeUnit timeUnit = TimeUnit.MILLISECONDS;
|
|
|
|
m.checkParameterIsNotNull(timeUnit, "unit");
|
2021-10-29 07:19:59 +00:00
|
|
|
f.f3029w = c.b("timeout", 10000, timeUnit);
|
2021-08-03 07:33:18 +00:00
|
|
|
a = new x(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Incorrect types in method signature: (Ljava/lang/Object;Ljava/lang/String;Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;)V */
|
|
|
|
public a(int i, String str, Map map) {
|
|
|
|
this.b = i;
|
2021-10-28 19:31:20 +00:00
|
|
|
this.f1426c = str;
|
2021-08-03 07:33:18 +00:00
|
|
|
this.d = map;
|
|
|
|
this.e = new HashMap();
|
|
|
|
}
|
|
|
|
|
|
|
|
public c a() throws IOException {
|
|
|
|
w wVar;
|
2021-08-10 21:19:22 +00:00
|
|
|
Request.a aVar = new Request.a();
|
2021-08-03 07:33:18 +00:00
|
|
|
d dVar = new d(true, false, -1, -1, false, false, false, -1, -1, false, false, false, null, null);
|
|
|
|
m.checkParameterIsNotNull(dVar, "cacheControl");
|
|
|
|
String dVar2 = dVar.toString();
|
|
|
|
if (dVar2.length() == 0) {
|
|
|
|
aVar.d("Cache-Control");
|
|
|
|
} else {
|
|
|
|
aVar.b("Cache-Control", dVar2);
|
|
|
|
}
|
2021-10-28 19:31:20 +00:00
|
|
|
String str = this.f1426c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkParameterIsNotNull(str, "$this$toHttpUrlOrNull");
|
|
|
|
String str2 = null;
|
|
|
|
try {
|
|
|
|
m.checkParameterIsNotNull(str, "$this$toHttpUrl");
|
|
|
|
w.a aVar2 = new w.a();
|
|
|
|
aVar2.e(null, str);
|
|
|
|
wVar = aVar2.b();
|
|
|
|
} catch (IllegalArgumentException unused) {
|
|
|
|
wVar = null;
|
|
|
|
}
|
|
|
|
w.a f = wVar.f();
|
|
|
|
for (Map.Entry<String, String> entry : this.d.entrySet()) {
|
|
|
|
f.a(entry.getKey(), entry.getValue());
|
|
|
|
}
|
|
|
|
aVar.g(f.b());
|
|
|
|
for (Map.Entry<String, String> entry2 : this.e.entrySet()) {
|
|
|
|
aVar.b(entry2.getKey(), entry2.getValue());
|
|
|
|
}
|
|
|
|
MultipartBody.a aVar3 = this.f;
|
|
|
|
aVar.c(b.n(this.b), aVar3 == null ? null : aVar3.b());
|
|
|
|
Response execute = ((e) a.b(aVar.a())).execute();
|
|
|
|
ResponseBody responseBody = execute.o;
|
|
|
|
if (responseBody != null) {
|
|
|
|
str2 = responseBody.d();
|
|
|
|
}
|
|
|
|
return new c(execute.l, str2, execute.n);
|
|
|
|
}
|
|
|
|
|
|
|
|
public a b(String str, String str2) {
|
|
|
|
if (this.f == null) {
|
|
|
|
MultipartBody.a aVar = new MultipartBody.a();
|
|
|
|
aVar.c(MultipartBody.b);
|
|
|
|
this.f = aVar;
|
|
|
|
}
|
|
|
|
MultipartBody.a aVar2 = this.f;
|
|
|
|
Objects.requireNonNull(aVar2);
|
2021-08-09 22:51:56 +00:00
|
|
|
m.checkParameterIsNotNull(str, ModelAuditLogEntry.CHANGE_KEY_NAME);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkParameterIsNotNull(str2, "value");
|
2021-08-09 22:51:56 +00:00
|
|
|
m.checkParameterIsNotNull(str, ModelAuditLogEntry.CHANGE_KEY_NAME);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkParameterIsNotNull(str2, "value");
|
|
|
|
aVar2.a(MultipartBody.Part.b(str, null, RequestBody.Companion.a(str2, null)));
|
|
|
|
this.f = aVar2;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public a c(String str, String str2, String str3, File file) {
|
2021-10-29 07:19:59 +00:00
|
|
|
MediaType.a aVar = MediaType.f3124c;
|
2021-08-03 07:33:18 +00:00
|
|
|
RequestBody create = RequestBody.create(MediaType.a.b(str3), file);
|
|
|
|
if (this.f == null) {
|
|
|
|
MultipartBody.a aVar2 = new MultipartBody.a();
|
|
|
|
aVar2.c(MultipartBody.b);
|
|
|
|
this.f = aVar2;
|
|
|
|
}
|
|
|
|
MultipartBody.a aVar3 = this.f;
|
|
|
|
Objects.requireNonNull(aVar3);
|
2021-08-09 22:51:56 +00:00
|
|
|
m.checkParameterIsNotNull(str, ModelAuditLogEntry.CHANGE_KEY_NAME);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkParameterIsNotNull(create, "body");
|
|
|
|
aVar3.a(MultipartBody.Part.b(str, str2, create));
|
|
|
|
this.f = aVar3;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|