Skip to content

Commit

Permalink
Merge pull request #1386 from balena-io/user-profile
Browse files Browse the repository at this point in the history
Add typings for the user_profile resource
  • Loading branch information
thgreasi authored Oct 9, 2023
2 parents 2938975 + 59fd116 commit d3f220d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 13 deletions.
45 changes: 32 additions & 13 deletions src/types/jwt.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
export interface JWTUser {
account_type?: string;
id: number;
jwt_secret: string;
authTime?: number;
actualUser?: number;
company?: string;
created_at: string;
email?: string;
twoFactorRequired?: boolean;
permissions?: string[];

/** @deprecated Use the user resource */
created_at?: string;
/** @deprecated Use the user resource */
username?: string;
/** @deprecated Use the actualUser field */
loginAs?: boolean;
/** @deprecated */
features?: string[];

/** @deprecated Use the user_profile resource */
first_name?: string;
hasPasswordSet?: boolean;
/** @deprecated Use the user_profile resource */
last_name?: string;
/** @deprecated Use the user_profile resource */
email?: string;
/** @deprecated Use the user_profile resource */
account_type?: string;
/** @deprecated Use the user_profile resource */
company?: string;
/** @deprecated Use the user_profile resource */
has_disabled_newsletter?: boolean;
/** @deprecated Use the user_profile resource */
hasPasswordSet?: boolean;
/** @deprecated Use the user_profile resource */
must_be_verified?: boolean;
/** @deprecated Use the user_profile resource */
is_verified?: boolean;
id: number;

/** @deprecated */
intercomUserName?: string;
/** @deprecated */
intercomUserHash?: string;
jwt_secret: string;
last_name?: string;
loginAs?: boolean;
permissions?: string[];
twoFactorRequired?: boolean;
username: string;

/** @deprecated User the social_service_account resource */
/** @deprecated Use the social_service_account resource */
social_service_account?: SocialServiceAccount[];
}

Expand Down
17 changes: 17 additions & 0 deletions src/types/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface ResourceTypeMap {
team_application_access: TeamApplicationAccess;
team_membership: TeamMembership;
user: User;
user_profile: UserProfile;
user__has__public_key: SSHKey;
user__has_direct_access_to__application: UserHasDirectAccessToApplication;
user_application_membership: ApplicationMembership;
Expand Down Expand Up @@ -146,6 +147,22 @@ export interface User {
user_application_membership: ReverseNavigationResource<ApplicationMembership>;
team_membership: ReverseNavigationResource<TeamMembership>;
has_direct_access_to__application: ReverseNavigationResource<Application>;
user_profile: ReverseNavigationResource<UserProfile>;
}

export interface UserProfile {
id: null;
email: string | null;
first_name: string | null;
last_name: string | null;
company: string;
account_type: string | null;
has_disabled_newsletter: boolean;
has_password_set: boolean;
must_be_verified: boolean;
is_verified: boolean;

is_of__user: NavigationResource<User>;
}

export type OrganizationMembershipRoles = 'administrator' | 'member';
Expand Down
1 change: 1 addition & 0 deletions typing_tests/pine-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ type UserExpandablePropsExpectation =
| 'actor'
| 'organization_membership'
| 'user_application_membership'
| 'user_profile'
| 'team_membership'
| 'has_direct_access_to__application';

Expand Down

0 comments on commit d3f220d

Please sign in to comment.