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

Custom tracking #164

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 17 additions & 5 deletions src/client/AccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default class AccountClient extends BaseClient {
/**
* Trigger Domain DKIM key verification.
*
* @param id - The ID of the Domain you wish to trigger DKIM verification for.
* @param id - The ID of the Domain you wish to trigger verification for.
* @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
* @returns A promise that will complete when the API responds (or an error occurs).
*/
Expand All @@ -168,9 +168,9 @@ export default class AccountClient extends BaseClient {
}

/**
* Trigger Domain DKIM key verification.
* Trigger Domain Return Path verification.
*
* @param id - The ID of the Domain you wish to trigger DKIM verification for.
* @param id - The ID of the Domain you wish to trigger verification for.
* @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
* @returns A promise that will complete when the API responds (or an error occurs).
*/
Expand All @@ -179,7 +179,19 @@ export default class AccountClient extends BaseClient {
}

/**
* Trigger Domain DKIM key verification.
* Trigger Domain Custom Tracking verification.
*
* @param id - The ID of the Domain you wish to trigger verification for.
* @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
* @returns A promise that will complete when the API responds (or an error occurs).
*/
public verifyDomainCustomTracking(id: number, callback?: Callback<DomainDetails>): Promise<DomainDetails> {
return this.processRequestWithoutBody(ClientOptions.HttpMethod.PUT, `/domains/${id}/verifyCustomTracking`, {}, callback);
}


/**
* Trigger Domain SPF key verification.
*
* @param id - The ID of the Domain you wish to trigger DKIM verification for.
* @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
Expand All @@ -190,7 +202,7 @@ export default class AccountClient extends BaseClient {
}

/**
* Trigger Domain DKIM key verification.
* Trigger Domain DKIM rotation
*
* @param id - The ID of the Domain you wish to trigger DKIM verification for.
* @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
Expand Down
12 changes: 9 additions & 3 deletions src/client/models/domains/Domain.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
export class CreateDomainRequest {

public Name: string;
public ReturnPathDomain?: string;
constructor(Name: string, ReturnPathDomain?: string) {
public CustomTrackingDomain?: string;
constructor(Name: string, ReturnPathDomain?: string, CustomTrackingDomain?: string) {
this.Name = Name;
this.ReturnPathDomain = ReturnPathDomain;
this.CustomTrackingDomain = CustomTrackingDomain;
}
}

export class UpdateDomainRequest {
public ReturnPathDomain?: string;
constructor(ReturnPathDomain: string) {
public CustomTrackingDomain?: string;
constructor(ReturnPathDomain: string, CustomTrackingDomain?: string) {
this.ReturnPathDomain = ReturnPathDomain;
this.CustomTrackingDomain = CustomTrackingDomain;
}
}

Expand All @@ -22,6 +25,7 @@ export interface Domain {
DKIMVerified: boolean;
WeakDKIM: boolean;
ReturnPathDomainVerified: boolean;
CustomTrackingVerified: boolean;
}

export interface DomainDetails extends Domain {
Expand All @@ -37,6 +41,8 @@ export interface DomainDetails extends Domain {
DKIMUpdateStatus: string;
ReturnPathDomain: string;
ReturnPathDomainCNAMEValue: string;
CustomTrackingDomain: string;
CustomTrackingDomainCNAMEValue: string;
}

export interface Domains {
Expand Down
6 changes: 6 additions & 0 deletions test/integration/Domains.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ describe("Client - Domains", () => {
const response = await client.verifyDomainReturnPath(domain.ID);
expect(response.ID).to.eq(domain.ID);
});

it("verifyDomainCustomTracking", async () => {
const domain = await client.createDomain(domainToTest());
const response = await client.verifyDomainCustomTracking(domain.ID);
expect(response.ID).to.eq(domain.ID);
});
});