Skip to content

Commit

Permalink
feat(calls): add new params to callOffer (#55)
Browse files Browse the repository at this point in the history
* feat: add to callOffer new params

* fix: add offerStartTime
  • Loading branch information
lotharking authored Dec 2, 2024
1 parent e77fb12 commit c5aca5d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
12 changes: 9 additions & 3 deletions packages/calls/src/DidCommCallsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ import { CallRejectMessage } from './messages/CallRejectMessage'

@scoped(Lifecycle.ContainerScoped)
export class DidCommCallsService {
public createOffer(options: { callType: DidCommCallType; parameters: Record<string, unknown> }) {
const { callType, parameters } = options
return new CallOfferMessage({ callType, parameters })
public createOffer(options: {
callType: DidCommCallType
offerExpirationTime?: Date
offerStartTime?: Date
description: string
parameters: Record<string, unknown>
}) {
const { callType, offerExpirationTime, offerStartTime, description, parameters } = options
return new CallOfferMessage({ callType, offerExpirationTime, offerStartTime, description, parameters })
}

public createAccept(options: { threadId?: string; parameters: Record<string, unknown> }) {
Expand Down
13 changes: 11 additions & 2 deletions packages/calls/src/DidcommCallsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ export class DidCommCallsApi {
public async offer(options: {
connectionId: string
callType: DidCommCallType
offerExpirationTime?: Date
offerStartTime?: Date
description: string
parameters: Record<string, unknown>
}) {
const { connectionId, callType, parameters } = options
const { connectionId, callType, offerExpirationTime, offerStartTime, description, parameters } = options
const connection = await this.connectionService.getById(this.agentContext, connectionId)
connection.assertReady()

const message = this.didcommCallsService.createOffer({ callType, parameters })
const message = this.didcommCallsService.createOffer({
callType,
offerExpirationTime,
offerStartTime,
description,
parameters,
})

const outbound = new OutboundMessageContext(message, {
agentContext: this.agentContext,
Expand Down
1 change: 1 addition & 0 deletions packages/calls/tests/DidCommCallsService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('Didcomm Calls', () => {
test('Should create a valid https://didcomm.org/calls/1.0/call-offer message ', async () => {
const message = didcommCallsService.createOffer({
callType: 'video',
description: 'new Call Offer',
parameters: { param: 'value' },
})

Expand Down

0 comments on commit c5aca5d

Please sign in to comment.