adapty 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -4
- package/dist/commands/access-levels/create.d.ts +2 -1
- package/dist/commands/access-levels/create.js +3 -2
- package/dist/commands/access-levels/get.d.ts +2 -7
- package/dist/commands/access-levels/list.d.ts +2 -7
- package/dist/commands/access-levels/update.d.ts +2 -1
- package/dist/commands/access-levels/update.js +3 -2
- package/dist/commands/apps/create.d.ts +2 -1
- package/dist/commands/apps/create.js +1 -2
- package/dist/commands/apps/get.d.ts +2 -11
- package/dist/commands/apps/list.d.ts +2 -7
- package/dist/commands/apps/update.d.ts +2 -8
- package/dist/commands/paywalls/create.d.ts +2 -1
- package/dist/commands/paywalls/create.js +3 -2
- package/dist/commands/paywalls/get.d.ts +2 -7
- package/dist/commands/paywalls/list.d.ts +2 -6
- package/dist/commands/paywalls/placements.d.ts +18 -0
- package/dist/commands/paywalls/placements.js +25 -0
- package/dist/commands/paywalls/update.d.ts +2 -1
- package/dist/commands/paywalls/update.js +3 -2
- package/dist/commands/placements/create.d.ts +4 -2
- package/dist/commands/placements/create.js +29 -6
- package/dist/commands/placements/get.d.ts +2 -8
- package/dist/commands/placements/list.d.ts +2 -7
- package/dist/commands/placements/update.d.ts +4 -2
- package/dist/commands/placements/update.js +32 -6
- package/dist/commands/products/create.d.ts +2 -1
- package/dist/commands/products/create.js +9 -1
- package/dist/commands/products/get.d.ts +2 -9
- package/dist/commands/products/list.d.ts +2 -7
- package/dist/commands/products/update.d.ts +2 -1
- package/dist/commands/segments/get.d.ts +14 -0
- package/dist/commands/segments/get.js +25 -0
- package/dist/commands/segments/list.d.ts +14 -0
- package/dist/commands/segments/list.js +20 -0
- package/dist/lib/api-schemas.d.ts +99 -0
- package/dist/lib/api-schemas.js +7 -0
- package/oclif.manifest.json +284 -122
- package/package.json +4 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import type { SegmentDTO } from '../../lib/api-schemas.js';
|
|
3
|
+
export default class SegmentsGet extends Command {
|
|
4
|
+
static args: {
|
|
5
|
+
segment_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static enableJsonFlag: boolean;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<SegmentDTO>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import { createAuthenticatedClient } from '../../lib/client-from-config.js';
|
|
3
|
+
import { appFlag, isValidUuid } from '../../lib/flags.js';
|
|
4
|
+
import { printResponse } from '../../lib/output.js';
|
|
5
|
+
export default class SegmentsGet extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
segment_id: Args.string({ description: 'Segment ID (UUID)', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static description = 'Get segment details';
|
|
10
|
+
static enableJsonFlag = true;
|
|
11
|
+
static examples = ['<%= config.bin %> segments get --app UUID 550e8400-e29b-41d4-a716-446655440000'];
|
|
12
|
+
static flags = {
|
|
13
|
+
...appFlag,
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(SegmentsGet);
|
|
17
|
+
if (!isValidUuid(args.segment_id)) {
|
|
18
|
+
this.error('Invalid segment ID format.', { exit: 2 });
|
|
19
|
+
}
|
|
20
|
+
const client = await createAuthenticatedClient(this.config);
|
|
21
|
+
const result = await client.get(`/apps/${flags.app}/segments/${args.segment_id}`);
|
|
22
|
+
printResponse(result, this.log.bind(this));
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import type { SegmentDTO } from '../../lib/api-schemas.js';
|
|
3
|
+
import { type PaginatedResponse } from '../../lib/flags.js';
|
|
4
|
+
export default class SegmentsList extends Command {
|
|
5
|
+
static description: string;
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'page-size': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<PaginatedResponse<SegmentDTO>>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { createAuthenticatedClient } from '../../lib/client-from-config.js';
|
|
3
|
+
import { appFlag, paginationFlags, paginationParams } from '../../lib/flags.js';
|
|
4
|
+
import { printList } from '../../lib/output.js';
|
|
5
|
+
export default class SegmentsList extends Command {
|
|
6
|
+
static description = 'List segments for an app';
|
|
7
|
+
static enableJsonFlag = true;
|
|
8
|
+
static examples = ['<%= config.bin %> segments list --app 550e8400-...'];
|
|
9
|
+
static flags = {
|
|
10
|
+
...appFlag,
|
|
11
|
+
...paginationFlags,
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(SegmentsList);
|
|
15
|
+
const client = await createAuthenticatedClient(this.config);
|
|
16
|
+
const result = await client.get(`/apps/${flags.app}/segments`, paginationParams(flags));
|
|
17
|
+
printList(result.data, this.log.bind(this), result.meta.pagination);
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type ProductPeriod = 'annual' | 'consumable' | 'lifetime' | 'monthly' | 'nonsubscriptions' | 'semiannual' | 'trimonthly' | 'two_months' | 'uncategorised' | 'weekly';
|
|
2
|
+
export interface VendorProductDTO {
|
|
3
|
+
base_plan_id: null | string;
|
|
4
|
+
id: null | string;
|
|
5
|
+
product_id: null | string;
|
|
6
|
+
}
|
|
7
|
+
export interface AppSummaryDTO {
|
|
8
|
+
id: string;
|
|
9
|
+
sdk_key: null | string;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AppDetailDTO {
|
|
13
|
+
apple_bundle_id: null | string;
|
|
14
|
+
google_bundle_id: null | string;
|
|
15
|
+
id: string;
|
|
16
|
+
platforms: string[];
|
|
17
|
+
sdk_key: null | string;
|
|
18
|
+
secret_key: null | string;
|
|
19
|
+
title: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AppCreateRequestDTO {
|
|
22
|
+
apple_bundle_id?: null | string;
|
|
23
|
+
google_bundle_id?: null | string;
|
|
24
|
+
title: string;
|
|
25
|
+
}
|
|
26
|
+
export interface AppUpdateRequestDTO {
|
|
27
|
+
apple_bundle_id?: null | string;
|
|
28
|
+
google_bundle_id?: null | string;
|
|
29
|
+
title?: null | string;
|
|
30
|
+
}
|
|
31
|
+
export interface AccessLevelDTO {
|
|
32
|
+
id: string;
|
|
33
|
+
sdk_id: string;
|
|
34
|
+
title: null | string;
|
|
35
|
+
}
|
|
36
|
+
export interface AccessLevelCreateRequestDTO {
|
|
37
|
+
sdk_id: string;
|
|
38
|
+
title?: null | string;
|
|
39
|
+
}
|
|
40
|
+
export interface AccessLevelUpdateRequestDTO {
|
|
41
|
+
title?: null | string;
|
|
42
|
+
}
|
|
43
|
+
export interface ProductDTO {
|
|
44
|
+
access_level_id: string;
|
|
45
|
+
id: string;
|
|
46
|
+
period: ProductPeriod;
|
|
47
|
+
title: string;
|
|
48
|
+
vendor_products: Record<string, VendorProductDTO>;
|
|
49
|
+
}
|
|
50
|
+
export interface ProductCreateRequestDTO {
|
|
51
|
+
access_level_id: string;
|
|
52
|
+
android_base_plan_id?: null | string;
|
|
53
|
+
android_product_id?: null | string;
|
|
54
|
+
ios_product_id?: null | string;
|
|
55
|
+
period: ProductPeriod;
|
|
56
|
+
price_usd?: null | number;
|
|
57
|
+
title: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ProductUpdateRequestDTO {
|
|
60
|
+
access_level_id: string;
|
|
61
|
+
title: string;
|
|
62
|
+
}
|
|
63
|
+
export interface PaywallDTO {
|
|
64
|
+
id: string;
|
|
65
|
+
product_ids: string[];
|
|
66
|
+
title: string;
|
|
67
|
+
}
|
|
68
|
+
export interface PaywallWriteRequestDTO {
|
|
69
|
+
product_ids?: string[];
|
|
70
|
+
title: string;
|
|
71
|
+
}
|
|
72
|
+
export interface SegmentDTO {
|
|
73
|
+
description: null | string;
|
|
74
|
+
id: string;
|
|
75
|
+
title: string;
|
|
76
|
+
}
|
|
77
|
+
export interface PlacementAudienceEntryDTO {
|
|
78
|
+
paywall_id: string;
|
|
79
|
+
priority: number;
|
|
80
|
+
segment_ids?: string[];
|
|
81
|
+
}
|
|
82
|
+
export interface PlacementSummaryDTO {
|
|
83
|
+
developer_id: string;
|
|
84
|
+
id: string;
|
|
85
|
+
title: string;
|
|
86
|
+
}
|
|
87
|
+
export interface PlacementDetailDTO {
|
|
88
|
+
audiences?: PlacementAudienceEntryDTO[];
|
|
89
|
+
developer_id: string;
|
|
90
|
+
id: string;
|
|
91
|
+
title: string;
|
|
92
|
+
}
|
|
93
|
+
export interface PlacementWriteRequestDTO {
|
|
94
|
+
audiences: null | PlacementAudienceEntryDTO[];
|
|
95
|
+
developer_id: string;
|
|
96
|
+
/** @deprecated use `audiences` */
|
|
97
|
+
paywall_id: null | string;
|
|
98
|
+
title: string;
|
|
99
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Hand-picked DTOs from the Adapty Developer API OpenAPI schema. Kept in
|
|
2
|
+
// lockstep with the server-side `portal.developer_api_context.domains.data_transfer_objects.resource_data.*` types.
|
|
3
|
+
//
|
|
4
|
+
// To refresh after a backend change, fetch the spec with:
|
|
5
|
+
// curl -H 'Referer: /api/v1/developer/' http://localhost:8000/api/v1/swagger/schema/
|
|
6
|
+
// and update the affected definitions here.
|
|
7
|
+
export {};
|