Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raity's changes #123

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
251 changes: 117 additions & 134 deletions src/app/feature/news/model/news-list.ts
Original file line number Diff line number Diff line change
@@ -1,135 +1,118 @@

export type Root = NewsList[]

export interface NewsList {
status: string;
count: number;
count_total: number;
pages: number;
posts: Post[];
query: Query;
}

export interface Query {
ignore_sticky_posts: boolean;
}

export interface Post {
id: number;
type: string;
slug: string;
url: string;
status: string;
title: string;
title_plain: string;
content: string;
excerpt: string;
date: string;
modified: string;
categories: Category[];
tags: Tag[];
author: Author;
comments: any[];
attachments: Attachment[];
comment_count: number;
comment_status: string;
thumbnail: string;
custom_fields: Customfields;
thumbnail_size: string;
thumbnail_images: Thumbnailimages;
}

export interface Thumbnailimages {
full: Full;
thumbnail: Full;
medium: Full;
medium_large: Full;
large: Full;
'1536x1536': Full;
'2048x2048': Full;
'mobile-320'?: Full;
'mobile-640'?: Full;
'mobile-360'?: Full;
'mobile-720'?: Full;
'mobile-1080'?: Full;
'tablet-768'?: Full;
'tablet-800'?: Full;
'tablet-1024'?: Full;
'tablet-1280': Full;
'jannah-image-small': Full;
'jannah-image-large': Full;
'jannah-image-post'?: Full;
}

export interface Customfields {
tie_post_head: string[];
tie_views: string[];
tie_primary_category?: string[];
}

export interface Attachment {
id: number;
url: string;
slug: string;
title: string;
description: string;
caption: string;
parent: number;
mime_type: string;
images?: Images;
}

export interface Images {
full: Full;
thumbnail: Full;
medium: Full;
medium_large: Full;
large: Full;
'1536x1536': Full;
'2048x2048': Full;
'mobile-320'?: Full;
'mobile-640'?: Full;
'mobile-360'?: Full;
'mobile-720'?: Full;
'mobile-1080'?: Full;
'tablet-768'?: Full;
'tablet-800'?: Full;
'tablet-1024'?: Full;
'tablet-1280': Full;
'jannah-image-small': Full;
'jannah-image-large': Full;
'jannah-image-post': Full;
}

export interface Full {
url: string;
width: number;
height: number;
}

export interface Author {
id: number;
slug: string;
name: string;
first_name: string;
last_name: string;
nickname: string;
url: string;
description: string;
}

export interface Tag {
id: number;
slug: string;
title: string;
description: string;
post_count: number;
}

export interface Category {
id: number;
slug: string;
title: string;
description: string;
parent: number;
post_count: number;
}


id: number
date: string
date_gmt: string
guid: Guid
modified: string
modified_gmt: string
slug: string
status: string
type: string
link: string
title: Title
content: Content
excerpt: Excerpt
author: number
featured_media: number
comment_status: string
ping_status: string
sticky: boolean
template: string
format: string
meta: Meta
categories: number[]
tags: number[]
_links: Links
}

export interface Guid {
rendered: string
}

export interface Title {
rendered: string
}

export interface Content {
rendered: string
protected: boolean
}

export interface Excerpt {
rendered: string
protected: boolean
}

export interface Meta {
footnotes: string
}

export interface Links {
self: Self[]
collection: Collection[]
about: About[]
author: Author[]
replies: Reply[]
"version-history": VersionHistory[]
"predecessor-version": PredecessorVersion[]
"wp:featuredmedia": Featuredmedum[]
"wp:attachment": WpAttachment[]
"wp:term": WpTerm[]
curies: Cury[]
}

export interface Self {
href: string
}

export interface Collection {
href: string
}

export interface About {
href: string
}

export interface Author {
embeddable: boolean
href: string
}

export interface Reply {
embeddable: boolean
href: string
}

export interface VersionHistory {
count: number
href: string
}

export interface PredecessorVersion {
id: number
href: string
}

export interface Featuredmedum {
embeddable: boolean
href: string
}

export interface WpAttachment {
href: string
}

export interface WpTerm {
taxonomy: string
embeddable: boolean
href: string
}

export interface Cury {
name: string
href: string
templated: boolean
}
2 changes: 1 addition & 1 deletion src/app/feature/news/services/news-repository.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export class NewsRepositoryService {

constructor(private readonly _http: HttpClient) { }
get getNewsList() {
return this._http.get<NewsList>("https://kdz.ir/fa/?json=get_posts");
return this._http.get<NewsList>("https://kdz.ir/wp-json/wp/v2/posts");
}
}