51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import type { IGitLabVariable, IGitLabPipelineVariable } from './gitlab.interfaces.js';
|
|
|
|
export class GitLabVariable {
|
|
public readonly key: string;
|
|
public readonly value: string;
|
|
public readonly variableType: string;
|
|
public readonly protected: boolean;
|
|
public readonly masked: boolean;
|
|
public readonly environmentScope: string;
|
|
|
|
constructor(raw: IGitLabVariable) {
|
|
this.key = raw.key || '';
|
|
this.value = raw.value || '';
|
|
this.variableType = raw.variable_type || 'env_var';
|
|
this.protected = raw.protected ?? false;
|
|
this.masked = raw.masked ?? false;
|
|
this.environmentScope = raw.environment_scope || '*';
|
|
}
|
|
|
|
toJSON(): IGitLabVariable {
|
|
return {
|
|
key: this.key,
|
|
value: this.value,
|
|
variable_type: this.variableType,
|
|
protected: this.protected,
|
|
masked: this.masked,
|
|
environment_scope: this.environmentScope,
|
|
};
|
|
}
|
|
}
|
|
|
|
export class GitLabPipelineVariable {
|
|
public readonly key: string;
|
|
public readonly value: string;
|
|
public readonly variableType: string;
|
|
|
|
constructor(raw: IGitLabPipelineVariable) {
|
|
this.key = raw.key || '';
|
|
this.value = raw.value || '';
|
|
this.variableType = raw.variable_type || 'env_var';
|
|
}
|
|
|
|
toJSON(): IGitLabPipelineVariable {
|
|
return {
|
|
key: this.key,
|
|
value: this.value,
|
|
variable_type: this.variableType,
|
|
};
|
|
}
|
|
}
|