@oxyhq/core 2.4.1 → 3.1.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.
@@ -1,114 +0,0 @@
1
- /**
2
- * Developer API Methods Mixin
3
- *
4
- * Provides methods for managing developer applications and API keys
5
- */
6
- import type { OxyServicesBase } from '../OxyServices.base';
7
- import { CACHE_TIMES } from './mixinHelpers';
8
-
9
- export function OxyServicesDeveloperMixin<T extends typeof OxyServicesBase>(Base: T) {
10
- return class extends Base {
11
- constructor(...args: any[]) {
12
- super(...(args as [any]));
13
- }
14
-
15
- /**
16
- * Get developer apps for the current user
17
- * @returns Array of developer apps
18
- */
19
- async getDeveloperApps(): Promise<any[]> {
20
- try {
21
- const res = await this.makeRequest<{ apps?: any[] }>('GET', '/developer/apps', undefined, {
22
- cache: true,
23
- cacheTTL: CACHE_TIMES.MEDIUM,
24
- });
25
- return res.apps || [];
26
- } catch (error) {
27
- throw this.handleError(error);
28
- }
29
- }
30
-
31
- /**
32
- * Create a new developer app
33
- * @param data - Developer app configuration
34
- * @returns Created developer app
35
- */
36
- async createDeveloperApp(data: {
37
- name: string;
38
- description?: string;
39
- webhookUrl: string;
40
- devWebhookUrl?: string;
41
- scopes?: string[];
42
- }): Promise<any> {
43
- try {
44
- const res = await this.makeRequest<{ app: any }>('POST', '/developer/apps', data, { cache: false });
45
- return res.app;
46
- } catch (error) {
47
- throw this.handleError(error);
48
- }
49
- }
50
-
51
- /**
52
- * Get a specific developer app
53
- */
54
- async getDeveloperApp(appId: string): Promise<any> {
55
- try {
56
- const res = await this.makeRequest<{ app: any }>('GET', `/developer/apps/${appId}`, undefined, {
57
- cache: true,
58
- cacheTTL: CACHE_TIMES.LONG,
59
- });
60
- return res.app;
61
- } catch (error) {
62
- throw this.handleError(error);
63
- }
64
- }
65
-
66
- /**
67
- * Update a developer app
68
- * @param appId - The developer app ID
69
- * @param data - Updated app configuration
70
- * @returns Updated developer app
71
- */
72
- async updateDeveloperApp(appId: string, data: {
73
- name?: string;
74
- description?: string;
75
- webhookUrl?: string;
76
- devWebhookUrl?: string;
77
- scopes?: string[];
78
- }): Promise<any> {
79
- try {
80
- const res = await this.makeRequest<{ app: any }>('PATCH', `/developer/apps/${appId}`, data, { cache: false });
81
- return res.app;
82
- } catch (error) {
83
- throw this.handleError(error);
84
- }
85
- }
86
-
87
- /**
88
- * Regenerate API secret for a developer app
89
- * @param appId - The developer app ID
90
- * @returns App with new secret
91
- */
92
- async regenerateDeveloperAppSecret(appId: string): Promise<any> {
93
- try {
94
- return await this.makeRequest('POST', `/developer/apps/${appId}/regenerate-secret`, undefined, { cache: false });
95
- } catch (error) {
96
- throw this.handleError(error);
97
- }
98
- }
99
-
100
- /**
101
- * Delete a developer app
102
- * @param appId - The developer app ID
103
- * @returns Deletion result
104
- */
105
- async deleteDeveloperApp(appId: string): Promise<any> {
106
- try {
107
- return await this.makeRequest('DELETE', `/developer/apps/${appId}`, undefined, { cache: false });
108
- } catch (error) {
109
- throw this.handleError(error);
110
- }
111
- }
112
- };
113
- }
114
-