Skip to content

Commit f8c96a1

Browse files
Add builder to create PagesCreateParameters
1 parent e9ad85f commit f8c96a1

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using System.Collections.Generic;
2+
3+
namespace Notion.Client
4+
{
5+
public class PagesCreateParametersBuilder
6+
{
7+
private IPageParent parent;
8+
private Dictionary<string, PropertyValue> properties = new Dictionary<string, PropertyValue>();
9+
private IList<Block> children = new List<Block>();
10+
private IPageIcon icon;
11+
private FileObject cover;
12+
13+
private PagesCreateParametersBuilder()
14+
{
15+
}
16+
17+
public static PagesCreateParametersBuilder Create(IPageParent parent)
18+
{
19+
return new PagesCreateParametersBuilder {
20+
parent = parent
21+
};
22+
}
23+
24+
public PagesCreateParametersBuilder AddProperty(string nameOrId, PropertyValue value)
25+
{
26+
properties[nameOrId] = value;
27+
return this;
28+
}
29+
30+
public PagesCreateParametersBuilder AddPageContent(Block block)
31+
{
32+
children.Add(block);
33+
return this;
34+
}
35+
36+
public PagesCreateParameters Build()
37+
{
38+
return new PagesCreateParameters
39+
{
40+
Parent = parent,
41+
Properties = properties,
42+
Children = children,
43+
Icon = icon,
44+
Cover = cover
45+
};
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)