-import { omit } from 'lodash'
-import { pick } from '@shared/core-utils'
+import { omit, pick } from '@shared/core-utils'
import {
HttpStatusCode,
MyUser,
ResultList,
+ ScopedToken,
User,
UserAdminFlag,
UserCreateResult,
UserVideoQuota,
UserVideoRate
} from '@shared/models'
-import { ScopedToken } from '@shared/models/users/user-scoped-token'
import { unwrapBody } from '../requests'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
token,
userId: user.id,
userChannelId: me.videoChannels[0].id,
- userChannelName: me.videoChannels[0].name
+ userChannelName: me.videoChannels[0].name,
+ password
}
}
return this.server.login.getAccessToken({ username, password })
}
- register (options: OverrideCommandOptions & {
- username: string
- password?: string
- displayName?: string
- channel?: {
- name: string
- displayName: string
- }
- }) {
- const { username, password = 'password', displayName, channel } = options
- const path = '/api/v1/users/register'
-
- return this.postBodyRequest({
- ...options,
-
- path,
- fields: {
- username,
- password,
- email: username + '@example.com',
- displayName,
- channel
- },
- implicitToken: false,
- defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
- })
- }
-
// ---------------------------------------------------------------------------
getMyInfo (options: OverrideCommandOptions = {}) {
updateMe (options: OverrideCommandOptions & UserUpdateMe) {
const path = '/api/v1/users/me'
- const toSend: UserUpdateMe = omit(options, 'url', 'accessToken')
+ const toSend: UserUpdateMe = omit(options, [ 'expectedStatus', 'token' ])
return this.putBodyRequest({
...options,