export async function fetchCopyNumberSegments(studyId:string,
                                              sampleIds:string[],
                                              client:CBioPortalAPI = defaultClient)
{
    if (studyId && sampleIds.length > 0)
    {
        return await client.fetchCopyNumberSegmentsUsingPOST({
            sampleIdentifiers: sampleIds.map((sampleId: string) => ({
                sampleId,
                studyId
            })),
            projection: 'DETAILED',
        });
    }
    else {
        return [];
    }
}
export function fetchCopyNumberSegmentsForSamples(samples: Sample[],
                                                  chromosome?: string,
                                                  client:CBioPortalAPI = defaultClient): Promise<CopyNumberSeg[]>
{
    if (samples.length > 0)
    {
        return client.fetchCopyNumberSegmentsUsingPOST({
            sampleIdentifiers: samples.map(sample => ({
                sampleId: sample.sampleId,
                studyId: sample.studyId
            })),
            chromosome,
            projection: 'DETAILED',
        });
    }
    else {
        return Promise.resolve([]);
    }
}