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

feature: Add support for Inbox Placements #419

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
10 changes: 10 additions & 0 deletions dist/Classes/InboxPlacements/AttributesClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IInboxPlacementsAttributesClient } from '../../Interfaces';
import { InboxPlacementsAttributesResult, InboxPlacementsValuesResult } from '../../Types/InboxPlacements';
import Request from '../common/Request';
export default class InboxPlacementsAttributesClient implements IInboxPlacementsAttributesClient {
request: Request;
path: string;
constructor(request: Request, path: string);
list(): Promise<InboxPlacementsAttributesResult>;
get(attributeName: string): Promise<InboxPlacementsValuesResult>;
}
9 changes: 9 additions & 0 deletions dist/Classes/InboxPlacements/FiltersClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { InboxPlacementsFiltersResult } from '../../Types/InboxPlacements';
import Request from '../common/Request';
import { IInboxPlacementsFiltersClient } from '../../Interfaces';
export default class InboxPlacementsFiltersClient implements IInboxPlacementsFiltersClient {
request: Request;
path: string;
constructor(request: Request, path: string);
list(): Promise<InboxPlacementsFiltersResult>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { IIPRSharingClient, IInboxPlacementsAttributesClient, IInboxPlacementsFiltersClient, IInboxPlacementsResultsClient, ILogger } from '../../../Interfaces';
import { InboxPlacementsDestroyResult, InboxPlacementsResultWithStatus, InboxPlacementsResultsList, InboxPlacementsResultsListAPIResponse, InboxPlacementsResultsQuery } from '../../../Types/InboxPlacements';
import NavigationThruPages from '../../common/NavigationThruPages';
import Request from '../../common/Request';
export default class InboxPlacementsResultsClient extends NavigationThruPages<InboxPlacementsResultsList> implements IInboxPlacementsResultsClient {
request: Request;
attributes: IInboxPlacementsAttributesClient;
filters: IInboxPlacementsFiltersClient;
sharing: IIPRSharingClient;
private logger;
constructor(request: Request, attributes: IInboxPlacementsAttributesClient, filters: IInboxPlacementsFiltersClient, sharing: IIPRSharingClient, logger?: ILogger);
private convertDateToUTC;
private prepareQueryData;
private prepareInboxPlacementsResult;
protected parseList(response: InboxPlacementsResultsListAPIResponse): InboxPlacementsResultsList;
list(query: InboxPlacementsResultsQuery): Promise<InboxPlacementsResultsList>;
get(id: string): Promise<InboxPlacementsResultWithStatus>;
destroy(id: string): Promise<InboxPlacementsDestroyResult>;
getResultByShareId(shareId: string): Promise<InboxPlacementsResultWithStatus>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { IInboxPlacementsAttributesClient, IInboxPlacementsFiltersClient, IInboxPlacementsResultsClient, ILogger } from '../../../Interfaces';
import { InboxPlacementsDestroyResult, InboxPlacementsResultWithStatus, InboxPlacementsResultsList, InboxPlacementsResultsListAPIResponse, InboxPlacementsResultsQuery } from '../../../Types/InboxPlacements';
import NavigationThruPages from '../../common/NavigationThruPages';
import Request from '../../common/Request';
export default class InboxPlacementsResultsClient extends NavigationThruPages<InboxPlacementsResultsList> implements IInboxPlacementsResultsClient {
request: Request;
attributes: IInboxPlacementsAttributesClient;
filters: IInboxPlacementsFiltersClient;
private logger;
constructor(request: Request, attributes: IInboxPlacementsAttributesClient, filters: IInboxPlacementsFiltersClient, logger?: ILogger);
private convertDateToUTC;
private prepareQueryData;
private prepareInboxPlacementsResult;
protected parseList(response: InboxPlacementsResultsListAPIResponse): InboxPlacementsResultsList;
list(query: InboxPlacementsResultsQuery): Promise<InboxPlacementsResultsList>;
get(id: string): Promise<InboxPlacementsResultWithStatus>;
destroy(id: string): Promise<InboxPlacementsDestroyResult>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {
IPRSharingResult,
IPRSharingUpdateData,
IPRSharingUpdateResult
} from '../../../Types/InboxPlacements';

export interface IIPRSharingClient {
get(id: string): Promise<IPRSharingResult>;
update(id: string, data: IPRSharingUpdateData): Promise<IPRSharingUpdateResult>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IIPRSharingClient } from '../../../Interfaces';
import { IPRSharingResult, IPRSharingUpdateData, IPRSharingUpdateResult } from '../../../Types/InboxPlacements';
import Request from '../../common/Request';
export default class IPRSharingClient implements IIPRSharingClient {
request: Request;
constructor(request: Request);
private prepareInboxPlacementsResultSharing;
get(id: string): Promise<IPRSharingResult & {
status: number;
}>;
update(id: string, data: IPRSharingUpdateData): Promise<IPRSharingUpdateResult & {
status: number;
}>;
}
10 changes: 10 additions & 0 deletions dist/Classes/InboxPlacements/SeedsLists/AttributesClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IInboxPlacementsAttributesClient } from '../../../Interfaces';
import { InboxPlacementsAttributesResult, InboxPlacementsValuesResult } from '../../../Types/InboxPlacements';
import Request from '../../common/Request';
export default class InboxPlacementsAttributesClient implements IInboxPlacementsAttributesClient {
request: Request;
path: string;
constructor(request: Request, path: string);
list(): Promise<InboxPlacementsAttributesResult>;
get(attributeName: string): Promise<InboxPlacementsValuesResult>;
}
8 changes: 8 additions & 0 deletions dist/Classes/InboxPlacements/SeedsLists/FiltersClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { SeedsListsFiltersResult } from '../../../Types/InboxPlacements';
import Request from '../../common/Request';
import { ISeedsListsFiltersClient } from '../../../Interfaces';
export default class SeedsListsFiltersClient implements ISeedsListsFiltersClient {
request: Request;
constructor(request: Request);
list(): Promise<SeedsListsFiltersResult>;
}
21 changes: 21 additions & 0 deletions dist/Classes/InboxPlacements/SeedsLists/SeedsListsClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ILogger, IInboxPlacementsAttributesClient, ISeedsListsClient, IInboxPlacementsFiltersClient } from '../../../Interfaces';
import { SeedsListsAPIResponse, SeedsListsCreatingData, SeedsListsQuery, SeedsListsResult, SeedsListsDestroyApiResponse, SeedsListsUpdatingData, SeedListResult } from '../../../Types/InboxPlacements';
import NavigationThruPages from '../../common/NavigationThruPages';
import Request from '../../common/Request';
export default class SeedsListsClient extends NavigationThruPages<SeedsListsResult> implements ISeedsListsClient {
request: Request;
attributes: IInboxPlacementsAttributesClient;
filters: IInboxPlacementsFiltersClient;
private logger;
constructor(request: Request, attributes: IInboxPlacementsAttributesClient, filters: IInboxPlacementsFiltersClient, logger?: ILogger);
private convertDateToUTC;
private prepareQueryData;
private prepareResult;
private prepareSeedList;
protected parseList(response: SeedsListsAPIResponse): SeedsListsResult;
list(query: SeedsListsQuery): Promise<SeedsListsResult>;
get(id: string): Promise<SeedListResult>;
create(data: SeedsListsCreatingData): Promise<SeedListResult>;
update(id: string, data: SeedsListsUpdatingData): Promise<SeedListResult>;
destroy(id: string): Promise<SeedsListsDestroyApiResponse>;
}
13 changes: 13 additions & 0 deletions dist/Classes/InboxPlacements/inboxPlacements.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IInboxPlacementsClient, IInboxPlacementsResultsClient } from '../../Interfaces';
import { ISeedsListsClient } from '../../Interfaces/InboxPlacements/SeedsLists/SeedsListsClient';
import { IInboxPlacementsProvidersClient } from '../../Interfaces/InboxPlacements/providers/InboxPlacementsProviders';
import { InboxPlacementsData, InboxPlacementsTestResult } from '../../Types/InboxPlacements';
import Request from '../common/Request';
export default class InboxPlacementsClient implements IInboxPlacementsClient {
request: Request;
seedsLists: ISeedsListsClient;
results: IInboxPlacementsResultsClient;
providers: IInboxPlacementsProvidersClient;
constructor(request: Request, seedsListsClient: ISeedsListsClient, results: IInboxPlacementsResultsClient, providers: IInboxPlacementsProvidersClient);
runTest(data: InboxPlacementsData): Promise<InboxPlacementsTestResult>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IInboxPlacementsProvidersClient } from '../../../Interfaces/InboxPlacements/providers/InboxPlacementsProviders';
import { InboxPlacementsProvidersList } from '../../../Types/InboxPlacements';
import Request from '../../common/Request';
export default class InboxPlacementsProvidersClient implements IInboxPlacementsProvidersClient {
request: Request;
path: string;
constructor(request: Request);
private parseList;
list(): Promise<InboxPlacementsProvidersList>;
}
3 changes: 2 additions & 1 deletion dist/Classes/MailgunClient.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MailgunClientOptions, InputFormData } from '../Types';
import { IDomainsClient, IWebHooksClient, IMailgunClient, IMailingListsClient, IEventClient, IStatsClient, ISuppressionClient, IMessagesClient, IRoutesClient, IValidationClient, IIPsClient, IIPPoolsClient, ISubaccountsClient } from '../Interfaces';
import { IDomainsClient, IWebHooksClient, IMailgunClient, IMailingListsClient, IEventClient, IStatsClient, ISuppressionClient, IMessagesClient, IRoutesClient, IValidationClient, IIPsClient, IIPPoolsClient, ISubaccountsClient, IInboxPlacementsClient } from '../Interfaces';
export default class MailgunClient implements IMailgunClient {
private request;
domains: IDomainsClient;
Expand All @@ -14,6 +14,7 @@ export default class MailgunClient implements IMailgunClient {
ip_pools: IIPPoolsClient;
lists: IMailingListsClient;
subaccounts: ISubaccountsClient;
inbox_placements: IInboxPlacementsClient;
constructor(options: MailgunClientOptions, formData: InputFormData);
setSubaccount(subaccountId: string): void;
resetSubaccount(): void;
Expand Down
5 changes: 5 additions & 0 deletions dist/Interfaces/InboxPlacements/AttributesClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { InboxPlacementsAttributesResult, InboxPlacementsValuesResult } from '../../Types/InboxPlacements';
export interface IInboxPlacementsAttributesClient {
list(): Promise<InboxPlacementsAttributesResult>;
get(attributeName: string): Promise<InboxPlacementsValuesResult>;
}
4 changes: 4 additions & 0 deletions dist/Interfaces/InboxPlacements/FiltersClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { InboxPlacementsFiltersResult } from '../../Types/InboxPlacements';
export interface IInboxPlacementsFiltersClient {
list(): Promise<InboxPlacementsFiltersResult>;
}
10 changes: 10 additions & 0 deletions dist/Interfaces/InboxPlacements/InboxPlacementsClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { InboxPlacementsData, InboxPlacementsTestResult } from '../../Types/InboxPlacements';
import { IInboxPlacementsResultsClient } from './Results/InboxPlacementsResults';
import { ISeedsListsClient } from './SeedsLists/SeedsListsClient';
import { IInboxPlacementsProvidersClient } from './providers/InboxPlacementsProviders';
export interface IInboxPlacementsClient {
seedsLists: ISeedsListsClient;
results: IInboxPlacementsResultsClient;
providers: IInboxPlacementsProvidersClient;
runTest(data: InboxPlacementsData): Promise<InboxPlacementsTestResult>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { InboxPlacementsDestroyResult, InboxPlacementsResultWithStatus, InboxPlacementsResultsList, InboxPlacementsResultsQuery } from '../../../Types/InboxPlacements';
import { IInboxPlacementsAttributesClient } from '../AttributesClient';
import { IInboxPlacementsFiltersClient } from '../FiltersClient';
import { IIPRSharingClient } from './InboxPlacementsResultsSharing';
export interface IInboxPlacementsResultsClient {
sharing: IIPRSharingClient;
attributes: IInboxPlacementsAttributesClient;
filters: IInboxPlacementsFiltersClient;
list(query: InboxPlacementsResultsQuery): Promise<InboxPlacementsResultsList>;
get(address: string): Promise<InboxPlacementsResultWithStatus>;
destroy(id: string): Promise<InboxPlacementsDestroyResult>;
getResultByShareId(shareId: string): Promise<InboxPlacementsResultWithStatus>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { InboxPlacementsResultsListResult, InboxPlacementsResultsQuery } from '../../../Types/InboxPlacements';
import { ISeedsListsAttributesClient } from '../SeedsLists/AttributesClient';
import { ISeedsListsFiltersClient } from '../SeedsLists/FiltersClient';
export interface IInboxPlacementsResultsClient {
attributes: ISeedsListsAttributesClient;
filters: ISeedsListsFiltersClient;
list(query: InboxPlacementsResultsQuery): Promise<InboxPlacementsResultsListResult>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { IPRSharingResult, IPRSharingUpdateData, IPRSharingUpdateResult } from '../../../Types/InboxPlacements';
export interface IIPRSharingClient {
get(id: string): Promise<IPRSharingResult>;
update(id: string, data: IPRSharingUpdateData): Promise<IPRSharingUpdateResult>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { InboxPlacementsAttributesResult, InboxPlacementsValuesResult } from '../../../Types/InboxPlacements';
export interface IInboxPlacementsAttributesClient {
list(): Promise<InboxPlacementsAttributesResult>;
get(attributeName: string): Promise<InboxPlacementsValuesResult>;
}
4 changes: 4 additions & 0 deletions dist/Interfaces/InboxPlacements/SeedsLists/FiltersClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { SeedsListsFiltersResult } from '../../../Types/InboxPlacements';
export interface ISeedsListsFiltersClient {
list(): Promise<SeedsListsFiltersResult>;
}
12 changes: 12 additions & 0 deletions dist/Interfaces/InboxPlacements/SeedsLists/SeedsListsClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { SeedListResult, SeedsListsCreatingData, SeedsListsDestroyApiResponse, SeedsListsQuery, SeedsListsResult, SeedsListsUpdatingData } from '../../../Types/InboxPlacements';
import { IInboxPlacementsAttributesClient } from '../AttributesClient';
import { IInboxPlacementsFiltersClient } from '../FiltersClient';
export interface ISeedsListsClient {
attributes: IInboxPlacementsAttributesClient;
filters: IInboxPlacementsFiltersClient;
list(query: SeedsListsQuery): Promise<SeedsListsResult>;
get(address: string): Promise<SeedListResult>;
create(data: SeedsListsCreatingData): Promise<SeedListResult>;
update(address: string, data: SeedsListsUpdatingData): Promise<SeedListResult>;
destroy(address: string): Promise<SeedsListsDestroyApiResponse>;
}
6 changes: 6 additions & 0 deletions dist/Interfaces/InboxPlacements/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './InboxPlacementsClient';
export * from './AttributesClient';
export * from './FiltersClient';
export * from './SeedsLists/SeedsListsClient';
export * from './Results/InboxPlacementsResults';
export * from './Results/InboxPlacementsResultsSharing';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { InboxPlacementsProvidersList } from '../../../Types/InboxPlacements';
export interface IInboxPlacementsProvidersClient {
list(): Promise<InboxPlacementsProvidersList>;
}
2 changes: 2 additions & 0 deletions dist/Interfaces/MailgunClient/IMailgunClient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { IIPsClient } from '../IPs';
import { IIPPoolsClient } from '../IPPools';
import { IMailingListsClient } from '../MailingLists';
import { ISubaccountsClient } from '../Subaccounts';
import { IInboxPlacementsClient } from '../InboxPlacements';
export interface IMailgunClient {
domains: IDomainsClient;
webhooks: IWebHooksClient;
Expand All @@ -23,6 +24,7 @@ export interface IMailgunClient {
ip_pools: IIPPoolsClient;
lists: IMailingListsClient;
subaccounts: ISubaccountsClient;
inbox_placements: IInboxPlacementsClient;
setSubaccount(subaccountId: string): void;
resetSubaccount(): void;
}
1 change: 1 addition & 0 deletions dist/Interfaces/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export * from './Routes';
export * from './IPs';
export * from './IPPools';
export * from './Subaccounts';
export * from './InboxPlacements';
2 changes: 1 addition & 1 deletion dist/Types/Domains/Domains.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export type UpdatedDKIMAuthority = {
};
export type UpdatedDKIMAuthorityResponse = {
body: UpdatedDKIMAuthority;
status: 200;
status: number;
};
export type DKIMSelectorInfo = {
dkimSelector: string;
Expand Down
21 changes: 21 additions & 0 deletions dist/Types/InboxPlacements/Attributes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export type InboxPlacementsAttributesResult = {
items: {
attribute: string;
values: string[];
};
status: number;
};
export type InboxPlacementsAttributesApiResponse = {
body: {
items: {
attribute: string;
values: string[];
};
};
status: number;
};
export type InboxPlacementsValuesResult = object;
export type InboxPlacementsValuesApiResponse = {
body: InboxPlacementsValuesResult;
status: number;
};
18 changes: 18 additions & 0 deletions dist/Types/InboxPlacements/Filters.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export type Filter = {
parameter: string;
description: string;
};
export type InboxPlacementsFiltersApiResponse = {
body: {
supported_filters: {
filters: Filter[];
};
};
status: number;
};
export type InboxPlacementsFiltersResult = {
supported_filters: {
filters: Filter[];
};
status: number;
};
22 changes: 22 additions & 0 deletions dist/Types/InboxPlacements/InboxPlacements.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export type InboxPlacementsData = {
from: string;
subject: string;
provider_filter?: string[];
html?: string;
template_name?: string;
variables?: {
[propName: string]: string;
};
seed_list?: string;
};
export type InboxPlacementsTestResult = {
result_id: string;
links: {
results: string;
};
status: number;
};
export type InboxPlacementsTestResultAPIResponse = {
body: InboxPlacementsTestResult;
status: number;
};
Empty file.
Loading
Loading