Skip to content

Commit

Permalink
use v1 vanity API rather than unversioned API
Browse files Browse the repository at this point in the history
available in all supported Connect versions
  • Loading branch information
aronatkins committed Jun 21, 2024
1 parent 7151f20 commit 761cea0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
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 761cea0

Please sign in to comment.