mirror of https://github.com/doccano/doccano.git
pythonannotation-tooldatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learning
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
772 B
23 lines
772 B
import ApiService from '@/services/api.service'
|
|
import { UserRepository, UserItemResponse } from '@/domain/models/user/userRepository'
|
|
import { UserItem } from '~/domain/models/user/user'
|
|
|
|
export class APIUserRepository implements UserRepository {
|
|
constructor(
|
|
private readonly request = ApiService
|
|
) {}
|
|
|
|
async getMe(): Promise<UserItem> {
|
|
const url = '/me'
|
|
const response = await this.request.get(url)
|
|
const item: UserItemResponse = response.data
|
|
return UserItem.valueOf(item)
|
|
}
|
|
|
|
async list(query: string): Promise<UserItem[]> {
|
|
const url = `/users?q=${query}`
|
|
const response = await this.request.get(url)
|
|
const responseItems: UserItemResponse[] = response.data
|
|
return responseItems.map(item => UserItem.valueOf(item))
|
|
}
|
|
}
|