-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…-table-endpoints-and [DEV-10111] Implement `PricingTables` API SDK
- Loading branch information
Showing
6 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { DeferredJobsApiClient } from '../../api'; | ||
import { routing } from '../../routing'; | ||
|
||
import type { PricingTable } from './types'; | ||
|
||
export class Client { | ||
private readonly apiClient: DeferredJobsApiClient; | ||
|
||
constructor(apiClient: DeferredJobsApiClient) { | ||
this.apiClient = apiClient; | ||
} | ||
|
||
public async get(tableId: 'standard'): Promise<PricingTable> { | ||
const url = routing.pricingTablesUrl.replace(':table_id', String(tableId)); | ||
const { table } = await this.apiClient.get<{ table: PricingTable }>(url); | ||
return table; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './Client'; | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export interface PricingTable { | ||
options: Option[]; | ||
} | ||
|
||
export interface Option { | ||
id: string; | ||
display_name: string; | ||
description: string | null; | ||
overview_features_list: PlanFeatureRef[]; | ||
limits: Limit[]; | ||
prices: Price[]; | ||
add_ons: AddOn[]; | ||
} | ||
|
||
export interface PlanFeatureRef { | ||
name: string; | ||
details?: string; | ||
} | ||
|
||
export interface Limit { | ||
id: string; | ||
display_name: string; | ||
value: null | number; | ||
per: null | string; | ||
} | ||
|
||
export interface Price { | ||
billing_cycle: string; | ||
currency: string; | ||
amount: number; | ||
unit: string | null; | ||
} | ||
|
||
export interface AddOn { | ||
id: string; | ||
display_name: string; | ||
prices: Price[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters