@nevermined-io/payments 0.1.2 → 0.1.3

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 CHANGED
@@ -4,3 +4,68 @@
4
4
 
5
5
  > Typescript SDK to interact with the Nevermined Payments Protocol
6
6
  > [nevermined.io](https://nevermined.io)
7
+
8
+ ## Quickstart
9
+
10
+ ```
11
+ # yarn
12
+ yarn add @nevermined-io/payments
13
+
14
+ # npm
15
+
16
+ npm install @nevermined-io/payments
17
+ ```
18
+
19
+ ### Initialize the payments library
20
+
21
+ This is a browser only method. Here we have an example using react.
22
+ For a full example please refer to [payments-nextjs-example](https://github.com/nevermined-io/tutorials/tree/main/payments-nextjs-example)
23
+
24
+ ```typescript
25
+ import { useEffect } from "react";
26
+ import { Payments } from "@nevermined-io/payments";
27
+
28
+ export default function Home() {
29
+ const payments = new Payments({
30
+ returnUrl: "http://localhost:8080",
31
+ environment: "staging",
32
+ });
33
+
34
+ const onLogin = () => {
35
+ payments.connect();
36
+ };
37
+
38
+ useEffect(() => {
39
+ payments.init();
40
+ }, []);
41
+
42
+ return (
43
+ <main>
44
+ <div>
45
+ <button onClick={onLogin}>Login</button>
46
+ </div>
47
+ </main>
48
+ );
49
+ }
50
+ ```
51
+
52
+ The `init()` method should be called immediately after the app returns the user to `returnUrl`.
53
+
54
+ ### Create a subscription
55
+
56
+ Once the app is initialized we can create a subscription:
57
+
58
+ ```typescript
59
+ async function createSubscription() {
60
+ if (payments.isLoggedIn) {
61
+ const { did } = await payments.createSubscription({
62
+ name: 'test subscription',
63
+ description: 'test',
64
+ price: 10000000n,
65
+ tokenAddress: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d',
66
+ duration: 30,
67
+ tags: ['test'],
68
+ })
69
+ }
70
+ }
71
+ ```
@@ -2,6 +2,6 @@ export interface EnvironmentInfo {
2
2
  frontend: string;
3
3
  backend: string;
4
4
  }
5
- export type EnvironmentName = 'staging';
5
+ export type EnvironmentName = 'appStaging' | 'appTesting' | 'appArbitrum' | 'appGnosis' | 'appMatic';
6
6
  export declare const Environments: Record<EnvironmentName, EnvironmentInfo>;
7
7
  //# sourceMappingURL=environments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../src/environments.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,CAAA;AAEvC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,eAAe,CAKjE,CAAA"}
1
+ {"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../src/environments.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;AAEpG,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,eAAe,CAqBjE,CAAA"}
@@ -2,9 +2,25 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Environments = void 0;
4
4
  exports.Environments = {
5
- staging: {
5
+ appStaging: {
6
6
  frontend: 'https://staging.nevermined.app',
7
7
  backend: 'https://one-backend.staging.nevermined.app',
8
8
  },
9
+ appTesting: {
10
+ frontend: 'https://testing.nevermined.app',
11
+ backend: 'https://one-backend.testing.nevermined.app',
12
+ },
13
+ appArbitrum: {
14
+ frontend: 'https://nevermined.app',
15
+ backend: 'https://one-backend.arbitrum.nevermined.app',
16
+ },
17
+ appGnosis: {
18
+ frontend: 'https://gnosis.nevermined.app',
19
+ backend: 'https://one-backend.gnosis.nevermined.app',
20
+ },
21
+ appMatic: {
22
+ frontend: 'https://matic.nevermined.app',
23
+ backend: 'https://one-backend.matic.nevermined.app',
24
+ },
9
25
  };
10
26
  //# sourceMappingURL=environments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"environments.js","sourceRoot":"","sources":["../src/environments.ts"],"names":[],"mappings":";;;AAOa,QAAA,YAAY,GAA6C;IACpE,OAAO,EAAE;QACP,QAAQ,EAAE,gCAAgC;QAC1C,OAAO,EAAE,4CAA4C;KACtD;CACF,CAAA"}
1
+ {"version":3,"file":"environments.js","sourceRoot":"","sources":["../src/environments.ts"],"names":[],"mappings":";;;AAOa,QAAA,YAAY,GAA6C;IACpE,UAAU,EAAE;QACV,QAAQ,EAAE,gCAAgC;QAC1C,OAAO,EAAE,4CAA4C;KACtD;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,gCAAgC;QAC1C,OAAO,EAAE,4CAA4C;KACtD;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,wBAAwB;QAClC,OAAO,EAAE,6CAA6C;KACvD;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,+BAA+B;QACzC,OAAO,EAAE,2CAA2C;KACrD;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,8BAA8B;QACxC,OAAO,EAAE,0CAA0C;KACpD;CACF,CAAA"}
@@ -1,19 +1,124 @@
1
1
  import { EnvironmentInfo, EnvironmentName } from './environments';
2
+ /**
3
+ * Options to initialize the Payments class.
4
+ */
2
5
  export interface PaymentOptions {
6
+ /**
7
+ * The URL to return to the app after a successful login.
8
+ */
3
9
  returnUrl: string;
10
+ /**
11
+ * The environment to connect to.
12
+ */
4
13
  environment: EnvironmentName;
5
14
  }
6
15
  export interface Endpoint {
7
16
  [verb: string]: string;
8
17
  }
18
+ /**
19
+ * Main class that interacts with the Nevermined payments API.
20
+ */
9
21
  export declare class Payments {
10
22
  returnUrl: string;
11
23
  environment: EnvironmentInfo;
12
24
  private sessionKey?;
25
+ /**
26
+ * Initialize the payments class.
27
+ *
28
+ * @param options - The options to initialize the payments class.
29
+ *
30
+ * @example
31
+ * ```
32
+ * const payments = new Payments({
33
+ * returnUrl: 'https://mysite.example'
34
+ * environment: 'staging'
35
+ * })
36
+ * ```
37
+ *
38
+ * @returns An instance of {@link Payments}
39
+ */
13
40
  constructor(options: PaymentOptions);
14
- init(): void;
41
+ /**
42
+ * Initiate the connect flow. The user's browser will be redirected to
43
+ * the Nevermined App login page.
44
+ *
45
+ * @remarks
46
+ *
47
+ * This is a browser only function.
48
+ *
49
+ * @example
50
+ * ```
51
+ * payments.connect()
52
+ * ```
53
+ */
15
54
  connect(): void;
55
+ /**
56
+ * Method to initialize the class once the user has been logged in.
57
+ * This method should be called has soon as the user has been redirected
58
+ * back to the app ({@link returnUrl}).
59
+ *
60
+ * @remarks
61
+ *
62
+ * This is a browser only function.
63
+ *
64
+ * @example
65
+ * ```
66
+ * payments.init()
67
+ * ```
68
+ *
69
+ * @example Using react
70
+ *
71
+ * You may want to use `useEffect` on the route that matches the passed
72
+ * {@link returnUrl}
73
+ *
74
+ * ```
75
+ * useEffect(() => {
76
+ * payments.init()
77
+ * })
78
+ * ```
79
+ */
80
+ init(): void;
81
+ /**
82
+ * Property to check if a user logged in.
83
+ *
84
+ * @example
85
+ * ```
86
+ * payments.isLoggedIn
87
+ * ```
88
+ *
89
+ * @returns True if the user is logged in.
90
+ */
16
91
  get isLoggedIn(): boolean;
92
+ /**
93
+ *
94
+ * Create a subscription on Nevermined.
95
+ *
96
+ * @param name - The name of the subscription.
97
+ * @param description - A description of what the subscription offers.
98
+ * @param price - The price of the subscription.
99
+ * @param tokenAddress - The ERC-20 token address of the currency used to price the subscription.
100
+ * Using the zero address will use the chain's native currency instead.
101
+ * @param amountOfCredits - The amount of credits associated with the credit based subscription.
102
+ * Leave unset to use time limited time subscriptions instead.
103
+ * @param duration - The duration of the subscription in days.
104
+ * If `amountOfCredits` and `duration` is left undefined an unlimited time duration subscription
105
+ * will be created.
106
+ * @param tags - An array of tags or keywords that best fit the subscription.
107
+ *
108
+ * @example
109
+ * ```
110
+ * const { did } = await payments.createSubscription({
111
+ * name: "test subscription",
112
+ * description: "test",
113
+ * price: 10000000n,
114
+ * tokenAddress: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
115
+ * duration: 30,
116
+ * tags: ["test"]
117
+ * }
118
+ * ```
119
+ *
120
+ * @returns The DID of the newly created subscription.
121
+ */
17
122
  createSubscription({ name, description, price, tokenAddress, amountOfCredits, duration, tags, }: {
18
123
  name: string;
19
124
  description: string;
@@ -25,7 +130,34 @@ export declare class Payments {
25
130
  }): Promise<{
26
131
  did: string;
27
132
  }>;
28
- createWebservice({ subscriptionDid, name, description, price, tokenAddress, amountOfCredits, duration, tags, serviceChargeType, minCreditsToCharge, maxCreditsToCharge, authType, username, password, token, endpoints, openEndpoints, openApiUrl, integration, sampleLink, apiDescription, curation, }: {
133
+ /**
134
+ * Creates a service.
135
+ *
136
+ * @param subscriptionDid - The subscription DID.
137
+ * @param name - The name of the service.
138
+ * @param description - The description of the service.
139
+ * @param price - The price of the service.
140
+ * @param tokenAddress - The token address.
141
+ * @param amountOfCredits - The amount of credits.
142
+ * @param duration - The duration of the service.
143
+ * @param tags - The tags associated with the service.
144
+ * @param serviceChargeType - The service charge type ('fixed' or 'dynamic').
145
+ * @param minCreditsToCharge - The minimum credits to charge.
146
+ * @param maxCreditsToCharge - The maximum credits to charge.
147
+ * @param authType - The authentication type ('none', 'basic', or 'oauth').
148
+ * @param username - The username for authentication.
149
+ * @param password - The password for authentication.
150
+ * @param token - The token for authentication.
151
+ * @param endpoints - The endpoints of the service.
152
+ * @param openEndpoints - The open endpoints of the service.
153
+ * @param openApiUrl - The OpenAPI URL.
154
+ * @param integration - The integration details.
155
+ * @param sampleLink - The sample link.
156
+ * @param apiDescription - The API description.
157
+ * @param curation - The curation details.
158
+ * @returns A promise that resolves to the created service DID.
159
+ */
160
+ createService({ subscriptionDid, name, description, price, tokenAddress, amountOfCredits, duration, tags, serviceChargeType, minCreditsToCharge, maxCreditsToCharge, authType, username, password, token, endpoints, openEndpoints, openApiUrl, integration, sampleLink, apiDescription, curation, }: {
29
161
  subscriptionDid: string;
30
162
  name: string;
31
163
  description: string;
@@ -51,5 +183,80 @@ export declare class Payments {
51
183
  }): Promise<{
52
184
  did: string;
53
185
  }>;
186
+ /**
187
+ * Creates a file with the specified parameters.
188
+ *
189
+ * @param subscriptionDid - The subscription DID.
190
+ * @param assetType - The type of asset.
191
+ * @param name - The name of the file.
192
+ * @param description - The description of the file.
193
+ * @param files - The array of files.
194
+ * @param price - The price of the file.
195
+ * @param tokenAddress - The token address.
196
+ * @param amountOfCredits - The amount of credits.
197
+ * @param duration - The duration of the file.
198
+ * @param tags - The array of tags.
199
+ * @param dataSchema - The data schema.
200
+ * @param sampleCode - The sample code.
201
+ * @param filesFormat - The format of the files.
202
+ * @param usageExample - The usage example.
203
+ * @param programmingLanguage - The programming language.
204
+ * @param framework - The framework.
205
+ * @param task - The task.
206
+ * @param trainingDetails - The training details.
207
+ * @param variations - The variations.
208
+ * @param fineTunable - Indicates if the file is fine-tunable.
209
+ * @param minCreditsToCharge - The minimum credits to charge.
210
+ * @param maxCreditsToCharge - The maximum credits to charge.
211
+ * @param curation - The curation object.
212
+ * @returns The promise that resolves to the created file's DID.
213
+ */
214
+ createFile({ subscriptionDid, assetType, name, description, files, price, tokenAddress, amountOfCredits, duration, tags, dataSchema, sampleCode, filesFormat, usageExample, programmingLanguage, framework, task, trainingDetails, variations, fineTunable, minCreditsToCharge, maxCreditsToCharge, curation, }: {
215
+ subscriptionDid: string;
216
+ assetType: string;
217
+ name: string;
218
+ description: string;
219
+ files: object[];
220
+ price: bigint;
221
+ tokenAddress: string;
222
+ dataSchema?: string;
223
+ sampleCode?: string;
224
+ filesFormat?: string;
225
+ usageExample?: string;
226
+ programmingLanguage?: string;
227
+ framework?: string;
228
+ task?: string;
229
+ trainingDetails?: string;
230
+ variations?: string;
231
+ fineTunable?: boolean;
232
+ amountOfCredits?: number;
233
+ minCreditsToCharge?: number;
234
+ maxCreditsToCharge?: number;
235
+ curation?: object;
236
+ duration?: number;
237
+ tags?: string[];
238
+ }): Promise<{
239
+ did: string;
240
+ }>;
241
+ /**
242
+ * Redirects the user to the subscription details for a given DID.
243
+ * @param did - The DID (Decentralized Identifier) of the subscription.
244
+ */
245
+ getSubscriptionDetails(did: string): void;
246
+ /**
247
+ * Redirects the user to the service details for a given DID.
248
+ * @param did - The DID (Decentralized Identifier) of the service.
249
+ */
250
+ getServiceDetails(did: string): void;
251
+ /**
252
+ * Redirects the user to the file details for the specified DID (Decentralized Identifier).
253
+ * @param did - The DID of the file.
254
+ */
255
+ getFileDetails(did: string): void;
256
+ /**
257
+ * Redirects the user to the subscription checkout page for the specified DID.
258
+ * @param did - The DID (Decentralized Identifier) of the item to be subscribed to.
259
+ */
260
+ checkoutSubscription(did: string): void;
54
261
  }
55
262
  //# sourceMappingURL=payments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAgB,MAAM,gBAAgB,CAAA;AAE/E,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,eAAe,CAAA;CAC7B;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB;AAED,qBAAa,QAAQ;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,eAAe,CAAA;IACnC,OAAO,CAAC,UAAU,CAAC,CAAQ;gBAEf,OAAO,EAAE,cAAc;IAK5B,IAAI;IAWJ,OAAO;IAQd,IAAI,UAAU,IAAI,OAAO,CAExB;IAEY,kBAAkB,CAAC,EAC9B,IAAI,EACJ,WAAW,EACX,KAAK,EACL,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACn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GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IA6C5B;;;OAGG;IACI,sBAAsB,CAAC,GAAG,EAAE,MAAM;IAKzC;;;OAGG;IACI,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAKpC;;;OAGG;IACI,cAAc,CAAC,GAAG,EAAE,MAAM;IAKjC;;;OAGG;IACI,oBAAoB,CAAC,GAAG,EAAE,MAAM;CAIxC"}
package/dist/payments.js CHANGED
@@ -2,28 +2,123 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Payments = void 0;
4
4
  const environments_1 = require("./environments");
5
+ /**
6
+ * Main class that interacts with the Nevermined payments API.
7
+ */
5
8
  class Payments {
9
+ /**
10
+ * Initialize the payments class.
11
+ *
12
+ * @param options - The options to initialize the payments class.
13
+ *
14
+ * @example
15
+ * ```
16
+ * const payments = new Payments({
17
+ * returnUrl: 'https://mysite.example'
18
+ * environment: 'staging'
19
+ * })
20
+ * ```
21
+ *
22
+ * @returns An instance of {@link Payments}
23
+ */
6
24
  constructor(options) {
7
25
  this.returnUrl = options.returnUrl;
8
26
  this.environment = environments_1.Environments[options.environment];
9
27
  }
28
+ /**
29
+ * Initiate the connect flow. The user's browser will be redirected to
30
+ * the Nevermined App login page.
31
+ *
32
+ * @remarks
33
+ *
34
+ * This is a browser only function.
35
+ *
36
+ * @example
37
+ * ```
38
+ * payments.connect()
39
+ * ```
40
+ */
41
+ connect() {
42
+ const url = new URL(`/en/login?nvm-export=session-key&returnUrl=${this.returnUrl}`, this.environment.frontend);
43
+ window.location.href = url.toString();
44
+ }
45
+ /**
46
+ * Method to initialize the class once the user has been logged in.
47
+ * This method should be called has soon as the user has been redirected
48
+ * back to the app ({@link returnUrl}).
49
+ *
50
+ * @remarks
51
+ *
52
+ * This is a browser only function.
53
+ *
54
+ * @example
55
+ * ```
56
+ * payments.init()
57
+ * ```
58
+ *
59
+ * @example Using react
60
+ *
61
+ * You may want to use `useEffect` on the route that matches the passed
62
+ * {@link returnUrl}
63
+ *
64
+ * ```
65
+ * useEffect(() => {
66
+ * payments.init()
67
+ * })
68
+ * ```
69
+ */
10
70
  init() {
11
71
  const url = new URL(window.location.href);
12
72
  const sessionKey = url.searchParams.get('sessionKey');
13
73
  if (sessionKey) {
14
74
  this.sessionKey = sessionKey;
15
- console.log('sessionKey:', sessionKey);
16
75
  url.searchParams.delete('sessionKey');
17
76
  history.replaceState(history.state, '', url.toString());
18
77
  }
19
78
  }
20
- connect() {
21
- const url = new URL(`/en/login?nvm-export=session-key&returnUrl=${this.returnUrl}`, this.environment.frontend);
22
- window.location.href = url.toString();
23
- }
79
+ /**
80
+ * Property to check if a user logged in.
81
+ *
82
+ * @example
83
+ * ```
84
+ * payments.isLoggedIn
85
+ * ```
86
+ *
87
+ * @returns True if the user is logged in.
88
+ */
24
89
  get isLoggedIn() {
25
90
  return !!this.sessionKey;
26
91
  }
92
+ /**
93
+ *
94
+ * Create a subscription on Nevermined.
95
+ *
96
+ * @param name - The name of the subscription.
97
+ * @param description - A description of what the subscription offers.
98
+ * @param price - The price of the subscription.
99
+ * @param tokenAddress - The ERC-20 token address of the currency used to price the subscription.
100
+ * Using the zero address will use the chain's native currency instead.
101
+ * @param amountOfCredits - The amount of credits associated with the credit based subscription.
102
+ * Leave unset to use time limited time subscriptions instead.
103
+ * @param duration - The duration of the subscription in days.
104
+ * If `amountOfCredits` and `duration` is left undefined an unlimited time duration subscription
105
+ * will be created.
106
+ * @param tags - An array of tags or keywords that best fit the subscription.
107
+ *
108
+ * @example
109
+ * ```
110
+ * const { did } = await payments.createSubscription({
111
+ * name: "test subscription",
112
+ * description: "test",
113
+ * price: 10000000n,
114
+ * tokenAddress: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
115
+ * duration: 30,
116
+ * tags: ["test"]
117
+ * }
118
+ * ```
119
+ *
120
+ * @returns The DID of the newly created subscription.
121
+ */
27
122
  async createSubscription({ name, description, price, tokenAddress, amountOfCredits, duration, tags, }) {
28
123
  const body = {
29
124
  sessionKey: this.sessionKey,
@@ -50,7 +145,34 @@ class Payments {
50
145
  }
51
146
  return response.json();
52
147
  }
53
- async createWebservice({ subscriptionDid, name, description, price, tokenAddress, amountOfCredits, duration, tags, serviceChargeType, minCreditsToCharge, maxCreditsToCharge, authType, username, password, token, endpoints, openEndpoints, openApiUrl, integration, sampleLink, apiDescription, curation, }) {
148
+ /**
149
+ * Creates a service.
150
+ *
151
+ * @param subscriptionDid - The subscription DID.
152
+ * @param name - The name of the service.
153
+ * @param description - The description of the service.
154
+ * @param price - The price of the service.
155
+ * @param tokenAddress - The token address.
156
+ * @param amountOfCredits - The amount of credits.
157
+ * @param duration - The duration of the service.
158
+ * @param tags - The tags associated with the service.
159
+ * @param serviceChargeType - The service charge type ('fixed' or 'dynamic').
160
+ * @param minCreditsToCharge - The minimum credits to charge.
161
+ * @param maxCreditsToCharge - The maximum credits to charge.
162
+ * @param authType - The authentication type ('none', 'basic', or 'oauth').
163
+ * @param username - The username for authentication.
164
+ * @param password - The password for authentication.
165
+ * @param token - The token for authentication.
166
+ * @param endpoints - The endpoints of the service.
167
+ * @param openEndpoints - The open endpoints of the service.
168
+ * @param openApiUrl - The OpenAPI URL.
169
+ * @param integration - The integration details.
170
+ * @param sampleLink - The sample link.
171
+ * @param apiDescription - The API description.
172
+ * @param curation - The curation details.
173
+ * @returns A promise that resolves to the created service DID.
174
+ */
175
+ async createService({ subscriptionDid, name, description, price, tokenAddress, amountOfCredits, duration, tags, serviceChargeType, minCreditsToCharge, maxCreditsToCharge, authType, username, password, token, endpoints, openEndpoints, openApiUrl, integration, sampleLink, apiDescription, curation, }) {
54
176
  const body = {
55
177
  sessionKey: this.sessionKey,
56
178
  name,
@@ -76,7 +198,6 @@ class Payments {
76
198
  apiDescription,
77
199
  curation,
78
200
  };
79
- console.log(body);
80
201
  const options = {
81
202
  method: 'POST',
82
203
  headers: {
@@ -85,13 +206,115 @@ class Payments {
85
206
  },
86
207
  body: JSON.stringify(body),
87
208
  };
88
- const url = new URL('/api/v1/payments/webservice', this.environment.backend);
209
+ const url = new URL('/api/v1/payments/service', this.environment.backend);
210
+ const response = await fetch(url, options);
211
+ if (!response.ok) {
212
+ throw Error(response.statusText);
213
+ }
214
+ return response.json();
215
+ }
216
+ /**
217
+ * Creates a file with the specified parameters.
218
+ *
219
+ * @param subscriptionDid - The subscription DID.
220
+ * @param assetType - The type of asset.
221
+ * @param name - The name of the file.
222
+ * @param description - The description of the file.
223
+ * @param files - The array of files.
224
+ * @param price - The price of the file.
225
+ * @param tokenAddress - The token address.
226
+ * @param amountOfCredits - The amount of credits.
227
+ * @param duration - The duration of the file.
228
+ * @param tags - The array of tags.
229
+ * @param dataSchema - The data schema.
230
+ * @param sampleCode - The sample code.
231
+ * @param filesFormat - The format of the files.
232
+ * @param usageExample - The usage example.
233
+ * @param programmingLanguage - The programming language.
234
+ * @param framework - The framework.
235
+ * @param task - The task.
236
+ * @param trainingDetails - The training details.
237
+ * @param variations - The variations.
238
+ * @param fineTunable - Indicates if the file is fine-tunable.
239
+ * @param minCreditsToCharge - The minimum credits to charge.
240
+ * @param maxCreditsToCharge - The maximum credits to charge.
241
+ * @param curation - The curation object.
242
+ * @returns The promise that resolves to the created file's DID.
243
+ */
244
+ async createFile({ subscriptionDid, assetType, name, description, files, price, tokenAddress, amountOfCredits, duration, tags, dataSchema, sampleCode, filesFormat, usageExample, programmingLanguage, framework, task, trainingDetails, variations, fineTunable, minCreditsToCharge, maxCreditsToCharge, curation, }) {
245
+ const body = {
246
+ sessionKey: this.sessionKey,
247
+ assetType,
248
+ name,
249
+ description,
250
+ files,
251
+ price: price.toString(),
252
+ tokenAddress,
253
+ amountOfCredits,
254
+ duration,
255
+ tags,
256
+ subscriptionDid,
257
+ dataSchema,
258
+ sampleCode,
259
+ filesFormat,
260
+ usageExample,
261
+ programmingLanguage,
262
+ framework,
263
+ task,
264
+ trainingDetails,
265
+ variations,
266
+ fineTunable,
267
+ minCreditsToCharge,
268
+ maxCreditsToCharge,
269
+ curation,
270
+ };
271
+ const options = {
272
+ method: 'POST',
273
+ headers: {
274
+ Accept: 'application/json',
275
+ 'Content-Type': 'application/json',
276
+ },
277
+ body: JSON.stringify(body),
278
+ };
279
+ const url = new URL('/api/v1/payments/file', this.environment.backend);
89
280
  const response = await fetch(url, options);
90
281
  if (!response.ok) {
91
282
  throw Error(response.statusText);
92
283
  }
93
284
  return response.json();
94
285
  }
286
+ /**
287
+ * Redirects the user to the subscription details for a given DID.
288
+ * @param did - The DID (Decentralized Identifier) of the subscription.
289
+ */
290
+ getSubscriptionDetails(did) {
291
+ const url = new URL(`/en/subscription/${did}`, this.environment.frontend);
292
+ window.location.href = url.toString();
293
+ }
294
+ /**
295
+ * Redirects the user to the service details for a given DID.
296
+ * @param did - The DID (Decentralized Identifier) of the service.
297
+ */
298
+ getServiceDetails(did) {
299
+ const url = new URL(`/en/webservice/${did}`, this.environment.frontend);
300
+ window.location.href = url.toString();
301
+ }
302
+ /**
303
+ * Redirects the user to the file details for the specified DID (Decentralized Identifier).
304
+ * @param did - The DID of the file.
305
+ */
306
+ getFileDetails(did) {
307
+ const url = new URL(`/en/file/${did}`, this.environment.frontend);
308
+ window.location.href = url.toString();
309
+ }
310
+ /**
311
+ * Redirects the user to the subscription checkout page for the specified DID.
312
+ * @param did - The DID (Decentralized Identifier) of the item to be subscribed to.
313
+ */
314
+ checkoutSubscription(did) {
315
+ const url = new URL(`/en/subscription/checkout/${did}`, this.environment.frontend);
316
+ window.location.href = url.toString();
317
+ }
95
318
  }
96
319
  exports.Payments = Payments;
97
320
  //# sourceMappingURL=payments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"payments.js","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":";;;AAAA,iDAA+E;AAW/E,MAAa,QAAQ;IAKnB,YAAY,OAAuB;QACjC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QAClC,IAAI,CAAC,WAAW,GAAG,2BAA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,QAAQ,CAAC,IAAI,EAAE,CAAA;IACxB,CAAC;IAED;;;OAGG;IACI,sBAAsB,CAAC,GAAW;QACvC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,oBAAoB,GAAG,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACzE,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;IACvC,CAAC;IAED;;;OAGG;IACI,iBAAiB,CAAC,GAAW;QAClC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,kBAAkB,GAAG,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACvE,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;IACvC,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,GAAW;QAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,YAAY,GAAG,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACjE,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;IACvC,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,GAAW;QACrC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,6BAA6B,GAAG,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QAClF,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;IACvC,CAAC;CACF;AA3bD,4BA2bC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nevermined-io/payments",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Typescript SDK to interact with the Nevermined Payments Protocol",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -29,6 +29,7 @@
29
29
  "eslint-config-nevermined": "^0.2.0",
30
30
  "eslint-config-next": "^14.1.0",
31
31
  "eslint-config-prettier": "^9.1.0",
32
+ "eslint-plugin-tsdoc": "^0.2.17",
32
33
  "prettier": "^3.2.5",
33
34
  "ts-node": "^10.9.2",
34
35
  "tslib": "^2.6.2",