Transloadit.Assembly.AssemblyBuilder.SetField C# (CSharp) Method

SetField() public method

Sets a custom field in the current assembly
/// Thrown when an invalid (reserved) field key is tried to be used /// /// Thrown when an already defined key (in files or in fields) is tried to be used ///
public SetField ( string key, object value ) : void
key string Key of the field
value object Value of the field
return void
        public void SetField(string key, object value)
        {
            try
            {
                ValidateKey(key);
                if (files.ContainsKey(key))
                {
                    throw new Exceptions.AlreadyDefinedKeyException(key, "files");
                }
                fields[key] = value;
            }
            catch (Exceptions.InvalidFieldKeyException e)
            {
                LoggerFactory.GetLogger().LogError(this.GetType(), e);
                throw e;
            }
            catch (Exceptions.AlreadyDefinedKeyException e)
            {
                LoggerFactory.GetLogger().LogError(this.GetType(), e);
                throw e;
            }
        }

Usage Example

        public void AuthenticateWithExistingAccount()
        {
            ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY");
            IAssemblyBuilder assembly = new Transloadit.Assembly.AssemblyBuilder();
            IStep step = new Transloadit.Assembly.Step();

            step.SetOption("robot", "/image/resize");
            assembly.AddStep("step", step);
            assembly.SetField("test", "200");

            TransloaditResponse response = transloadit.InvokeAssembly(assembly);

            Assert.IsTrue((string)response.Data["ok"] == "ASSEMBLY_COMPLETED" || (string)response.Data["ok"] == "ASSEMBLY_EXECUTING");
        }
All Usage Examples Of Transloadit.Assembly.AssemblyBuilder::SetField