Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(calls): add new params to callOffer #55

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can also add offerStartTime to make all message parameters available.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

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
Loading