Exemplo n.º 1
0
        public async Task <ObjectList> ListObjectsAsync(Bucket bucket, ListObjectsOptions listObjectsOptions)
        {
            var listObjectsOptionsSWIG = listObjectsOptions.ToSWIG();

            _listOptions.Add(listObjectsOptionsSWIG);

            using (SWIG.UplinkObjectIterator objectIterator = await Task.Run(() => SWIG.storj_uplink.uplink_list_objects(_access._project, bucket.Name, listObjectsOptionsSWIG)))
            {
                using (SWIG.UplinkError error = SWIG.storj_uplink.uplink_object_iterator_err(objectIterator))
                {
                    if (error != null && !string.IsNullOrEmpty(error.message))
                    {
                        throw new BucketListException(error.message);
                    }
                }

                ObjectList objectList = new ObjectList();

                while (SWIG.storj_uplink.uplink_object_iterator_next(objectIterator))
                {
                    using (var objectResult = SWIG.storj_uplink.uplink_object_iterator_item(objectIterator))
                    {
                        objectList.Items.Add(uplink.NET.Models.Object.FromSWIG(objectResult, true));
                    }
                }
                return(objectList);
            }
        }
Exemplo n.º 2
0
        internal static ObjectList FromSWIG(SWIG.UplinkObjectIterator iterator)
        {
            ObjectList ret = new ObjectList();

            ret.Items = new List <Object>();

            while (SWIG.storj_uplink.uplink_object_iterator_next(iterator))
            {
                ret.Items.Add(Object.FromSWIG(SWIG.storj_uplink.uplink_object_iterator_item(iterator)));
            }

            return(ret);
        }