package retrofit2; import java.util.Objects; import javax.annotation.Nullable; import okhttp3.Protocol; import okhttp3.a0; import okhttp3.h0; import okhttp3.j0; import okhttp3.k0; import retrofit2.l; /* compiled from: Response */ public final class r<T> { private final j0 a; @Nullable /* renamed from: b reason: collision with root package name */ private final T f8234b; @Nullable /* renamed from: c reason: collision with root package name */ private final k0 f8235c; private r(j0 j0Var, @Nullable T t, @Nullable k0 k0Var) { this.a = j0Var; this.f8234b = t; this.f8235c = k0Var; } public static <T> r<T> a(@Nullable T t) { return a((Object) t, new j0.a().a(200).a("OK").a(Protocol.HTTP_1_1).a(new h0.a().b("http://localhost/").a()).a()); } public int b() { return this.a.e(); } @Nullable public k0 c() { return this.f8235c; } public a0 d() { return this.a.g(); } public boolean e() { return this.a.i(); } public String f() { return this.a.j(); } public j0 g() { return this.a; } public String toString() { return this.a.toString(); } public static <T> r<T> a(int i, @Nullable T t) { if (i >= 200 && i < 300) { return a((Object) t, new j0.a().a(i).a("Response.success()").a(Protocol.HTTP_1_1).a(new h0.a().b("http://localhost/").a()).a()); } throw new IllegalArgumentException("code < 200 or >= 300: " + i); } public static <T> r<T> a(@Nullable T t, a0 a0Var) { Objects.requireNonNull(a0Var, "headers == null"); return a((Object) t, new j0.a().a(200).a("OK").a(Protocol.HTTP_1_1).a(a0Var).a(new h0.a().b("http://localhost/").a()).a()); } public static <T> r<T> a(@Nullable T t, j0 j0Var) { Objects.requireNonNull(j0Var, "rawResponse == null"); if (j0Var.i()) { return new r<>(j0Var, t, null); } throw new IllegalArgumentException("rawResponse must be successful response"); } public static <T> r<T> a(int i, k0 k0Var) { Objects.requireNonNull(k0Var, "body == null"); if (i >= 400) { return a(k0Var, new j0.a().a(new l.c(k0Var.e(), k0Var.d())).a(i).a("Response.error()").a(Protocol.HTTP_1_1).a(new h0.a().b("http://localhost/").a()).a()); } throw new IllegalArgumentException("code < 400: " + i); } public static <T> r<T> a(k0 k0Var, j0 j0Var) { Objects.requireNonNull(k0Var, "body == null"); Objects.requireNonNull(j0Var, "rawResponse == null"); if (!j0Var.i()) { return new r<>(j0Var, null, k0Var); } throw new IllegalArgumentException("rawResponse should not be successful response"); } @Nullable public T a() { return this.f8234b; } }