npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@andev2005/movie-glu-sdk

v1.0.8

Published

SDK Node.js/TypeScript để gọi MovieGlu API (phim đang chiếu, phim sắp chiếu, rạp gần đây, chi tiết phim/rạp, lịch chiếu).

Downloads

850

Readme

@andev2005/movie-glu-sdk

SDK Node.js/TypeScript để gọi MovieGlu API (phim đang chiếu, phim sắp chiếu, rạp gần đây, chi tiết phim/rạp, lịch chiếu).

Cài đặt

pnpm add @andev2005/movie-glu-sdk

Hoặc:

npm i @andev2005/movie-glu-sdk

Yêu cầu

  • Runtime có fetch (Node.js 18+) hoặc truyền fetch custom vào client

Sử dụng nhanh

TypeScript / JavaScript

import { createMovieGluClient } from '@andev2005/movie-glu-sdk';

const movieGlu = createMovieGluClient({
  // apiKey là optional, mặc định đã được gắn theo cấu hình ANDE/XX
  // apiKey: process.env.MOVIE_GLU_API_KEY,
});

async function main() {
  const nowShowing = await movieGlu.films.nowShowing({ limit: 10 });
  console.log(nowShowing.films);

  const comingSoon = await movieGlu.films.comingSoon({ limit: 10 });
  console.log(comingSoon.films);

  const cinemas = await movieGlu.cinemas.nearby({ limit: 5 });
  console.log(cinemas.cinemas);
}

main().catch(console.error);

Khởi tạo client

import { createMovieGluClient } from '@andev2005/movie-glu-sdk';

const client = createMovieGluClient({
  // Tuỳ chọn:
  // baseUrl: 'https://api-gate2.movieglu.com',
  // headers: { 'x-custom-header': 'value' },
  // fetch: customFetch, // dùng khi môi trường không có global fetch
});

API hiện có

films

// Phim đang chiếu (limit optional, default 10)
await client.films.nowShowing({ limit: 10 });

// Phim sắp chiếu (limit optional, default 10)
await client.films.comingSoon({ limit: 10 });

// Chi tiết phim
await client.films.details(12345);

// Chi tiết phim + size_category
await client.films.details({
  filmId: 12345,
  sizeCategory: ['small', 'medium'],
});

// Lịch chiếu theo phim + ngày
await client.films.showTimes({
  filmId: 12345,
  date: '2026-02-25',
  limit: 10,
});

cinemas

// Rạp gần đây
await client.cinemas.nearby({ limit: 10 });

// Chi tiết rạp
await client.cinemas.details(1001);

// Lịch chiếu rạp theo ngày
await client.cinemas.showTimes({
  cinemaId: 1001,
  date: '2026-02-25', // YYYY-MM-DD
});

Lọc lịch chiếu theo phim + sắp xếp

import { SORT_TYPE } from '@andev2005/movie-glu-sdk';

await client.cinemas.showTimes({
  cinemaId: 1001,
  filmId: 12345,
  date: '2026-02-25',
  sort: SORT_TYPE.POPULARITY, // hoặc SORT_TYPE.ALPHABETICAL
});

Xử lý lỗi

SDK sẽ throw MovieGluError nếu request thất bại (HTTP status không thành công).

Mỗi request tự động gửi các header mặc định:

  • client: ANDE
  • x-api-key: Bcg2m9aHOI8QSg5h8EDNK8ecPZRTiove3dsbZVuz
  • authorization: Basic QU5ERV9YWDpWMEhoUjYzSHZOalM=
  • territory: XX
  • api-version: v201
  • geolocation: -22.0;14.0
  • device-datetime: <ISO datetime hiện tại>
import { MovieGluError } from '@andev2005/movie-glu-sdk';

try {
  const data = await client.films.nowShowing({ limit: 10 });
  console.log(data);
} catch (error) {
  if (error instanceof MovieGluError) {
    console.error('MovieGluError:', error.message);
    console.error('status:', error.status);
    console.error('details:', error.details);
  } else {
    console.error(error);
  }
}

Validate tham số

SDK có kiểm tra đầu vào và sẽ throw TypeError nếu:

  • apiKey rỗng (nếu bạn truyền vào)
  • limit không phải số nguyên dương
  • id/filmId/cinemaId không phải số nguyên dương
  • sizeCategory không thuộc small|medium|large|xlarge|xxlarge
  • date không đúng định dạng YYYY-MM-DD

Utility build URL (tuỳ chọn)

Nếu bạn chỉ muốn lấy URL endpoint (không gửi request), có thể dùng MOVIE_GLU:

import { MOVIE_GLU } from '@andev2005/movie-glu-sdk';

const url = MOVIE_GLU.FILM_NOWSHOWING(10);
console.log(url);

Các helper có sẵn:

  • MOVIE_GLU.FILM_NOWSHOWING(limit)
  • MOVIE_GLU.CINEMA_NEARBY(limit)
  • MOVIE_GLU.FILMS_COMING_SOON(limit)
  • MOVIE_GLU.FILM_SHOWTIME({ filmId, date, limit? })
  • MOVIE_GLU.FILMS_DETAIL(idOrParams)
  • MOVIE_GLU.CINEMA_DETAIL(id)
  • MOVIE_GLU.CINEMA_SHOWTIME({ cinemaId, date, filmId?, sort? })

Export chính

  • createMovieGluClient
  • MOVIE_GLU
  • SORT_TYPE
  • MovieGluError
  • Tất cả TypeScript types (FilmDetailsResponse, CinemaShowTimesResponse, ...)

Build package

npm run build