Ejemplo n.º 1
0
        private async Task <ContentItemModel> CreateConversationItem(string conversationId)
        {
            ContentItemModel       responseItem;
            ContentItemCreateModel item = new ContentItemCreateModel
            {
                Name       = conversationId,
                Type       = ContentTypeIdentifier.ByCodename("conversation"),
                ExternalId = conversationId
            };

            responseItem = await managementClient.CreateContentItemAsync(item);

            return(responseItem);
        }
Ejemplo n.º 2
0
        internal static async Task <ContentItemModel> PrepareTestItem(ContentManagementClient client, string typeCodename, string externalId = null)
        {
            var type = ContentTypeIdentifier.ByCodename(typeCodename);

            if (externalId != null)
            {
                // We use upsert for preparing item by external ID in order to be able to recover from situation when previous test run didn't clean up properly
                var item = new ContentItemUpsertModel()
                {
                    Name = "Hooray!",
                    Type = type,
                };

                return(await client.UpsertContentItemByExternalIdAsync(externalId, item));
            }
            else
            {
                var item = new ContentItemCreateModel()
                {
                    Name = "Hooray!",
                    Type = type,
                };

                return(await client.CreateContentItemAsync(item));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a basic content item with the supplied content name
        /// </summary>
        /// <param name="documentName"></param>
        /// <returns></returns>
        public async Task <string> CreateItemAsync(string documentName)
        {
            var item = new ContentItemCreateModel
            {
                Name = documentName,
                Type = ContentTypeIdentifier.ByCodename("simple_page")
            };

            var itemResult = await _managementClient.CreateContentItemAsync(item);

            return(itemResult.CodeName);
        }
Ejemplo n.º 4
0
        static ContentItemModel CreateNewContentItem(string codename, string type)
        {
            ContentItemCreateModel newitem = new ContentItemCreateModel()
            {
                Name = codename,
                Type = ContentTypeIdentifier.ByCodename(type)
            };

            Task <ContentItemModel> createtask = clientCM.CreateContentItemAsync(newitem);

            return(createtask.GetAwaiter().GetResult());
        }