Skip to content

Commit

Permalink
Consistent and more descriptive naming of parameters in index.ts (#1455)
Browse files Browse the repository at this point in the history
Parameter naming has been made more descriptive and consistent:
- Change `number: number` to `pipelineNumber: number`.
- Rename `pipeline` to `pipelineNumber` when it refered to a pipeline number.
  • Loading branch information
smainz authored Jan 15, 2023
1 parent 1cd73f0 commit b0fd99e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions web/src/lib/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,44 +71,44 @@ export default class WoodpeckerClient extends ApiClient {

// Deploy triggers a deployment for an existing pipeline using the
// specified target environment.
deployPipeline(owner: string, repo: string, number: number, options: DeploymentOptions): Promise<Pipeline> {
deployPipeline(owner: string, repo: string, pipelineNumber: number, options: DeploymentOptions): Promise<Pipeline> {
const vars = {
...options.variables,
event: 'deployment',
deploy_to: options.environment,
};
const query = encodeQueryString(vars);
return this._post(`/api/repos/${owner}/${repo}/pipelines/${number}?${query}`) as Promise<Pipeline>;
return this._post(`/api/repos/${owner}/${repo}/pipelines/${pipelineNumber}?${query}`) as Promise<Pipeline>;
}

getPipelineList(owner: string, repo: string, opts?: Record<string, string | number | boolean>): Promise<Pipeline[]> {
const query = encodeQueryString(opts);
return this._get(`/api/repos/${owner}/${repo}/pipelines?${query}`) as Promise<Pipeline[]>;
}

getPipeline(owner: string, repo: string, number: number | 'latest'): Promise<Pipeline> {
return this._get(`/api/repos/${owner}/${repo}/pipelines/${number}`) as Promise<Pipeline>;
getPipeline(owner: string, repo: string, pipelineNumber: number | 'latest'): Promise<Pipeline> {
return this._get(`/api/repos/${owner}/${repo}/pipelines/${pipelineNumber}`) as Promise<Pipeline>;
}

getPipelineConfig(owner: string, repo: string, number: number): Promise<PipelineConfig[]> {
return this._get(`/api/repos/${owner}/${repo}/pipelines/${number}/config`) as Promise<PipelineConfig[]>;
getPipelineConfig(owner: string, repo: string, pipelineNumber: number): Promise<PipelineConfig[]> {
return this._get(`/api/repos/${owner}/${repo}/pipelines/${pipelineNumber}/config`) as Promise<PipelineConfig[]>;
}

getPipelineFeed(opts?: Record<string, string | number | boolean>): Promise<PipelineFeed[]> {
const query = encodeQueryString(opts);
return this._get(`/api/user/feed?${query}`) as Promise<PipelineFeed[]>;
}

cancelPipeline(owner: string, repo: string, number: number): Promise<unknown> {
return this._post(`/api/repos/${owner}/${repo}/pipelines/${number}/cancel`);
cancelPipeline(owner: string, repo: string, pipelineNumber: number): Promise<unknown> {
return this._post(`/api/repos/${owner}/${repo}/pipelines/${pipelineNumber}/cancel`);
}

approvePipeline(owner: string, repo: string, pipeline: string): Promise<unknown> {
return this._post(`/api/repos/${owner}/${repo}/pipelines/${pipeline}/approve`);
approvePipeline(owner: string, repo: string, pipelineNumber: string): Promise<unknown> {
return this._post(`/api/repos/${owner}/${repo}/pipelines/${pipelineNumber}/approve`);
}

declinePipeline(owner: string, repo: string, pipeline: string): Promise<unknown> {
return this._post(`/api/repos/${owner}/${repo}/pipelines/${pipeline}/decline`);
declinePipeline(owner: string, repo: string, pipelineNumber: string): Promise<unknown> {
return this._post(`/api/repos/${owner}/${repo}/pipelines/${pipelineNumber}/decline`);
}

restartPipeline(
Expand Down

0 comments on commit b0fd99e

Please sign in to comment.