コード例 #1
0
        public static AssetDraft GetAssetDraft(ResourceIdentifier <Type> customType = null, Fields fields = null)
        {
            var rand        = RandomInt();
            var assetSource = GetAssetSource();

            var asset = new AssetDraft()
            {
                Key     = $"Asset-Key-{rand}",
                Sources = new List <AssetSource> {
                    assetSource
                },
                Name = new LocalizedString()
                {
                    { "en", $"Asset_Name_{rand}" }
                },
                Description = new LocalizedString()
                {
                    { "en", $"Asset_Description_{rand}" }
                },
                Tags = new List <string> {
                    $"Tag_{rand}_1", $"Tag_{rand}_2"
                }
            };

            if (customType != null && fields != null)
            {
                asset.Custom = new CustomFieldsDraft
                {
                    Type   = customType,
                    Fields = fields
                };
            }
            return(asset);
        }
コード例 #2
0
        public static AssetDraft GetAssetDraft()
        {
            var rand        = TestingUtility.RandomInt();
            var assetSource = GetAssetSource();

            var asset = new AssetDraft()
            {
                Key     = $"Asset-Key-{rand}",
                Sources = new List <AssetSource> {
                    assetSource
                },
                Name = new LocalizedString()
                {
                    { "en", $"Asset_Name_{rand}" }
                },
                Description = new LocalizedString()
                {
                    { "en", $"Asset_Description_{rand}" }
                },
                Tags = new List <string> {
                    $"Tag_{rand}_1", $"Tag_{rand}_2"
                }
            };

            return(asset);
        }
コード例 #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="asset">Asset</param>
        /// <param name="variantId">Variant ID</param>
        /// <param name="sku">Sku</param>
        public AddAssetAction(AssetDraft asset, int?variantId = null, string sku = null)
        {
            if (!variantId.HasValue && string.IsNullOrWhiteSpace(sku))
            {
                throw new ArgumentException("Either variantId or sku are required");
            }

            this.Action    = "addAsset";
            this.Asset     = asset;
            this.VariantId = variantId;
            this.Sku       = sku;
        }
 public AddAssetUpdateAction(int variantId, AssetDraft asset, int position, bool staged = true) : this(asset,
                                                                                                       position, staged)
 {
     this.VariantId = variantId;
 }
 public AddAssetUpdateAction(string sku, AssetDraft asset, int position, bool staged = true) : this(asset,
                                                                                                    position, staged)
 {
     this.Sku = sku;
 }
 private AddAssetUpdateAction(AssetDraft asset, int position, bool staged = true)
 {
     this.Asset    = asset;
     this.Position = position;
     this.Staged   = staged;
 }