Skip to content

Commit

Permalink
Merge pull request #434 from mailgun/update-domains-type
Browse files Browse the repository at this point in the history
breaking: Update domains client to use v4 of API
  • Loading branch information
olexandr-mazepa authored Jan 9, 2025
2 parents 3cddf54 + a2efc8c commit 009065a
Show file tree
Hide file tree
Showing 15 changed files with 2,134 additions and 613 deletions.
520 changes: 374 additions & 146 deletions README.md

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions dist/Classes/Domains/domain.d.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import { DNSRecord, DomainData, DomainShortData, TDomain } from '../../Types/Domains';
import { DNSRecord, DomainData, TDomain } from '../../Types/Domains';
export default class Domain implements TDomain {
name: string;
require_tls: boolean;
skip_verification: boolean;
state: string;
wildcard: boolean;
spam_action: string;
created_at: string;
created_at: Date;
smtp_password: string;
smtp_login: string;
type: string;
receiving_dns_records: DNSRecord[] | null;
sending_dns_records: DNSRecord[] | null;
id?: string;
is_disabled?: boolean;
web_prefix?: string;
web_scheme?: string;
constructor(data: DomainShortData | DomainData, receiving?: DNSRecord[] | null, sending?: DNSRecord[] | null);
id: string;
is_disabled: boolean;
web_prefix: string;
web_scheme: string;
use_automatic_sender_security: boolean;
dkim_host?: string;
mailfrom_host?: string;
constructor(data: DomainData, receiving?: DNSRecord[] | null, sending?: DNSRecord[] | null);
}
33 changes: 29 additions & 4 deletions dist/Classes/Domains/domainsClient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import Request from '../common/Request';
import DomainCredentialsClient from './domainsCredentials';
import DomainTemplatesClient from './domainsTemplates';
import DomainTagsClient from './domainsTags';
import { MessageResponse, DomainTrackingData, UpdatedOpenTracking, DomainsQuery, DomainInfo, ConnectionSettings, UpdatedConnectionSettings, OpenTrackingInfo, ClickTrackingInfo, UnsubscribeTrackingInfo, ReplacementForPool, DKIMAuthorityInfo, UpdatedDKIMAuthority, DKIMSelectorInfo, UpdatedDKIMSelectorResponse, WebPrefixInfo, UpdatedWebPrefixResponse, TDomain, DomainUpdateInfo } from '../../Types/Domains';
import { MessageResponse, DomainTrackingData, UpdatedOpenTracking, DomainsQuery, DomainInfo, ConnectionSettings, UpdatedConnectionSettings, OpenTrackingInfo, ClickTrackingInfo, UnsubscribeTrackingInfo, ReplacementForPool, DKIMAuthorityInfo, UpdatedDKIMAuthority, DKIMSelectorInfo, WebPrefixInfo, UpdatedWebPrefixResponse, TDomain, DomainUpdateInfo, DomainGetQuery, UpdatedDKIMSelectorResult } from '../../Types/Domains';
import { ILogger } from '../../Interfaces';
export default class DomainsClient implements IDomainsClient {
request: Request;
domainCredentials: IDomainCredentials;
domainTemplates: IDomainTemplatesClient;
domainTags: IDomainTagsClient;
constructor(request: Request, domainCredentialsClient: DomainCredentialsClient, domainTemplatesClient: DomainTemplatesClient, domainTagsClient: DomainTagsClient);
private logger;
constructor(request: Request, domainCredentialsClient: DomainCredentialsClient, domainTemplatesClient: DomainTemplatesClient, domainTagsClient: DomainTagsClient, logger?: ILogger);
private _handleBoolValues;
private _parseMessage;
private parseDomainList;
private _parseDomain;
private _parseTrackingSettings;
private _parseTrackingUpdate;
private _isOpenTrackingInfoWitPlace;
list(query?: DomainsQuery): Promise<TDomain[]>;
get(domain: string): Promise<TDomain>;
get(domain: string, query?: DomainGetQuery): Promise<TDomain>;
create(data: DomainInfo): Promise<TDomain>;
update(domain: string, data: DomainUpdateInfo): Promise<TDomain>;
verify(domain: string): Promise<TDomain>;
Expand All @@ -27,12 +30,34 @@ export default class DomainsClient implements IDomainsClient {
updateConnection(domain: string, data: ConnectionSettings): Promise<UpdatedConnectionSettings>;
getTracking(domain: string): Promise<DomainTrackingData>;
updateTracking(domain: string, type: string, data: OpenTrackingInfo | ClickTrackingInfo | UnsubscribeTrackingInfo): Promise<UpdatedOpenTracking>;
/**
* @deprecated "domains.getIps" method is deprecated, and will be removed in the future releases.
*/
getIps(domain: string): Promise<string[]>;
/**
* @deprecated "domains.assignIp" method is deprecated, and will be removed in the future releases.
*/
assignIp(domain: string, ip: string): Promise<APIResponse>;
/**
* @deprecated "domains.deleteIp" method is deprecated, and will be moved to the IpsClient.
*/
deleteIp(domain: string, ip: string): Promise<APIResponse>;
/**
* @deprecated "domains.linkIpPool" method is deprecated, and will be removed
* in the future releases.
*/
linkIpPool(domain: string, poolId: string): Promise<APIResponse>;
/**
* @deprecated "domains.unlinkIpPoll" method is deprecated, and will be moved into the IpsClient
* in the future releases.
*/
unlinkIpPoll(domain: string, replacement: ReplacementForPool): Promise<APIResponse>;
updateDKIMAuthority(domain: string, data: DKIMAuthorityInfo): Promise<UpdatedDKIMAuthority>;
updateDKIMSelector(domain: string, data: DKIMSelectorInfo): Promise<UpdatedDKIMSelectorResponse>;
updateDKIMSelector(domain: string, data: DKIMSelectorInfo): Promise<UpdatedDKIMSelectorResult>;
/**
* @deprecated "domains.updateWebPrefix" method is deprecated.
* Please use domains.update to set new "web_prefix".
* Current method will be removed in the future releases.
*/
updateWebPrefix(domain: string, data: WebPrefixInfo): Promise<UpdatedWebPrefixResponse>;
}
6 changes: 3 additions & 3 deletions dist/Interfaces/Domains/DomainsClient.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { APIResponse } from '../../Types/Common';
import { ClickTrackingInfo, ConnectionSettings, DKIMAuthorityInfo, DKIMSelectorInfo, DomainInfo, DomainsQuery, DomainTrackingData, DomainUpdateInfo, MessageResponse, OpenTrackingInfo, ReplacementForPool, TDomain, UnsubscribeTrackingInfo, UpdatedConnectionSettings, UpdatedDKIMAuthority, UpdatedDKIMSelectorResponse, UpdatedOpenTracking, UpdatedWebPrefixResponse, WebPrefixInfo } from '../../Types/Domains';
import { ClickTrackingInfo, ConnectionSettings, DKIMAuthorityInfo, DKIMSelectorInfo, DomainGetQuery, DomainInfo, DomainsQuery, DomainTrackingData, DomainUpdateInfo, MessageResponse, OpenTrackingInfo, ReplacementForPool, TDomain, UnsubscribeTrackingInfo, UpdatedConnectionSettings, UpdatedDKIMAuthority, UpdatedDKIMSelectorResult, UpdatedOpenTracking, UpdatedWebPrefixResponse, WebPrefixInfo } from '../../Types/Domains';
import { IDomainCredentials } from './DomainCredentials';
import { IDomainTagsClient } from './DomainTags';
import { IDomainTemplatesClient } from './DomainTemplates';
Expand All @@ -8,7 +8,7 @@ export interface IDomainsClient {
domainTemplates: IDomainTemplatesClient;
domainTags: IDomainTagsClient;
list(query?: DomainsQuery): Promise<TDomain[]>;
get(domain: string): Promise<TDomain>;
get(domain: string, query?: DomainGetQuery): Promise<TDomain>;
create(data: DomainInfo): Promise<TDomain>;
update(domain: string, data: DomainUpdateInfo): Promise<TDomain>;
verify(domain: string): Promise<TDomain>;
Expand All @@ -23,6 +23,6 @@ export interface IDomainsClient {
linkIpPool(domain: string, pool_id: string): Promise<APIResponse>;
unlinkIpPoll(domain: string, replacement: ReplacementForPool): Promise<APIResponse>;
updateDKIMAuthority(domain: string, data: DKIMAuthorityInfo): Promise<UpdatedDKIMAuthority>;
updateDKIMSelector(domain: string, data: DKIMSelectorInfo): Promise<UpdatedDKIMSelectorResponse>;
updateDKIMSelector(domain: string, data: DKIMSelectorInfo): Promise<UpdatedDKIMSelectorResult>;
updateWebPrefix(domain: string, data: WebPrefixInfo): Promise<UpdatedWebPrefixResponse>;
}
Loading

0 comments on commit 009065a

Please sign in to comment.