package com.ss.android.ugc.aweme.library.api;

import X.0Gp;
import X.B29;
import X.BN5;
import X.JMA;
import X.M12;
import X.PUw;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.ugc.aweme.network.RetrofitFactory;
import com.ss.android.ugc.aweme.app.api.Api;
import kotlin.h.b.n;

public final class LibraryApi {
    public static final LibraryApi LIZ = new LibraryApi();
    public static final RealApi LIZIZ = ((RealApi) RetrofitFactory.LIZ().LIZ(Api.LIZLLL).LIZ(RealApi.class));

    public interface RealApi {
        static {
            Covode.recordClassIndex(90902);
        }

        @JMA(LIZ = "/tiktok/material/details/v1/")
        0Gp<B29> queryLibraryDetail(@PUw(LIZ = "library_material_id") String str);

        @JMA(LIZ = "/tiktok/material/videos/v1/")
        0Gp<BN5> queryLibraryVideos(@PUw(LIZ = "material_id") String str, @PUw(LIZ = "offset") int i, @PUw(LIZ = "count") int i2);
    }

    static {
        Covode.recordClassIndex(90901);
    }

    public final B29 LIZ(String str) {
        M12.LIZ(str);
        0Gp<B29> queryLibraryDetail = LIZIZ.queryLibraryDetail(str);
        try {
            queryLibraryDetail.LJFF();
        } catch (InterruptedException unused) {
        }
        if (queryLibraryDetail.LIZJ()) {
            try {
                Exception LJ = queryLibraryDetail.LJ();
                n.LIZIZ(LJ, "");
                throw LJ;
            } catch (Exception unused2) {
            }
        }
        Object LIZLLL = queryLibraryDetail.LIZLLL();
        n.LIZIZ(LIZLLL, "");
        return (B29) LIZLLL;
    }

    public final BN5 LIZ(String str, int i, int i2) {
        M12.LIZ(str);
        0Gp<BN5> queryLibraryVideos = LIZIZ.queryLibraryVideos(str, i, i2);
        try {
            queryLibraryVideos.LJFF();
        } catch (InterruptedException unused) {
        }
        if (queryLibraryVideos.LIZJ()) {
            try {
                Exception LJ = queryLibraryVideos.LJ();
                n.LIZIZ(LJ, "");
                throw LJ;
            } catch (Exception unused2) {
            }
        }
        Object LIZLLL = queryLibraryVideos.LIZLLL();
        n.LIZIZ(LIZLLL, "");
        return (BN5) LIZLLL;
    }
}
