()
| 97 | } |
| 98 | |
| 99 | async getPart() { |
| 100 | const userid = await this.getUserId(); |
| 101 | |
| 102 | let statusPart = ''; |
| 103 | let sorting = ''; |
| 104 | |
| 105 | const order = this.getOrder(this.sort); |
| 106 | if (order) { |
| 107 | sorting = `&sort=${order}`; |
| 108 | } |
| 109 | |
| 110 | if (this.status !== definitions.status.All) { |
| 111 | const statusTemp = helper.translateList(this.status, this.status); |
| 112 | statusPart = `&filter[status]=${statusTemp}`; |
| 113 | } |
| 114 | |
| 115 | con.log( |
| 116 | '[UserList][Kitsu]', |
| 117 | `user: ${userid}`, |
| 118 | `status: ${this.status}`, |
| 119 | `offset: ${this.offset}`, |
| 120 | ); |
| 121 | |
| 122 | return helper |
| 123 | .apiCall( |
| 124 | 'GET', |
| 125 | `https://kitsu.app/api/edge/library-entries?filter[user_id]=${userid}${statusPart}&filter[kind]=${ |
| 126 | this.listType |
| 127 | }&page[offset]=${this.offset}&page[limit]=50${sorting}&include=${this.listType},${ |
| 128 | this.listType |
| 129 | }.mappings,${this.listType}.mappings.item&fields[${ |
| 130 | this.listType |
| 131 | }]=slug,titles,canonicalTitle,averageRating,posterImage,coverImage,${ |
| 132 | this.listType === 'anime' ? 'episodeCount' : 'chapterCount,volumeCount' |
| 133 | }`, |
| 134 | ) |
| 135 | .then(res => { |
| 136 | con.log(res); |
| 137 | |
| 138 | this.offset += 50; |
| 139 | |
| 140 | if (!(res.meta.count > this.offset)) { |
| 141 | this.done = true; |
| 142 | } |
| 143 | |
| 144 | return this.prepareData(res, this.listType); |
| 145 | }); |
| 146 | } |
| 147 | |
| 148 | private async prepareData(data, listType): Promise<listElement[]> { |
| 149 | const newData = [] as listElement[]; |
nothing calls this directly
no test coverage detected