Table of Contents

Interface "ForNAV Source Control Provider V2"

Methods

Init

Initialises the provider by loading and validating the source control setup record.

procedure Init()

Remarks

Implementations must raise an error if required configuration fields are missing.

ListContentFromRemote

Returns the list of files and folders in a remote directory.

procedure ListContentFromRemote(var Content: JsonArray; Folder: Text): Boolean

Parameters

Name Type Description
Content JsonArray

Output JSON array. Each element has at minimum path, sha, and type fields.

Folder Text

Relative path of the remote folder to list.

Returns

Type Description
Boolean

true if the listing succeeded and Content was populated; false if the path does not exist.

GetContentFromRemote

Downloads a file's content and its current revision identifier from the remote.

procedure GetContentFromRemote(var FileContent: Text; Filename: Text; var Sha: Text): Boolean

Parameters

Name Type Description
FileContent Text

Output: decoded plain-text content of the file.

Filename Text

Relative path of the file to retrieve.

Sha Text

Output: revision identifier (blob SHA / objectId) used as a concurrency token for subsequent writes.

Returns

Type Description
Boolean

true if the file was retrieved successfully; false if the file does not exist.

StoreContentOnRemote

Creates or updates a file on the remote.

procedure StoreContentOnRemote(FileContent: Text; Filename: Text; CommitMessage: Text; var RemoteSha: Text; var Conflict: Boolean)

Parameters

Name Type Description
FileContent Text

Encoded file content to store (format is provider-specific, e.g. Base64 for GitHub).

Filename Text

Relative path of the file to create or update.

CommitMessage Text

Message for the resulting commit.

RemoteSha Text

In: current revision identifier; empty for a new file. Out: new revision identifier after a successful write.

Conflict Boolean

Set to true by the implementation if a conflict is detected (e.g. HTTP 409); otherwise unchanged.

DeleteContentOnRemote

Deletes a file on the remote.

procedure DeleteContentOnRemote(Filename: Text; CommitMessage: Text; RemoteSha: Text; var Conflict: Boolean)

Parameters

Name Type Description
Filename Text

Relative path of the file to delete.

CommitMessage Text

Message for the resulting commit.

RemoteSha Text

Current revision identifier of the file to delete.

Conflict Boolean

Set to true by the implementation if a conflict is detected; otherwise unchanged.

ListFromRemote

Retrieves a named list of resources from the remote (e.g. branches, repositories).

procedure ListFromRemote(Api: Text): JsonObject

Parameters

Name Type Description
Api Text

The resource type to list. Accepted values are implementation-specific.

Returns

Type Description
JsonObject

A JSON object whose shape depends on the requested resource type.

GetFromRemote

Retrieves a single named resource from the remote.

procedure GetFromRemote(Api: Text; Which: Text): JsonObject

Parameters

Name Type Description
Api Text

The resource type to retrieve. Accepted values are implementation-specific.

Which Text

The identifier of the resource (e.g. a branch name).

Returns

Type Description
JsonObject

A JSON object representing the requested resource.

StoreOnRemote

Creates or updates a resource on the remote via a structured API call.

procedure StoreOnRemote(Api: Text; Payload: JsonObject): JsonObject

Parameters

Name Type Description
Api Text

The resource type to store. Accepted values are implementation-specific.

Payload JsonObject

JSON object containing the data to store.

Returns

Type Description
JsonObject

A JSON object representing the server's response.

DeleteFromRemote

Deletes a resource on the remote via a structured API call.

procedure DeleteFromRemote(Api: Text; Payload: JsonObject): JsonObject

Parameters

Name Type Description
Api Text

The resource type to delete. Accepted values are implementation-specific.

Payload JsonObject

JSON object containing the identifier(s) of the resource to delete.

Returns

Type Description
JsonObject

A JSON object representing the server's response.

RemoteEnabled

Indicates whether the remote provider is fully configured and enabled.

procedure RemoteEnabled(): Boolean

Returns

Type Description
Boolean

true if the provider is configured and ready to communicate with the remote; false otherwise.

See also