Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the v1 vanity API #31

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }
Comment on lines +114 to +117
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nit, but it should be... based on convention

Suggested change
public async setContentVanityURL (contentGUID: string, vanityURL: string): Promise<VanityRecordResponse> {
return await this.client.put(
`v1/content/${contentGUID}/vanity`,
{ path: vanityURL }
public async setContentVanityURL (contentGuid: string, vanityUrl: string): Promise<VanityRecordResponse> {
return await this.client.put(
`v1/content/${contentGuid}/vanity`,
{ path: vanityUrl }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local convention uses names like baseURL and already used vanityURL. There are a couple "GUID" references and they're appGuid, but many appID. I did not notice the appGuid and thought I was following convention by uppercasing initialisms (URL, GUID).

@meatballhat - do you have a preference on naming convention?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no worries then. Should keep it as is if the rest of the project is using that by convention.

).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
}