Example #1
0
        public void CreateMethod(CodeWriter cw, ServiceInfo info, OperationInfo operationInfo, Dossier dossier)
        {
            cw.LineStart();
            cw.Write($@"{operationInfo.Name}(");


            bool first = true;

            foreach (IParameterInfo parameterInfo in operationInfo.Parameters)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    cw.WriteLine(", ");
                    cw.LineStart();
                }
                ITssParameterMold mold = ParameterMolds.Create(parameterInfo);
                if (mold == null)
                {
                    dossier.AddError("Mold not found.", parameterInfo);
                }
                else
                {
                    mold.DoCreateParameter(parameterInfo, cw);
                }
            }
            cw.Write(")");
            string typeName = TsUtility.GetTypeName(operationInfo.ResponseEntityInfo?.Name, "models");

            if (!string.IsNullOrEmpty(typeName))
            {
                cw.Write(": ");
                cw.Write(typeName);
            }
            cw.WriteLine();
        }
Example #2
0
 protected override string GetTypeName(ParentAttributeInfo field)
 {
     return(TsUtility.GetTypeName(field.ParentEntityInfo?.Name, ""));
 }
Example #3
0
 protected virtual string GetTypeName(T field)
 {
     return(TsUtility.GetTypeName("", ""));
 }
Example #4
0
 protected override void DoWriteAttributes(ChildAttributeInfo field, CodeWriter cw)
 {
     cw.WriteLine($@"@JsonProperty(""{field.JsonName}"", [{TsUtility.GetTypeName(field.ChildEntityInfo?.Name, "")}])");
 }
Example #5
0
 protected override string GetTypeName(ChildAttributeInfo field)
 {
     return(TsUtility.GetTypeName(field.ChildEntityInfo?.Name, "") + "[]");
 }
Example #6
0
 protected override string GetTypeName(EntityParameterInfo field)
 {
     return(TsUtility.GetTypeName(field.EntityInfo?.Name, "models"));
 }
Example #7
0
 protected override string GetTypeName(MultipleParameterInfo field)
 {
     return(TsUtility.GetTypeName(field.ParentServiceInfo?.Name, "models"));
 }