How to use the superstruct.struct.pick function in superstruct

To help you get started, we’ve selected a few superstruct 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 Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
})
  })]
});

const ActivitiesResponse = struct.pick({
  items: [struct.pick({
    contentDetails: struct.pick({
      upload: struct.pick({
        videoId: 'string'
      })
    }),
  })],
  nextPageToken: 'string?'
});

const VideosResponse = struct.pick({
  items: [struct.pick({
    id: 'string',
    snippet: struct.pick({
      publishedAt: 'string', // 2007-03-05T08:22:25.000Z
      channelId: 'string',
      title: 'string',
      // description: 'string',
      thumbnails: struct.record(['string', struct.pick({
        url: 'string',
        width: 'number',
        height: 'number',
      })]),
      channelTitle: 'string',
      // tags: ['string'],
      // categoryId: 'string', // 10
      // liveBroadcastContent: 'string', // none
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
id: struct.pick({
      channelId: 'string'
    })
  })]
});

const SearchItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string',
      channelTitle: 'string'
    })
  })]
});

const ActivitiesResponse = struct.pick({
  items: [struct.pick({
    contentDetails: struct.pick({
      upload: struct.pick({
        videoId: 'string'
      })
    }),
  })],
  nextPageToken: 'string?'
});

const VideosResponse = struct.pick({
  items: [struct.pick({
    id: 'string',
    snippet: struct.pick({
      publishedAt: 'string', // 2007-03-05T08:22:25.000Z
      channelId: 'string',
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
})]
});

const SearchItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string',
      channelTitle: 'string'
    })
  })]
});

const ActivitiesResponse = struct.pick({
  items: [struct.pick({
    contentDetails: struct.pick({
      upload: struct.pick({
        videoId: 'string'
      })
    }),
  })],
  nextPageToken: 'string?'
});

const VideosResponse = struct.pick({
  items: [struct.pick({
    id: 'string',
    snippet: struct.pick({
      publishedAt: 'string', // 2007-03-05T08:22:25.000Z
      channelId: 'string',
      title: 'string',
      // description: 'string',
      thumbnails: struct.record(['string', struct.pick({
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
// description: 'string',
      thumbnails: struct.record(['string', struct.pick({
        url: 'string',
        width: 'number',
        height: 'number',
      })]),
      channelTitle: 'string',
      // tags: ['string'],
      // categoryId: 'string', // 10
      // liveBroadcastContent: 'string', // none
      // localized: struct.pick({
      //   title: 'string',
      //   description: 'string',
      // })
    }),
    contentDetails: struct.pick({
      duration: 'string', // PT2M57S
      // dimension: 'string', // 2d
      // definition: 'string', // sd
      // caption: 'string', // false
      // licensedContent: 'boolean', // true
      // projection: 'string', // rectangular
    }),
  })],
  nextPageToken: 'string?'
});

class Youtube {
  constructor(/**Main*/main) {
    this.main = main;
    this.id = 'youtube';
    this.name = 'Youtube';
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
const debug = require('debug')('app:Youtube');

const rateLimit = new RateLimit(1000);
const gotLimited = rateLimit.wrap((url, options) => {
  return gotLockTimeout(got(url, options), 2.5 * 60 * 1000);
});

const VideosItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string'
    })
  })]
});

const ChannelsItemsId = struct.pick({
  items: [struct.pick({
    id: 'string'
  })],
  nextPageToken: 'string?'
});

const SearchItemsId = struct.pick({
  items: [struct.pick({
    id: struct.pick({
      channelId: 'string'
    })
  })]
});

const SearchItemsSnippet = struct.pick({
  items: [struct.pick({
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
import arrayByPart from "../tools/arrayByPart";
import parallel from "../tools/parallel";
import formatDuration from "../tools/formatDuration";
import ensureMap from "../tools/ensureMap";
import promiseTry from "../tools/promiseTry";
import {gotLockTimeout} from "../tools/gotWithTimeout";

const got = require('got');
const debug = require('debug')('app:Youtube');

const rateLimit = new RateLimit(1000);
const gotLimited = rateLimit.wrap((url, options) => {
  return gotLockTimeout(got(url, options), 2.5 * 60 * 1000);
});

const VideosItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string'
    })
  })]
});

const ChannelsItemsId = struct.pick({
  items: [struct.pick({
    id: 'string'
  })],
  nextPageToken: 'string?'
});

const SearchItemsId = struct.pick({
  items: [struct.pick({
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
const VideosItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string'
    })
  })]
});

const ChannelsItemsId = struct.pick({
  items: [struct.pick({
    id: 'string'
  })],
  nextPageToken: 'string?'
});

const SearchItemsId = struct.pick({
  items: [struct.pick({
    id: struct.pick({
      channelId: 'string'
    })
  })]
});

const SearchItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string',
      channelTitle: 'string'
    })
  })]
});
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string'
    })
  })]
});

const ChannelsItemsId = struct.pick({
  items: [struct.pick({
    id: 'string'
  })],
  nextPageToken: 'string?'
});

const SearchItemsId = struct.pick({
  items: [struct.pick({
    id: struct.pick({
      channelId: 'string'
    })
  })]
});

const SearchItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string',
      channelTitle: 'string'
    })
  })]
});

const ActivitiesResponse = struct.pick({
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
id: 'string'
  })],
  nextPageToken: 'string?'
});

const SearchItemsId = struct.pick({
  items: [struct.pick({
    id: struct.pick({
      channelId: 'string'
    })
  })]
});

const SearchItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string',
      channelTitle: 'string'
    })
  })]
});

const ActivitiesResponse = struct.pick({
  items: [struct.pick({
    contentDetails: struct.pick({
      upload: struct.pick({
        videoId: 'string'
      })
    }),
  })],
  nextPageToken: 'string?'
});
github Feverqwe / ytWatchBot / src / services / youtube.js View on Github external
const ChannelsItemsId = struct.pick({
  items: [struct.pick({
    id: 'string'
  })],
  nextPageToken: 'string?'
});

const SearchItemsId = struct.pick({
  items: [struct.pick({
    id: struct.pick({
      channelId: 'string'
    })
  })]
});

const SearchItemsSnippet = struct.pick({
  items: [struct.pick({
    snippet: struct.pick({
      channelId: 'string',
      channelTitle: 'string'
    })
  })]
});

const ActivitiesResponse = struct.pick({
  items: [struct.pick({
    contentDetails: struct.pick({
      upload: struct.pick({
        videoId: 'string'
      })
    }),
  })],