@@ -347,43 +347,37 @@ export interface ILogger {
347
347
export interface INetworkClient {
348
348
/**
349
349
* Get data asynchronously.
350
+ * @param data The data to send.
350
351
* @param additionalPath An additional path append to the endpoint path.
351
352
* @param additionalHeaders Extra headers to send with the request.
352
353
* @returns Promise which resolves to the object returned or rejects with error.
353
354
*/
354
- get ( additionalPath ?: string , additionalHeaders ?: {
355
+ get ( data : {
356
+ [ key : string ] : any ;
357
+ } , additionalPath ?: string , additionalHeaders ?: {
355
358
[ header : string ] : string ;
356
359
} ) : Promise < string > ;
357
360
/**
358
361
* Post data asynchronously.
359
- * @param additionalPath An additional path append to the endpoint path.
360
362
* @param data The data to send.
363
+ * @param additionalPath An additional path append to the endpoint path.
361
364
* @param additionalHeaders Extra headers to send with the request.
362
365
* @returns Promise which resolves to the object returned or rejects with error.
363
366
*/
364
367
post ( data : string , additionalPath ?: string , additionalHeaders ?: {
365
368
[ header : string ] : string ;
366
369
} ) : Promise < string > ;
367
370
/**
368
- * Get data as JSON asynchronously.
369
- * @typeparam U The generic type for the returned object.
370
- * @param additionalPath An additional path append to the endpoint path.
371
- * @param additionalHeaders Extra headers to send with the request.
372
- * @returns Promise which resolves to the object returned or rejects with error.
373
- */
374
- getJson < U > ( additionalPath ?: string , additionalHeaders ?: {
375
- [ header : string ] : string ;
376
- } ) : Promise < U > ;
377
- /**
378
- * Post data as JSON asynchronously.
371
+ * Request data as JSON asynchronously.
379
372
* @typeparam T The generic type for the object to send.
380
373
* @typeparam U The generic type for the returned object.
381
- * @param data The data to send.
374
+ * @param data The data to send as the JSON body.
375
+ * @param method The method to send with the request.
382
376
* @param additionalPath An additional path append to the endpoint path.
383
377
* @param additionalHeaders Extra headers to send with the request.
384
378
* @returns Promise which resolves to the object returned or rejects with error.
385
379
*/
386
- postJson < T , U > ( data : T , additionalPath ?: string , additionalHeaders ?: {
380
+ json < T , U > ( data ? : T , method ?: NetworkMethod , additionalPath ?: string , additionalHeaders ?: {
387
381
[ header : string ] : string ;
388
382
} ) : Promise < U > ;
389
383
/**
@@ -511,6 +505,11 @@ export interface ITimeService {
511
505
msSinceEpoch ( ) : number ;
512
506
}
513
507
508
+ /**
509
+ * Represents the http request methods.
510
+ */
511
+ export type NetworkMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" ;
512
+
514
513
/**
515
514
* Represents the protocols for communicating.
516
515
*/
@@ -608,6 +607,12 @@ export class NetworkEndPoint implements INetworkEndPoint {
608
607
* @param rootPath The path to the endpoint.
609
608
*/
610
609
constructor ( protocol : NetworkProtocol , host : string , port : number , rootPath ?: string ) ;
610
+ /**
611
+ * Create a network endpoint by parsing a uri.
612
+ * @param uri The uri to parse.
613
+ * @returns The network endpoint.
614
+ */
615
+ static fromUri ( uri : string ) : INetworkEndPoint ;
611
616
/**
612
617
* The protocol to access the endpoint with.
613
618
* @returns The protocol.
@@ -2348,7 +2353,19 @@ export class BusinessError extends CoreError {
2348
2353
} , innerError ?: Error ) ;
2349
2354
}
2350
2355
2351
- export { } ;
2356
+ /**
2357
+ * Helper class for address signing.
2358
+ * Original https://github.com/iotaledger/iota.lib.js/blob/master/lib/crypto/signing/signing.js
2359
+ */
2360
+ export class AddressHelper {
2361
+ /**
2362
+ * Create a checksum for the trits.
2363
+ * @param trits The trits to create the checksum for.
2364
+ * @param checksumLength The length of the checksum.
2365
+ * @returns the checksum as trytes.
2366
+ */
2367
+ static createChecksum ( trits : Int8Array , checksumLength : number ) : string ;
2368
+ }
2352
2369
2353
2370
/**
2354
2371
* Helper class for signing bundles.
@@ -3045,11 +3062,14 @@ export class NetworkClient implements INetworkClient {
3045
3062
constructor ( networkEndPoint : INetworkEndPoint , logger ?: ILogger , timeoutMs ?: number ) ;
3046
3063
/**
3047
3064
* Get data asynchronously.
3065
+ * @param data The data to send.
3048
3066
* @param additionalPath An additional path append to the endpoint path.
3049
3067
* @param additionalHeaders Extra headers to send with the request.
3050
3068
* @returns Promise which resolves to the object returned or rejects with error.
3051
3069
*/
3052
- get ( additionalPath ?: string , additionalHeaders ?: {
3070
+ get ( data : {
3071
+ [ key : string ] : any ;
3072
+ } , additionalPath ?: string , additionalHeaders ?: {
3053
3073
[ header : string ] : string ;
3054
3074
} ) : Promise < string > ;
3055
3075
/**
@@ -3063,25 +3083,16 @@ export class NetworkClient implements INetworkClient {
3063
3083
[ header : string ] : string ;
3064
3084
} ) : Promise < string > ;
3065
3085
/**
3066
- * Get data as JSON asynchronously.
3067
- * @typeparam U The generic type for the returned object.
3068
- * @param additionalPath An additional path append to the endpoint path.
3069
- * @param additionalHeaders Extra headers to send with the request.
3070
- * @returns Promise which resolves to the object returned or rejects with error.
3071
- */
3072
- getJson < U > ( additionalPath ?: string , additionalHeaders ?: {
3073
- [ header : string ] : string ;
3074
- } ) : Promise < U > ;
3075
- /**
3076
- * Post data as JSON asynchronously.
3086
+ * Request data as JSON asynchronously.
3077
3087
* @typeparam T The generic type for the object to send.
3078
3088
* @typeparam U The generic type for the returned object.
3079
- * @param data The data to send.
3089
+ * @param data The data to send as the JSON body.
3090
+ * @param method The method to send with the request.
3080
3091
* @param additionalPath An additional path append to the endpoint path.
3081
3092
* @param additionalHeaders Extra headers to send with the request.
3082
3093
* @returns Promise which resolves to the object returned or rejects with error.
3083
3094
*/
3084
- postJson < T , U > ( data : T , additionalPath ?: string , additionalHeaders ?: {
3095
+ json < T , U > ( data ? : T , method ?: NetworkMethod , additionalPath ?: string , additionalHeaders ?: {
3085
3096
[ header : string ] : string ;
3086
3097
} ) : Promise < U > ;
3087
3098
/**
0 commit comments