Skip to content
ck edited this page Oct 6, 2024 · 2 revisions

GET /v2/news

async Get a list of all the news based on certain criteria.

Usage example

const { auth, v2 } = require('osu-api-extended');

async function main() {
  try {
    await auth.login({
      type: 'v2',
      client_id: CLIENT_ID,
      client_secret: CLIENT_SECRET,
      cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
    });

    const result = await v2.news.list();
    if (result.error != null) {
      console.log(result.error);
      return;
    };

    console.log(result);
  } catch (error) {
    console.log(error);
  };
};

main();
Parameter Type Description
params.from_year? string
params.limit? string
params.cursor_string? string
addons.legacy_only? boolean
addons.apiVersion? '20240130' '99999999'
addons.authKey? string
addons.timeout_ms? number
addons.ignoreSessionRefresh? boolean

Response

export interface NewsListResponse {
  news_posts: NewsPost[]
  news_sidebar: NewsSidebar
  search: Search
  cursor: Cursor
  cursor_string: string
}

export interface NewsPost {
  id: number
  author: string
  edit_url: string
  first_image: string
  published_at: string
  updated_at: string
  slug: string
  title: string
  preview: string
}

export interface NewsSidebar {
  current_year: number
  news_posts: NewsPost2[]
  years: number[]
}

export interface NewsPost2 {
  id: number
  author: string
  edit_url: string
  first_image: string
  published_at: string
  updated_at: string
  slug: string
  title: string
}

export interface Search {
  limit: number
  sort: string
  year: any
}

export interface Cursor {
  published_at: string
  id: number
}

[v3.x.x] Documentation


[v2.x.x] Documentation

Clone this wiki locally