Table of Contents

Class JenkinsPipelineArtifactsApiConnector

Namespace
MES.MQC.DataSourceLibrary.Adapters.Apis
Assembly
MES.MQC.DataSourceLibrary.dll
public class JenkinsPipelineArtifactsApiConnector : ApiConnector, IFormProvider
Inheritance
JenkinsPipelineArtifactsApiConnector
Implements
Inherited Members

Properties

Description

Description of the Adapter that is visible in the Adapter Dialog as a popover. If the adapter is an API Connector, the description is also shown in the Add/Edit DataSource dialog, when the API Connector is selected. Absolute links get transformed into HTML Link Tags, line breaks (\n) get transformed into HTML line breaks (<br>), HTML tags are not allowed.

public override string Description { get; }

Property Value

string

Name

Unique Name of the Adapter. Defaults to the ClassName (without Adapter / FileReader / ApiConnector suffix), can be overridden with a user defined Name.

public override string Name { get; }

Property Value

string

Methods

CheckAvailable(ApiConnectorContext)

CheckAvailable must be implemented by the Api Adapter class. This method is called to show a warning for configured but unavailable data sources in the UI.

public override bool CheckAvailable(ApiConnectorContext context)

Parameters

context ApiConnectorContext

ApiConnectorContext

Returns

bool

boolean (is the api available/accessible)

CheckModified(ApiConnectorContext)

CheckModified must be implemented by the Api Adapter class. This method is called by the local and server side monitoring, to check if the data sources should be updated.

public override bool CheckModified(ApiConnectorContext context)

Parameters

context ApiConnectorContext

ApiConnectorContext

Returns

bool

boolean (are there any changes)

ConfigureForm(IForm, string[])

ConfigureForm can be implemented by an API adapter. It is used to modify the FormSchema of the Add/Edit DataSource dialog for the AdapterConfiguration depending on the values entered (e.g. to make options or input fields visible and/or deactivate them based on a correct API request). It is called for the initial creation of the FormSchema with all fields as modified and when a field that was enabled by RefreshOnModified has been changed by the user. This method should also validate the configuration, not if the schema is valid, but if the values are usable (e.g. if the api is accessible and the authentification is valid).

public override FormError[] ConfigureForm(IForm form, string[] modifiedFields)

Parameters

form IForm

IForm, the AdapterConfiguration

modifiedFields string[]

Array of the modified fields as string (Form-Subfields as field.field or field.index.field)

Returns

FormError[]

Array of FormError, if a validation failed

Download(ApiConnectorContext)

Download can be implemented by the Api Adapter class. At least one of Download and Read must be implemented. The implementation of this method should access the configured API, download and save files to the context.DownloadPath directory and return a AdapterDownloadResult.

protected override AdapterDownloadResult Download(ApiConnectorContext context)

Parameters

context ApiConnectorContext

ApiConnectorContext

Returns

AdapterDownloadResult

AdapterDownloadResult

GetClient(ApiConnectorContext, bool)

protected RestClient GetClient(ApiConnectorContext context, bool checkAuth = false)

Parameters

context ApiConnectorContext
checkAuth bool

Returns

RestClient

GetClient(JenkinsPipelineArtifactsConfiguration, out List<FormError>, bool)

protected RestClient GetClient(JenkinsPipelineArtifactsApiConnector.JenkinsPipelineArtifactsConfiguration configuration, out List<FormError> errors, bool checkAuth = false)

Parameters

configuration JenkinsPipelineArtifactsApiConnector.JenkinsPipelineArtifactsConfiguration
errors List<FormError>
checkAuth bool

Returns

RestClient

GetFilterDateRange(JenkinsPipelineArtifactsConfiguration, ApiConnectorContext, out long?, out long?, out DateTime?, out DateTime?)

protected void GetFilterDateRange(JenkinsPipelineArtifactsApiConnector.JenkinsPipelineArtifactsConfiguration configuration, ApiConnectorContext context, out long? unixStartDate, out long? unixEndDate, out DateTime? startDate, out DateTime? endDate)

Parameters

configuration JenkinsPipelineArtifactsApiConnector.JenkinsPipelineArtifactsConfiguration
context ApiConnectorContext
unixStartDate long?
unixEndDate long?
startDate DateTime?
endDate DateTime?

LoadBuilds(JenkinsPipelineArtifactsConfiguration, RestClient, out DateTime, ApiConnectorContext, int?)

protected JenkinsPipelineArtifactsApiConnector.JenkinsBuild[] LoadBuilds(JenkinsPipelineArtifactsApiConnector.JenkinsPipelineArtifactsConfiguration configuration, RestClient client, out DateTime responseDateTime, ApiConnectorContext context = null, int? limit = null)

Parameters

configuration JenkinsPipelineArtifactsApiConnector.JenkinsPipelineArtifactsConfiguration
client RestClient
responseDateTime DateTime
context ApiConnectorContext
limit int?

Returns

JenkinsBuild[]

LoadBuildsForJob(RestClient, string, long?, long?, int?)

protected List<JenkinsPipelineArtifactsApiConnector.JenkinsBuild> LoadBuildsForJob(RestClient client, string jobName, long? unixStartDate = null, long? unixEndDate = null, int? limit = null)

Parameters

client RestClient
jobName string
unixStartDate long?
unixEndDate long?
limit int?

Returns

List<JenkinsPipelineArtifactsApiConnector.JenkinsBuild>

LoadJobNames(RestClient)

protected string[] LoadJobNames(RestClient client)

Parameters

client RestClient

Returns

string[]

PreviewForm(IForm, string, out int)

PreviewForm can be implemented by an API Connector. It is used to load the Preview, if one was defined in the AdapterConfiguration. Based on the focused form field, the Preview is shown in the Dialog and provides the ability to load by clicking on a button. This button click calls this method. Based on the configuration and the preview type, the api should load the relevant data, limited to ~100 for better performance, and a array of FormPreview should be returned.

public override FormPreview[] PreviewForm(IForm form, string preview, out int totalCount)

Parameters

form IForm

IForm, the AdapterConfiguration

preview string

The preview type (string)

totalCount int

Output of totalCount, if 0 shown as ? in the preview dialog

Returns

FormPreview[]

Array of FormPreview, to show Title and optionally Description and DateTime