discord-jadx/app/src/main/java/okhttp3/Response.java

206 lines
6.5 KiB
Java

package okhttp3;
import com.discord.models.domain.ModelAuditLogEntry;
import d0.z.d.m;
import f0.e0.g.c;
import f0.v;
import f0.y;
import java.io.Closeable;
import java.util.Objects;
import okhttp3.Headers;
/* compiled from: Response.kt */
/* loaded from: classes3.dex */
public final class Response implements Closeable {
public final Request j;
public final y k;
public final String l;
public final int m;
public final v n;
public final Headers o;
public final ResponseBody p;
public final Response q;
public final Response r;
/* renamed from: s reason: collision with root package name */
public final Response f3788s;
public final long t;
public final long u;
public final c v;
/* compiled from: Response.kt */
/* loaded from: classes3.dex */
public static class a {
public Request a;
/* renamed from: b reason: collision with root package name */
public y f3789b;
public int c;
public String d;
public v e;
public Headers.a f;
public ResponseBody g;
public Response h;
public Response i;
public Response j;
public long k;
public long l;
public c m;
public a() {
this.c = -1;
this.f = new Headers.a();
}
public a(Response response) {
m.checkParameterIsNotNull(response, "response");
this.c = -1;
this.a = response.j;
this.f3789b = response.k;
this.c = response.m;
this.d = response.l;
this.e = response.n;
this.f = response.o.e();
this.g = response.p;
this.h = response.q;
this.i = response.r;
this.j = response.f3788s;
this.k = response.t;
this.l = response.u;
this.m = response.v;
}
public Response a() {
int i = this.c;
if (i >= 0) {
Request request = this.a;
if (request != null) {
y yVar = this.f3789b;
if (yVar != null) {
String str = this.d;
if (str != null) {
return new Response(request, yVar, str, i, this.e, this.f.c(), this.g, this.h, this.i, this.j, this.k, this.l, this.m);
}
throw new IllegalStateException("message == null".toString());
}
throw new IllegalStateException("protocol == null".toString());
}
throw new IllegalStateException("request == null".toString());
}
StringBuilder R = b.d.b.a.a.R("code < 0: ");
R.append(this.c);
throw new IllegalStateException(R.toString().toString());
}
public a b(Response response) {
c("cacheResponse", response);
this.i = response;
return this;
}
public final void c(String str, Response response) {
if (response != null) {
boolean z2 = false;
if (response.p == null) {
if (response.q == null) {
if (response.r == null) {
if (response.f3788s == null) {
z2 = true;
}
if (!z2) {
throw new IllegalArgumentException(b.d.b.a.a.v(str, ".priorResponse != null").toString());
}
return;
}
throw new IllegalArgumentException(b.d.b.a.a.v(str, ".cacheResponse != null").toString());
}
throw new IllegalArgumentException(b.d.b.a.a.v(str, ".networkResponse != null").toString());
}
throw new IllegalArgumentException(b.d.b.a.a.v(str, ".body != null").toString());
}
}
public a d(Headers headers) {
m.checkParameterIsNotNull(headers, "headers");
this.f = headers.e();
return this;
}
public a e(String str) {
m.checkParameterIsNotNull(str, "message");
this.d = str;
return this;
}
public a f(y yVar) {
m.checkParameterIsNotNull(yVar, "protocol");
this.f3789b = yVar;
return this;
}
public a g(Request request) {
m.checkParameterIsNotNull(request, "request");
this.a = request;
return this;
}
}
public Response(Request request, y yVar, String str, int i, v vVar, Headers headers, ResponseBody responseBody, Response response, Response response2, Response response3, long j, long j2, c cVar) {
m.checkParameterIsNotNull(request, "request");
m.checkParameterIsNotNull(yVar, "protocol");
m.checkParameterIsNotNull(str, "message");
m.checkParameterIsNotNull(headers, "headers");
this.j = request;
this.k = yVar;
this.l = str;
this.m = i;
this.n = vVar;
this.o = headers;
this.p = responseBody;
this.q = response;
this.r = response2;
this.f3788s = response3;
this.t = j;
this.u = j2;
this.v = cVar;
}
public static String a(Response response, String str, String str2, int i) {
int i2 = i & 2;
Objects.requireNonNull(response);
m.checkParameterIsNotNull(str, ModelAuditLogEntry.CHANGE_KEY_NAME);
String c = response.o.c(str);
if (c != null) {
return c;
}
return null;
}
public final boolean b() {
int i = this.m;
return 200 <= i && 299 >= i;
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
ResponseBody responseBody = this.p;
if (responseBody != null) {
responseBody.close();
return;
}
throw new IllegalStateException("response is not eligible for a body and must not be closed".toString());
}
public String toString() {
StringBuilder R = b.d.b.a.a.R("Response{protocol=");
R.append(this.k);
R.append(", code=");
R.append(this.m);
R.append(", message=");
R.append(this.l);
R.append(", url=");
R.append(this.j.f3785b);
R.append('}');
return R.toString();
}
}