How to use the getstream.connect function in getstream

To help you get started, we’ve selected a few getstream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GetStream / Winds / api / src / shared / followPodcast.js View on Github external
// this is split out so that the auth controller can follow featured podcasts at user creation

import Follow from '../models/follow';
import config from '../config';
import stream from 'getstream';

const client = stream.connect(config.stream.apiKey, config.stream.apiSecret);

const followPodcast = (userID, podcastID) => {
	// couple things:
	// find follow relationship already in DB - if it exists, return it, don't send a 409
	// if not, create a new one, and:
	// timeline follows podcast
	// user_episode follows podcast
	let obj = {
		podcast: podcastID,
		user: userID,
	};
	return Follow.findOne(obj).then(existingFollow => {
		if (existingFollow) {
			// serialize podcast and user ids
			existingFollow.podcast = existingFollow.podcast._id;
			existingFollow.user = existingFollow.user._id;
github GetStream / Winds / api / src / commands / resync-follows.js View on Github external
import '../loadenv';
import '../utils/db';
import program from 'commander';
import logger from '../utils/logger';
import Follow from '../models/follow';
import { FollowSchema } from '../models/follow';
import asyncTasks from '../asyncTasks';

import stream from 'getstream';
import config from '../config';

const streamClient = stream.connect(config.stream.apiKey, config.stream.apiSecret);

program.parse(process.argv);

async function main() {
	logger.info(`time to resync those follows, \\0/`);

	let followCount = await Follow.count({});
	let chunkSize = 500;

	for (let i = 0, j = followCount; i < j; i += chunkSize) {
		let follows = await Follow.find({})
			.skip(i)
			.limit(chunkSize)
			.lean();
		logger.info(`found ${follows.length} follows`);
		let feedRelations = [];
github GetStream / Winds / api / src / controllers / share.js View on Github external
import stream from 'getstream';

import Share from '../models/share';

import config from '../config';
import logger from '../utils/logger';

const client = stream.connect(
	config.stream.apiKey,
	config.stream.apiSecret,
);

exports.list = (req, res) => {
	const page = parseInt(req.query.page, 10) || 0;
	const perPage = parseInt(req.query.per_page, 10) || 10;

	Share.find({ flags: { $lte: 5 } })
		.skip(perPage * page)
		.limit(perPage)
		.then(shares => {
			res.json(shares);
		})
		.catch(err => {
			logger.error(err);
github GetStream / mongodb-activity-feed / benchmark / utils.js View on Github external
export function getStreamClient() {
	let client = stream.connect(
		process.env.API_KEY,
		process.env.API_SECRET,
		process.env.APP_ID,
	)
	return client
}
github GetStream / react-native-activity-feed / src / Context / StreamApp.js View on Github external
constructor(props: StreamAppProps) {
    super(props);

    const client: StreamClient = stream.connect(
      this.props.apiKey,
      this.props.token,
      this.props.appId,
      this.props.options || {},
    );

    let analyticsClient;
    if (this.props.analyticsToken) {
      analyticsClient = new StreamAnalytics({
        apiKey: this.props.apiKey,
        token: this.props.analyticsToken,
      });
      analyticsClient.setUser(client.userId);
    }
    this.state = {
      client,
github domagojk / beenion / ports / http-query / checkLast.ts View on Github external
import 'source-map-support/register'
import { getUserId } from '../../infrastructure/authentication/getUserId'
import stream from 'getstream'
import md5 from 'md5'
import { userApi } from '../../infrastructure/databases/users/userApi'
import {
  makeErrorResponse,
  makeSuccessResponse
} from '../../infrastructure/http/makeResponse'

const getStreamClient = stream.connect(
  process.env.GETSTREAM_KEY,
  process.env.GETSTREAM_SECRET,
  process.env.GETSTREAM_APPID
)

let userIdUsernameCache = {}

async function getUsername(userId) {
  if (!userId) {
    return ''
  } else if (userIdUsernameCache[userId]) {
    return userIdUsernameCache[userId]
  } else {
    userIdUsernameCache = await userApi.listAllUsers()
    return userIdUsernameCache[userId]
  }
github GetStream / Winds / api / src / utils / stream.js View on Github external
export function getStreamClient() {
	if (streamClient === null) {
		streamClient = stream.connect(config.stream.apiKey, config.stream.apiSecret);
	}
	return streamClient;
}
github GetStream / react-native-activity-feed / src / Context.js View on Github external
constructor(props: StreamAppProps) {
    super(props);

    let client: StreamClient = stream.connect(
      this.props.apiKey,
      this.props.token,
      this.props.appId,
      this.props.options || {},
    );

    let analyticsClient;

    if (this.props.analyticsToken) {
      analyticsClient = new StreamAnalytics({
        apiKey: this.props.apiKey,
        token: this.props.analyticsToken,
      });
      analyticsClient.setUser(client.userId);
    }
    this.state = {
github GetStream / mongodb-activity-feed / src / benchmark / utils.js View on Github external
export function getStreamClient() {
	let client = stream.connect(
		SETTINGS.stream.key,
		SETTINGS.stream.secret,
		SETTINGS.stream.app_id,
	)
	return client
}

getstream

The official low-level GetStream.io client for Node.js and the browser.

BSD-3-Clause
Latest version published 1 year ago

Package Health Score

61 / 100
Full package analysis