chore!: removed deprecated UserStarGift

This commit is contained in:
alina sireneva
2025-03-01 12:10:47 +03:00
parent 2f3d08fd94
commit 0de21b34b5
4 changed files with 0 additions and 100 deletions

View File

@@ -112,7 +112,6 @@ import {
UploadedFile,
UploadFileLike,
User,
UserStarGift,
UserStatusUpdate,
UserTypingUpdate,
WebPageMedia,

View File

@@ -1,35 +0,0 @@
import type { ITelegramClient } from '../../client.types.js'
import type { SavedStarGift } from '../../types/index.js'
import type { InputPeerLike } from '../../types/peers/peer.js'
import type { ArrayPaginated } from '../../types/utils.js'
import { getSavedStarGifts } from './get-saved-star-gifts.js'
/**
* Get a list of gifts sent to a user.
*
* @param userId User whose gifts to fetch
* @deprecated Use {@link getSavedStarGifts} instead
* @returns Gifts sent to the user
*/
export async function getStarGifts(
client: ITelegramClient,
userId: InputPeerLike,
params?: {
/**
* Offset for pagination.
*/
offset?: string
/**
* Maximum number of gifts to fetch.
*
* @default 100
*/
limit?: number
},
): Promise<ArrayPaginated<SavedStarGift, string>> {
return getSavedStarGifts(client, {
owner: userId,
...params,
})
}

View File

@@ -1,59 +0,0 @@
import type { ITelegramClient } from '../../client.types.js'
import type { InputPeerLike, UserStarGift } from '../../types/index.js'
import { resolvePeer } from '../users/resolve-peer.js'
import { getStarGifts } from './get-star-gifts.js'
// @available=user
/**
* Iterate over gifts sent to a given user.
*
* Wrapper over {@link getStarGifts}
*
* @param peerId Peer ID
* @param params Additional parameters
*/
export async function* iterStarGifts(
client: ITelegramClient,
peerId: InputPeerLike,
params?: Parameters<typeof getStarGifts>[2] & {
/**
* Total number of gifts to fetch
*
* @default Infinity, i.e. fetch all gifts
*/
limit?: number
/**
* Number of gifts to fetch per request
* Usually you don't need to change this
*
* @default 100
*/
chunkSize?: number
},
): AsyncIterableIterator<UserStarGift> {
if (!params) params = {}
const { limit = Infinity, chunkSize = 100 } = params
let { offset } = params
let current = 0
const peer = await resolvePeer(client, peerId)
for (;;) {
const res = await getStarGifts(client, peer, {
offset,
limit: Math.min(limit - current, chunkSize),
})
for (const gift of res) {
yield gift
if (++current >= limit) return
}
if (!res.next) return
offset = res.next
}
}

View File

@@ -91,8 +91,3 @@ export class SavedStarGift {
makeInspectable(SavedStarGift)
memoizeGetters(SavedStarGift, ['sender', 'gift'])
export {
/** @deprecated alias for {@link SavedStarGift} */
SavedStarGift as UserStarGift,
}