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 authored Jun 21, 2024
2 parents bcf80b9 + a02dd24 commit efa94f0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 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/data

.PHONY: up
up: .require-license
Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
modulePathIgnorePatterns: ["./__tests__/data/"],
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
}

0 comments on commit efa94f0

Please sign in to comment.