public static async Task DeleteAllResources(this FhirClient client, ResourceType resourceType, string searchUrl)
        {
            Bundle bundle = null;

            while (bundle == null || bundle.NextLink != null)
            {
                bundle = bundle == null ? await client.SearchAsync(resourceType, searchUrl, count : 100) : await client.SearchAsync(bundle.NextLink.ToString());

                foreach (Bundle.EntryComponent entry in bundle.Entry)
                {
                    using var response = await client.DeleteAsync(entry.FullUrl);
                }
            }
        }
Exemple #2
0
        public static async Task DeleteAllResources(this FhirClient client, ResourceType resourceType, string searchUrl)
        {
            while (true)
            {
                Bundle bundle = await client.SearchAsync(resourceType, searchUrl, count : 100);

                if (!bundle.Entry.Any())
                {
                    break;
                }

                foreach (Bundle.EntryComponent entry in bundle.Entry)
                {
                    await client.DeleteAsync(entry.FullUrl);
                }
            }
        }