Skip to content

feat: ring individual members #105

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
27 changes: 9 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,57 @@

## [0.4.24](https://github.com/GetStream/stream-node/compare/v0.4.23...v0.4.24) (2025-05-06)


### Features

* empty commit to trigger release ([c0890a8](https://github.com/GetStream/stream-node/commit/c0890a8d8b7adc96d4d81717220159321e924480))
- empty commit to trigger release ([c0890a8](https://github.com/GetStream/stream-node/commit/c0890a8d8b7adc96d4d81717220159321e924480))

## [0.4.23](https://github.com/GetStream/stream-node/compare/v0.4.22...v0.4.23) (2025-04-30)


### Features

* update to v171.1.7 ([#107](https://github.com/GetStream/stream-node/issues/107)) ([dd442f0](https://github.com/GetStream/stream-node/commit/dd442f0e6b9acc465781cb748e5c5a03dd51624c))
- update to v171.1.7 ([#107](https://github.com/GetStream/stream-node/issues/107)) ([dd442f0](https://github.com/GetStream/stream-node/commit/dd442f0e6b9acc465781cb748e5c5a03dd51624c))

## [0.4.22](https://github.com/GetStream/stream-node/compare/v0.4.21...v0.4.22) (2025-04-09)


### Bug Fixes

* handle missing optional dependency in declarations ([#103](https://github.com/GetStream/stream-node/issues/103)) ([eb271c5](https://github.com/GetStream/stream-node/commit/eb271c5f3bfb6002d341323af25beabd15516ef2))
- handle missing optional dependency in declarations ([#103](https://github.com/GetStream/stream-node/issues/103)) ([eb271c5](https://github.com/GetStream/stream-node/commit/eb271c5f3bfb6002d341323af25beabd15516ef2))

## [0.4.21](https://github.com/GetStream/stream-node/compare/v0.4.20...v0.4.21) (2025-04-08)


### Bug Fixes

* remove undici dependency ([#101](https://github.com/GetStream/stream-node/issues/101)) ([c943be1](https://github.com/GetStream/stream-node/commit/c943be1b2871b2b010dd4b29d690c46ecacda23b))
- remove undici dependency ([#101](https://github.com/GetStream/stream-node/issues/101)) ([c943be1](https://github.com/GetStream/stream-node/commit/c943be1b2871b2b010dd4b29d690c46ecacda23b))

## [0.4.20](https://github.com/GetStream/stream-node/compare/v0.4.19...v0.4.20) (2025-04-07)


### Features

* set max connections to 100, allow integrators to configure Fetch API ([#98](https://github.com/GetStream/stream-node/issues/98)) ([b044b59](https://github.com/GetStream/stream-node/commit/b044b599867a69b33b3aa9d989d1c1e3277dc92f))
- set max connections to 100, allow integrators to configure Fetch API ([#98](https://github.com/GetStream/stream-node/issues/98)) ([b044b59](https://github.com/GetStream/stream-node/commit/b044b599867a69b33b3aa9d989d1c1e3277dc92f))

## [0.4.19](https://github.com/GetStream/stream-node/compare/v0.4.18...v0.4.19) (2025-03-17)


### Features

* update to API spec v163.0.0 ([#96](https://github.com/GetStream/stream-node/issues/96)) ([dcdfea8](https://github.com/GetStream/stream-node/commit/dcdfea8cfbf83b0ef3426426909c844424f682ab))
- update to API spec v163.0.0 ([#96](https://github.com/GetStream/stream-node/issues/96)) ([dcdfea8](https://github.com/GetStream/stream-node/commit/dcdfea8cfbf83b0ef3426426909c844424f682ab))

## [0.4.18](https://github.com/GetStream/stream-node/compare/v0.4.17...v0.4.18) (2025-03-10)


### Bug Fixes

* support realtime AI model overrides ([#94](https://github.com/GetStream/stream-node/issues/94)) ([1071f75](https://github.com/GetStream/stream-node/commit/1071f75aaf7ffb029f8c3c4c06465e81abf341d6))
- support realtime AI model overrides ([#94](https://github.com/GetStream/stream-node/issues/94)) ([1071f75](https://github.com/GetStream/stream-node/commit/1071f75aaf7ffb029f8c3c4c06465e81abf341d6))

## [0.4.17](https://github.com/GetStream/stream-node/compare/v0.4.16...v0.4.17) (2025-03-06)


### Bug Fixes

* use an exact version of @stream-io/openai-realtime-api ([#92](https://github.com/GetStream/stream-node/issues/92)) ([d6f0419](https://github.com/GetStream/stream-node/commit/d6f0419f924bfdadbb44d2b12b44a664bb4b39a6))
- use an exact version of @stream-io/openai-realtime-api ([#92](https://github.com/GetStream/stream-node/issues/92)) ([d6f0419](https://github.com/GetStream/stream-node/commit/d6f0419f924bfdadbb44d2b12b44a664bb4b39a6))

## [0.4.16](https://github.com/GetStream/stream-node/compare/v0.4.15...v0.4.16) (2025-02-25)


### Bug Fixes

* update changelog ([#89](https://github.com/GetStream/stream-node/issues/89)) ([1b46c91](https://github.com/GetStream/stream-node/commit/1b46c919ccc5a98414ca441b833020743217e95d))
- update changelog ([#89](https://github.com/GetStream/stream-node/issues/89)) ([1b46c91](https://github.com/GetStream/stream-node/commit/1b46c919ccc5a98414ca441b833020743217e95d))

## [0.4.15](https://github.com/GetStream/stream-node/compare/v0.4.14...v0.4.15) (2025-02-25)

Expand Down
67 changes: 67 additions & 0 deletions __tests__/ring-call.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { createTestClient } from './create-test-client';
import { StreamCall } from '../src/StreamCall';
import { StreamClient } from '../src/StreamClient';
import { v4 as uuidv4 } from 'uuid';

describe('ring call API', () => {
let client: StreamClient;
const callId = `call${uuidv4()}`;
let call: StreamCall;

beforeAll(async () => {
client = createTestClient();

call = client.video.call('default', callId);

await client.upsertUsers([
{ id: 'myself' },
{ id: 'my-friend' },
{ id: 'my-other-friend' },
]);
});

it(`create call without ringing`, async () => {
const response = await call.getOrCreate({
ring: false, // set to false to avoid ringing the whole call
data: {
created_by_id: 'myself',
members: [{ user_id: 'myself' }, { user_id: 'my-friend' }],
},
});

// Dummy expect
expect(response.call.id).toBe(callId);
});

it(`ring my-friend`, async () => {
const response = await call.ring({ member_ids: ['my-friend'] });

// Dummy expect
expect(response.call.id).toBe(callId);
});

it(`ring my-other-friend`, async () => {
await call.updateCallMembers({
update_members: [{ user_id: 'my-other-friend' }],
});
const response = await call.ring({ member_ids: ['my-other-friend'] });

// Dummy expect
expect(response.call.id).toBe(callId);
});

it('delete call', async () => {
try {
await call.delete({ hard: true });
} catch (e) {
// the first request fails on backend sometimes
// retry it
await new Promise<void>((resolve) => {
setTimeout(() => resolve(), 2000);
});

await call.delete({ hard: true });
}
});
});
9 changes: 9 additions & 0 deletions src/StreamCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ export class StreamCall extends CallApi {

create = this.getOrCreate;

ring = (params: { member_ids?: string[] }) => {
return this.videoApi.getCall({
...params,
id: this.id,
type: this.type,
ring: true,
});
};

queryMembers = (request?: OmitTypeId<QueryCallMembersRequest>) => {
return this.videoApi.queryCallMembers({
id: this.id,
Expand Down
2 changes: 2 additions & 0 deletions src/gen/model-decoders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ decoders.CallResponse = (input?: Record<string, any>) => {

decoders.CallSessionResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
created_at: { type: 'DatetimeType', isSingle: true },

participants: { type: 'CallParticipantResponse', isSingle: false },

accepted_by: { type: 'DatetimeType', isSingle: false },
Expand Down
2 changes: 2 additions & 0 deletions src/gen/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,8 @@ export interface CallSessionParticipantLeftEvent {
export interface CallSessionResponse {
anonymous_participant_count: number;

created_at: Date;

id: string;

participants: CallParticipantResponse[];
Expand Down
7 changes: 4 additions & 3 deletions src/gen/video/CallApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import {
StartFrameRecordingRequest,
StartFrameRecordingResponse,
StartHLSBroadcastingResponse,
StartRTMPBroadcastsRequest,
StartRTMPBroadcastsResponse,
StartRecordingRequest,
StartRecordingResponse,
StartRTMPBroadcastsRequest,
StartRTMPBroadcastsResponse,
StartTranscriptionRequest,
StartTranscriptionResponse,
StopAllRTMPBroadcastsResponse,
Expand All @@ -44,9 +44,9 @@ import {
StopHLSBroadcastingResponse,
StopLiveRequest,
StopLiveResponse,
StopRecordingResponse,
StopRTMPBroadcastsRequest,
StopRTMPBroadcastsResponse,
StopRecordingResponse,
StopTranscriptionRequest,
StopTranscriptionResponse,
UnblockUserRequest,
Expand All @@ -73,6 +73,7 @@ export class CallApi {
ring?: boolean;
notify?: boolean;
video?: boolean;
member_ids?: string[];
}): Promise<StreamResponse<GetCallResponse>> => {
return this.videoApi.getCall({ id: this.id, type: this.type, ...request });
};
Expand Down
12 changes: 7 additions & 5 deletions src/gen/video/VideoApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import {
QueryCallMembersResponse,
QueryCallParticipantsRequest,
QueryCallParticipantsResponse,
QueryCallStatsRequest,
QueryCallStatsResponse,
QueryCallsRequest,
QueryCallsResponse,
QueryCallStatsRequest,
QueryCallStatsResponse,
QueryUserFeedbackRequest,
QueryUserFeedbackResponse,
Response,
Expand All @@ -47,10 +47,10 @@ import {
StartFrameRecordingRequest,
StartFrameRecordingResponse,
StartHLSBroadcastingResponse,
StartRTMPBroadcastsRequest,
StartRTMPBroadcastsResponse,
StartRecordingRequest,
StartRecordingResponse,
StartRTMPBroadcastsRequest,
StartRTMPBroadcastsResponse,
StartTranscriptionRequest,
StartTranscriptionResponse,
StopAllRTMPBroadcastsResponse,
Expand All @@ -60,9 +60,9 @@ import {
StopHLSBroadcastingResponse,
StopLiveRequest,
StopLiveResponse,
StopRecordingResponse,
StopRTMPBroadcastsRequest,
StopRTMPBroadcastsResponse,
StopRecordingResponse,
StopTranscriptionRequest,
StopTranscriptionResponse,
UnblockUserRequest,
Expand Down Expand Up @@ -153,12 +153,14 @@ export class VideoApi extends BaseApi {
ring?: boolean;
notify?: boolean;
video?: boolean;
member_ids?: string[];
}): Promise<StreamResponse<GetCallResponse>> => {
const queryParams = {
members_limit: request?.members_limit,
ring: request?.ring,
notify: request?.notify,
video: request?.video,
member_ids: request?.member_ids,
};
const pathParams = {
type: request?.type,
Expand Down
Loading