This repository has been archived by the owner on Dec 23, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 93
/
GettingStarted.cs
42 lines (33 loc) · 1.64 KB
/
GettingStarted.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Structurizr.Api;
namespace Structurizr.Examples
{
/// <summary>
/// A "getting started" example that illustrates how to
/// create a software architecture diagram using code.
///
/// The live workspace is available to view at https://structurizr.com/share/25441
/// </summary>
class GettingStarted
{
private const long WorkspaceId = 25441;
private const string ApiKey = "key";
private const string ApiSecret = "secret";
static void Main()
{
Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
Model model = workspace.Model;
Person user = model.AddPerson("User", "A user of my software system.");
SoftwareSystem softwareSystem = model.AddSoftwareSystem("Software System", "My software system.");
user.Uses(softwareSystem, "Uses");
ViewSet viewSet = workspace.Views;
SystemContextView contextView = viewSet.CreateSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
contextView.AddAllSoftwareSystems();
contextView.AddAllPeople();
Styles styles = viewSet.Configuration.Styles;
styles.Add(new ElementStyle(Tags.SoftwareSystem) { Background = "#1168bd", Color = "#ffffff" });
styles.Add(new ElementStyle(Tags.Person) { Background = "#08427b", Color = "#ffffff", Shape = Shape.Person });
StructurizrClient structurizrClient = new StructurizrClient(ApiKey, ApiSecret);
structurizrClient.PutWorkspace(WorkspaceId, workspace);
}
}
}