Example #1
0
        private static async Task CreateAppIfNotExistsAsync()
        {
            try
            {
                var apps = ClientManager.CreateAppsClient();

                await apps.PostAppAsync(new CreateAppDto
                {
                    Name = TestAppName
                });
            }
            catch (SquidexManagementException ex)
            {
                if (ex.StatusCode != 400)
                {
                    throw;
                }
            }
        }
Example #2
0
        public static async Task SetupAsync()
        {
            var apps = ClientManager.CreateAppsClient();

            try
            {
                await apps.PostAppAsync(new CreateAppDto
                {
                    Name = AppName
                });

                var schemas = ClientManager.CreateSchemasClient();

                await schemas.PostSchemaAsync(AppName, new CreateSchemaDto
                {
                    Name   = SchemaName,
                    Fields = new List <UpsertSchemaFieldDto>
                    {
                        new UpsertSchemaFieldDto
                        {
                            Name       = FieldValue,
                            Properties = new NumberFieldPropertiesDto()
                        },
                        new UpsertSchemaFieldDto
                        {
                            Name       = FieldText,
                            Properties = new StringFieldPropertiesDto()
                        }
                    },
                    IsPublished = true
                });
            }
            catch (SquidexManagementException ex)
            {
                if (ex.StatusCode != 400)
                {
                    throw;
                }
            }
        }