Skip to content

Commit

Permalink
Merge pull request #31 from rstudio/aron-v1-vanity
Browse files Browse the repository at this point in the history
Use the v1 vanity API
  • Loading branch information
aronatkins committed Jun 21, 2024
2 parents bcf80b9 + a02dd24 commit 12d59d3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ clean:

.PHONY: distclean
distclean: clean
rm -rf __tests__/data/*
rm -rf .cache/

.PHONY: up
up: .require-license
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
modulePathIgnorePatterns: ["./__tests__/data/"],
modulePathIgnorePatterns: ["./.cache/"],
preset: 'ts-jest',
testEnvironment: 'node'
}
8 changes: 4 additions & 4 deletions src/APIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ export class APIClient {
.then((resp: AxiosResponse) => keysToCamel(resp.data))
}

public async updateAppVanityURL (appID: number, vanityURL: string): Promise<VanityRecordResponse> {
return await this.client.post(
`applications/${appID}/vanities`,
{ app_id: appID, path_prefix: vanityURL }
public async setContentVanityURL (contentGUID: string, vanityURL: string): Promise<VanityRecordResponse> {
return await this.client.put(
`v1/content/${contentGUID}/vanity`,
{ path: vanityURL }
).then((resp: AxiosResponse) => keysToCamel(resp.data))
}

Expand Down
2 changes: 1 addition & 1 deletion src/Deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class Deployer {
`path=${JSON.stringify(resolvedAppPath)}`
].join(' '))

await this.client.updateAppVanityURL(app.id, resolvedAppPath)
await this.client.setContentVanityURL(app.guid, resolvedAppPath)
.catch((err: any) => {
debugLog(() => [
'Deployer: failed to update vanity URL for',
Expand Down
8 changes: 3 additions & 5 deletions src/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ export interface ListApplicationsResponse {
}

export interface VanityRecordResponse {
id?: number
appId: number
appGuid: string
pathPrefix: string
createdTime?: Date
contentGuid: string
path: string
createdTime: Date
}
2 changes: 1 addition & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"exclude": ["node_modules", "__tests__/data/**/*", "lib/**/*"],
"exclude": ["node_modules", ".cache/**/*", "lib/**/*"],
"extends": "./tsconfig.json"
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"outDir": "./lib",
"resolveJsonModule": true
},
"exclude": ["node_modules", "__tests__/**/*.spec.ts", "__tests__/data/**/*", "lib/**/*"],
"exclude": ["node_modules", "__tests__/**/*.spec.ts", ".cache/**/*", "lib/**/*"],
"extends": "@tsconfig/node16/tsconfig.json"
}

0 comments on commit 12d59d3

Please sign in to comment.