Table of Contents

Class StructurizrClient

Namespace
C4.Net.Api
Assembly
C4.Net.Client.dll

A client for the Structurizr API (https://api.structurizr.com) that allows you to get and put Structurizr workspaces in a JSON format.

public class StructurizrClient
Inheritance
StructurizrClient
Inherited Members

Constructors

StructurizrClient(string, string)

Creates a new Structurizr API client with the specified API key and secret, for the default API URL(https://api.structurizr.com).

public StructurizrClient(string apiKey, string apiSecret)

Parameters

apiKey string

The API key of your workspace.

apiSecret string

The API secret of your workspace.

StructurizrClient(string, string, string)

Creates a new Structurizr client with the specified API URL, key and secret.

public StructurizrClient(string apiUrl, string apiKey, string apiSecret)

Parameters

apiUrl string

The URL of your Structurizr instance.

apiKey string

The API key of your workspace.

apiSecret string

The API secret of your workspace.

Fields

IdGenerator

The ID generator to use when parsing a JSON workspace definition.

public IdGenerator IdGenerator

Field Value

IdGenerator

Properties

ApiKey

Supplies the workspace API key used for authenticated requests.

public string ApiKey { get; set; }

Property Value

string

Exceptions

ArgumentException

Thrown when the assigned value is null, empty, or whitespace.

ApiSecret

Supplies the workspace API secret used for request signing.

public string ApiSecret { get; set; }

Property Value

string

Exceptions

ArgumentException

Thrown when the assigned value is null, empty, or whitespace.

EncryptionStrategy

Encrypts outgoing workspaces and decrypts incoming ones when client-side encryption is enabled.

public EncryptionStrategy EncryptionStrategy { get; set; }

Property Value

EncryptionStrategy

MergeFromRemote

Controls whether remote layout and view configuration should be merged before uploads.

public bool MergeFromRemote { get; set; }

Property Value

bool

Url

Specifies the base URL of the Structurizr API instance to communicate with.

public string Url { get; set; }

Property Value

string

Exceptions

ArgumentException

Thrown when the assigned value is null, empty, or whitespace.

WorkspaceArchiveLocation

the location where a copy of the workspace will be archived when it is retrieved from the server

public DirectoryInfo WorkspaceArchiveLocation { get; set; }

Property Value

DirectoryInfo

Methods

GetWorkspace(long)

Gets the workspace with the given ID.

public Workspace GetWorkspace(long workspaceId)

Parameters

workspaceId long

The workspace ID.

Returns

Workspace

A Workspace object.

LockWorkspace(long)

Locks the specified workspace.

public bool LockWorkspace(long workspaceId)

Parameters

workspaceId long

The workspace ID.

Returns

bool

true if the workspace could be locked, false otherwise.

PutWorkspace(long, Workspace)

Updates the given workspace.

public void PutWorkspace(long workspaceId, Workspace workspace)

Parameters

workspaceId long

The workspace ID.

workspace Workspace

The workspace to be updated.

UnlockWorkspace(long)

Unlocks the specified workspace.

public bool UnlockWorkspace(long workspaceId)

Parameters

workspaceId long

The workspace ID.

Returns

bool

true if the workspace could be unlocked, false otherwise.

createHttpClient()

Creates the HttpClient instance used for API calls.

protected virtual HttpClient createHttpClient()

Returns

HttpClient

A new HTTP client.