예제 #1
0
        public static Control NewJsonFilesAction(this IMasonBuilderContext context, string name, string href, string jsonFile, string title = null, string description = null, string schema = null, Uri schemaUrl = null, object template = null, string method = "POST")
        {
            Control c = NewJsonAction(context, name, href, title, description, schema, schemaUrl, template, method);

            c.encoding = "json+files";
            c.jsonFile = jsonFile;
            return(c);
        }
예제 #2
0
 public static Control NewLinkTemplate(this IMasonBuilderContext context, string name, string template, string title = null, string description = null)
 {
     if (context.PreferMinimalResponse)
     {
         return(new Control(name, template, null, true));
     }
     else
     {
         return(new Control(name, template, title, true)
         {
             description = description
         });
     }
 }
예제 #3
0
 public static Control NewLink(this IMasonBuilderContext context, string name, string href, string title = null, string contentType = null)
 {
     if (context.PreferMinimalResponse)
     {
         return(new Control(name, href, null)
         {
             output = (contentType != null ? new string[] { contentType } : null)
         });
     }
     else
     {
         return(new Control(name, href, title)
         {
             output = (contentType != null ? new string[] { contentType } : null)
         });
     }
 }
예제 #4
0
 public static Control NewVoidAction(this IMasonBuilderContext context, string name, string href, string title = null, string description = null, string method = null)
 {
     if (context.PreferMinimalResponse)
     {
         return(new Control(name, href, null, false)
         {
             method = method
         });
     }
     else
     {
         return(new Control(name, href, title, false)
         {
             method = method,
             description = description
         });
     }
 }
예제 #5
0
        public static Control BuildIssueQueryTemplate(this IMasonBuilderContext masonContext, ICommunicationContext communicationContext)
        {
            string  issueQueryUrl      = communicationContext.ApplicationBaseUri.AbsoluteUri + "/" + UrlPaths.IssueQuery;
            Control issueQueryTemplate = masonContext.NewLinkTemplate(RelTypes.IssueQuery, issueQueryUrl, "Search for issues", "This is a simple search that do not check attachments.");

            if (!masonContext.PreferMinimalResponse)
            {
                issueQueryTemplate.schema = new
                {
                    properties = new
                    {
                        text = new
                        {
                            description = "Substring search for text in title and description",
                            type        = "string"
                        },
                        severity = new
                        {
                            description = "Issue severity (exact value, 1..5)",
                            type        = "string"
                        },
                        pid = new
                        {
                            description = "Project ID",
                            type        = "string"
                        }
                    }
                };
                // FIXME - schema
                //issueQueryTemplate.AddHrefTemplateParameter(new HrefTemplateParameter("text", description: "Substring search for text in title and description"));
                //issueQueryTemplate.AddHrefTemplateParameter(new HrefTemplateParameter("severity", description: "Issue severity (exact value, 1..5)"));
                //issueQueryTemplate.AddHrefTemplateParameter(new HrefTemplateParameter("pid", description: "Project ID"));
            }

            return(issueQueryTemplate);
        }
예제 #6
0
 public static Control NewJsonAction(this IMasonBuilderContext context, string name, string href, string title = null, string description = null, string schema = null, Uri schemaUrl = null, object template = null, string method = "POST")
 {
     if (context.PreferMinimalResponse)
     {
         return(new Control(name, href, null)
         {
             method = method,
             template = template,
             encoding = "json"
         });
     }
     else
     {
         return(new Control(name, href, title)
         {
             method = method,
             description = description,
             schema = schema,
             schemaUrl = (schemaUrl != null ? schemaUrl.AbsoluteUri : null),
             template = template,
             encoding = "json"
         });
     }
 }
예제 #7
0
 public static Control NewJsonFilesAction(this IMasonBuilderContext context, string name, Uri href, string jsonFile, string title = null, string description = null, string schema = null, Uri schemaUrl = null, object template = null, string method = "POST")
 {
     return(NewJsonFilesAction(context, name, href.AbsoluteUriNullable(), jsonFile, title, description, schema, schemaUrl, template, method));
 }
예제 #8
0
 public static Control NewLink(this IMasonBuilderContext context, string name, Uri href, string title = null, string contentType = null)
 {
     return(context.NewLink(name, href.AbsoluteUriNullable(), title, contentType));
 }
예제 #9
0
 public static Control NewVoidAction(this IMasonBuilderContext context, string name, Uri href, string title = null, string description = null, string method = null)
 {
     return(NewVoidAction(context, name, href.AbsoluteUriNullable(), title, description, method));
 }