Copy() public method

Copies data with a specified data_id. Copies have their data_key cleared. The collection_id/collection_key parameter means that one can use either one of them - collection_id or collection_key. User API key usage permitted. Can copy only data that are in a container with a read_data permission (or read_own_data for Data Objects associated with current user). Target container also needs to have create_data permission.
public Copy ( CopyDataObjectRequest request ) : Task>
request Syncano.Net.DataRequests.CopyDataObjectRequest Request for querying DataObjects.
return Task>
        public async Task Copy_DataIdsListAndDataIdUsed_CreatesNewDataObject(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            var dataObject = await client.New(request);
            var dataIds = new List<string>();
            dataIds.Add(dataObject.Id);
            dataObject = await client.New(request);
            
            var copyRequest = new CopyDataObjectRequest();
            copyRequest.ProjectId = TestData.ProjectId;
            copyRequest.CollectionId = TestData.CollectionId;
            copyRequest.DataIds = dataIds;
            copyRequest.DataId = dataObject.Id;

            //when
            var result = await client.Copy(copyRequest);

            //then
            result.ShouldNotBeNull();
            result.Count.ShouldEqual(2);

            //cleanup
            var deleteRequest = new DataObjectSimpleQueryRequest();
            deleteRequest.ProjectId = TestData.ProjectId;
            deleteRequest.CollectionId = TestData.CollectionId;
            await client.Delete(deleteRequest);
        }
        public async Task Copy_WithNullProjectId_ThrowsException(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            var dataObject = await client.New(request);

            var copyRequest = new CopyDataObjectRequest();
            copyRequest.ProjectId = null;
            copyRequest.CollectionId = TestData.CollectionId;
            copyRequest.DataId = dataObject.Id;

            try
            {
                //when
                await client.Copy(copyRequest);
                throw new Exception("New should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType<ArgumentNullException>();
            }

            //cleanup
            var deleteRequest = new DataObjectSimpleQueryRequest();
            deleteRequest.ProjectId = TestData.ProjectId;
            deleteRequest.CollectionId = TestData.CollectionId;
            await client.Delete(deleteRequest);
        }
        public async Task Copy_ByCollectionId_CreatesNewDataObject(DataObjectSyncanoClient client)
        {
            //given
            var request = new DataObjectDefinitionRequest();
            request.ProjectId = TestData.ProjectId;
            request.CollectionId = TestData.CollectionId;
            var dataObject = await client.New(request);
            var copyRequest = new CopyDataObjectRequest();
            copyRequest.ProjectId = TestData.ProjectId;
            copyRequest.CollectionId = TestData.CollectionId;
            copyRequest.DataId = dataObject.Id;

            //when
            var result = await client.Copy(copyRequest);

            //then
            result.ShouldNotBeNull();
            result[0].Folder.ShouldEqual(request.Folder);
            result[0].Id.ShouldNotEqual(dataObject.Id);

            //cleanup
            var deleteRequest = new DataObjectSimpleQueryRequest();
            deleteRequest.ProjectId = TestData.ProjectId;
            deleteRequest.CollectionId = TestData.CollectionId;
            await client.Delete(deleteRequest);
        }