import qs from 'qs';

// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export default class MobileconfigApi {
    static async mobileConfigDoH(host?: string, client_id?: string): Promise<number | Error> {
        const queryParams = {
            host: host,
            client_id: client_id,
        }
        return await fetch(`/control/apple/doh.mobileconfig?${qs.stringify(queryParams, { arrayFormat: 'comma' })}`, {
            method: 'GET',
        }).then(async (res) => {
            if (res.status === 200) {
                return res.status;
            } else {
                return new Error(String(res.status));
            }
        })
    }

    static async mobileConfigDoT(host?: string, client_id?: string): Promise<number | Error> {
        const queryParams = {
            host: host,
            client_id: client_id,
        }
        return await fetch(`/control/apple/dot.mobileconfig?${qs.stringify(queryParams, { arrayFormat: 'comma' })}`, {
            method: 'GET',
        }).then(async (res) => {
            if (res.status === 200) {
                return res.status;
            } else {
                return new Error(String(res.status));
            }
        })
    }
}
