Skip to content

Commit 6c3e24a

Browse files
committed
update client api
1 parent 29a1be4 commit 6c3e24a

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

client-api.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55
```typescript
66
export class Client {
77
readonly context: ExecutionContext;
8+
89
getValue<T>(name: string): Promise<T | undefined>;
910
saveValue(name: string, value: any): Promise<void>;
10-
getCollection(name: string, destinationPath: string): Promise<void>;
11-
saveCollection(name: string, directoryPath: string): Promise<void>;
11+
getDirectory(name: string, destinationPath: string): Promise<void>;
12+
saveDirectory(name: string, directoryPath: string): Promise<void>;
13+
getFile(name: string, destinationPath: string): Promise<void>;
14+
saveFile(name: string, filePath: string): Promise<void>;
15+
1216
report(report: CodeChecksReport): Promise<void>;
1317
success(report: CodeChecksReportBody): Promise<void>;
1418
failure(report: CodeChecksReportBody): Promise<void>;
19+
1520
isPr(): boolean;
21+
1622
getArtifactLink(path: string): string;
1723
getPageLink(dirPath: string, filenamePath?: string): string;
1824
}
@@ -74,15 +80,25 @@ undefined when no value was saved.
7480

7581
Save JSON value with a given name for **current** commit.
7682

77-
### getCollection(name: string, destinationPath: string): Promise<void>;
83+
### getDirectory(name: string, destinationPath: string): Promise<void>;
7884

79-
Get collection (directory of files) with a given name for **base** branch and save all of them to
85+
Get directory (set of files) with a given name for **base** branch and save all of them to
8086
destinationPath. `destinationPath` needs to be absolute path (for now).
8187

82-
### saveCollection(name: string, directoryPath: string): Promise<void>;
88+
### saveDirectory(name: string, directoryPath: string): Promise<void>;
89+
90+
Save a directory (set of files) placed in `directoryPath` for \*current\*\* commit. All files will
91+
be saved under the common `name`. Nested files will be saved as well. `destinationPath` needs to be
92+
absolute path (for now).
93+
94+
### getFile(name: string, destinationPath: string): Promise<void>;
95+
96+
Get a single file with a given name for **base** branch and save it locally.
97+
98+
### saveFile(name: string, filePath: string): Promise<void> {
8399

84-
Saves collection (directory of files) with a given name places in `directoryPath` for \*current\*\*
85-
commit. `destinationPath` needs to be absolute path (for now).
100+
Save a single file placed in `directoryPath` for \*current\*\* commit and use `name` as a name.
101+
`filePath` needs to be absolute path.
86102

87103
### report(report: CodeChecksReport): Promise<void>;
88104

@@ -131,4 +147,4 @@ Get link to the page artifact for **current commit**. Difference between `getArt
131147
this link will be pointing to a URL without path component for example:
132148
`https://commitsha--path/artifacts.codechecks.io/filenamePath` This works because `dirPath` and
133149
commit sha is encoded into subdomain part. It's very useful when hosting SPA with custom routing. In
134-
future we might support here custom redirects to improve it even more.
150+
the future we might support here custom redirects to improve it even more.

0 commit comments

Comments
 (0)