@@ -15,8 +15,8 @@ import type {
1515import { cookie } from "./auth.ts" ;
1616import { parseHTTPError } from "./parseHTTPError.ts" ;
1717import { type HTTPError , responseIntoResult } from "./responseIntoResult.ts" ;
18- import type { AbortError , NetworkError } from "./robustFetch .ts" ;
19- import { type BaseOptions , setDefaults } from "./util .ts" ;
18+ import { type BaseOptions , setDefaults } from "./options .ts" ;
19+ import type { FetchError } from "./mod .ts" ;
2020
2121/** 不正なfollowingIdを渡されたときに発生するエラー */
2222export interface InvalidFollowingIdError extends ErrorLike {
@@ -33,24 +33,20 @@ export interface GetLinksResult {
3333 followingId : string ;
3434}
3535
36+ export type LinksError =
37+ | NotFoundError
38+ | NotLoggedInError
39+ | InvalidFollowingIdError
40+ | HTTPError ;
41+
3642/** 指定したprojectのリンクデータを取得する
3743 *
3844 * @param project データを取得したいproject
3945 */
4046export const getLinks = async (
4147 project : string ,
4248 options ?: GetLinksOptions ,
43- ) : Promise <
44- Result <
45- GetLinksResult ,
46- | NotFoundError
47- | NotLoggedInError
48- | InvalidFollowingIdError
49- | NetworkError
50- | AbortError
51- | HTTPError
52- >
53- > => {
49+ ) : Promise < Result < GetLinksResult , LinksError | FetchError > > => {
5450 const { sid, hostName, fetch, followingId } = setDefaults ( options ?? { } ) ;
5551
5652 const req = new Request (
@@ -96,15 +92,7 @@ export async function* readLinksBulk(
9692 project : string ,
9793 options ?: BaseOptions ,
9894) : AsyncGenerator <
99- Result <
100- SearchedTitle [ ] ,
101- | NotFoundError
102- | NotLoggedInError
103- | InvalidFollowingIdError
104- | NetworkError
105- | AbortError
106- | HTTPError
107- > ,
95+ Result < SearchedTitle [ ] , LinksError | FetchError > ,
10896 void ,
10997 unknown
11098> {
@@ -131,15 +119,7 @@ export async function* readLinks(
131119 project : string ,
132120 options ?: BaseOptions ,
133121) : AsyncGenerator <
134- Result <
135- SearchedTitle ,
136- | NotFoundError
137- | NotLoggedInError
138- | InvalidFollowingIdError
139- | NetworkError
140- | AbortError
141- | HTTPError
142- > ,
122+ Result < SearchedTitle , LinksError | FetchError > ,
143123 void ,
144124 unknown
145125> {
0 commit comments