diff --git a/src/keri/app/signify.ts b/src/keri/app/signify.ts index fc15e18f..f5dee32e 100644 --- a/src/keri/app/signify.ts +++ b/src/keri/app/signify.ts @@ -420,14 +420,6 @@ export class SignifyClient { escrows(): Escrows { return new Escrows(this) } - - /** - * Get messages resource - * @returns {Messages} - * */ - messages(): Messages { - return new Messages(this) - } } /** Arguments required to create an identfier */ @@ -1809,52 +1801,3 @@ export class Escrows { return await res.json() } } - - -/** - * Messages - */ - -export class Messages { - client: SignifyClient - - /** - * Messages - * @param {SignifyClient} client - */ - constructor(client: SignifyClient) { - this.client = client - } - - /** - * List messages - * @async - * @param {string} [sender] sender prefix to filter messages - * @param {string} [recipient] recipient prefix to filter messages - * @param {number} [start=0] Start index of list of messages, defaults to 0 - * @param {number} [end=9] End index of list of messages, defaults to 9 - */ - async list(sender:string, recipient:string, start:number=0, end:number=9): Promise { - let extraHeaders = new Headers() - extraHeaders.append('Range', `messages=${start}-${end}`) - let params = new URLSearchParams() - //check sender and recipient are send otherwise return error - if (sender !== undefined) {params.append('sender', sender)} - if (recipient !== undefined) {params.append('recipient', recipient)} - - - let path = `/messages`+ '?' + params.toString() - let method = 'GET' - let res = await this.client.fetch(path, method, null, extraHeaders) - let cr = res.headers.get('content-range') - let range = parseRangeHeaders(cr,"messages") - let msgs = await res.json() - - return { - start: range.start, - end: range.end, - total: range.total, - messages: msgs - } - } -} \ No newline at end of file diff --git a/test/app/signify.test.ts b/test/app/signify.test.ts index 8e4547a5..52e978d7 100644 --- a/test/app/signify.test.ts +++ b/test/app/signify.test.ts @@ -723,24 +723,5 @@ describe('SignifyClient', () => { assert.equal(lastCall[1]!.method,'GET') }) - - it('Messages', async () => { - await libsodium.ready; - const bran = "0123456789abcdefghijk" - - let client = new SignifyClient(url,bran,Tier.low,boot_url) - - await client.boot() - await client.connect() - - let messages = client.messages() - - await messages.list('ELI7pg979AdhmvrjDeam2eAO2SR5niCgnjAJXJHtJose','EMQQpnSkgfUOgWdzQTWfrgiVHKIDAhvAZIPQ6z3EAfz1',0, 10) - let lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length-1]! - assert.equal(lastCall[0]!,url+'/messages?sender=ELI7pg979AdhmvrjDeam2eAO2SR5niCgnjAJXJHtJose&recipient=EMQQpnSkgfUOgWdzQTWfrgiVHKIDAhvAZIPQ6z3EAfz1') - assert.equal(lastCall[1]!.method,'GET') - - let lastHeaders = new Headers((lastCall[1]!.headers!)) - assert.equal(lastHeaders.get('Range'),'messages=0-10') - }) + }) \ No newline at end of file