1
1
import fs from 'fs' ;
2
2
import path from 'path' ;
3
3
import Gitee from '@gitee/typescript-sdk-v5' ;
4
- import { RepositoriesService } from '@gitee/typescript-sdk-v5/src/services.gen' ;
5
4
import { Release } from 'zotero-plugin-scaffold' ;
6
5
import loadConfig from './config' ;
7
6
@@ -30,9 +29,9 @@ async function main() {
30
29
}
31
30
32
31
async function rewriteRelease ( tag : string , name : string , body : string , prerelease = false ) {
33
- const old = await RepositoriesService . getV5ReposOwnerRepoReleasesTagsTag ( { owner, repo, tag } ) ;
32
+ const old = await Gitee . RepositoriesService . getV5ReposOwnerRepoReleasesTagsTag ( { owner, repo, tag } ) ;
34
33
if ( old ?. id )
35
- return RepositoriesService . patchV5ReposOwnerRepoReleasesId ( {
34
+ return Gitee . RepositoriesService . patchV5ReposOwnerRepoReleasesId ( {
36
35
owner,
37
36
repo,
38
37
name,
@@ -41,7 +40,7 @@ async function rewriteRelease(tag: string, name: string, body: string, prereleas
41
40
id : old . id ,
42
41
tagName : tag ,
43
42
} ) ;
44
- return RepositoriesService . postV5ReposOwnerRepoReleases ( {
43
+ return Gitee . RepositoriesService . postV5ReposOwnerRepoReleases ( {
45
44
owner,
46
45
repo,
47
46
name,
@@ -53,22 +52,22 @@ async function rewriteRelease(tag: string, name: string, body: string, prereleas
53
52
}
54
53
55
54
async function rewriteAttach ( releaseId : number , file : string ) {
56
- const assets = await RepositoriesService . getV5ReposOwnerRepoReleasesReleaseIdAttachFiles ( {
55
+ const assets = await Gitee . RepositoriesService . getV5ReposOwnerRepoReleasesReleaseIdAttachFiles ( {
57
56
owner,
58
57
repo,
59
58
releaseId,
60
59
} ) , fileBuffer = fs . readFileSync ( file ) ;
61
60
for ( const asset of assets )
62
61
if ( asset . name == path . basename ( file ) )
63
- await RepositoriesService
62
+ await Gitee . RepositoriesService
64
63
. deleteV5ReposOwnerRepoReleasesReleaseIdAttachFilesAttachFileId ( {
65
64
owner,
66
65
repo,
67
66
releaseId,
68
67
attachFileId : asset . id ! ,
69
68
} )
70
69
. catch ( console . error ) ;
71
- RepositoriesService . postV5ReposOwnerRepoReleasesReleaseIdAttachFiles ( {
70
+ Gitee . RepositoriesService . postV5ReposOwnerRepoReleasesReleaseIdAttachFiles ( {
72
71
owner,
73
72
repo,
74
73
releaseId,
0 commit comments