or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

apps-checks.mdauthentication.mdgists.mdgit-objects.mdindex.mdissues.mdorganizations.mdpull-requests.mdrepositories.mdsearch.mdusers.md

users.mddocs/

0

# User Management

1

2

Complete user profile management, account operations, email management, SSH/GPG key handling, and user relationship management (followers, following).

3

4

## Capabilities

5

6

### User Information & Profiles

7

8

Access to user profiles, account information, and user management operations.

9

10

```python { .api }

11

class GitHub:

12

def me(self):

13

"""

14

Get the authenticated user's profile information.

15

16

Returns:

17

AuthenticatedUser: Current authenticated user object

18

"""

19

20

def user(self, username):

21

"""

22

Get a user by username.

23

24

Args:

25

username (str): GitHub username

26

27

Returns:

28

User: User object or None if not found

29

"""

30

31

def update_me(self, name=None, email=None, blog=None, company=None, location=None, hireable=None, bio=None):

32

"""

33

Update the authenticated user's profile.

34

35

Args:

36

name (str, optional): Full name

37

email (str, optional): Email address

38

blog (str, optional): Blog URL

39

company (str, optional): Company name

40

location (str, optional): Location

41

hireable (bool, optional): Available for hire

42

bio (str, optional): Biography

43

44

Returns:

45

bool: True if update successful

46

"""

47

```

48

49

**Usage Examples:**

50

51

```python

52

import github3

53

54

gh = github3.login(token='your_token')

55

56

# Get authenticated user info

57

me = gh.me()

58

print(f"Username: {me.login}")

59

print(f"Name: {me.name}")

60

print(f"Email: {me.email}")

61

print(f"Public repos: {me.public_repos}")

62

63

# Get another user

64

user = gh.user('octocat')

65

print(f"User: {user.login}")

66

print(f"Followers: {user.followers}")

67

68

# Update profile

69

gh.update_me(

70

name="New Name",

71

bio="Updated biography",

72

location="San Francisco, CA"

73

)

74

```

75

76

### Email Address Management

77

78

Management of email addresses for the authenticated user.

79

80

```python { .api }

81

class GitHub:

82

def add_email_addresses(self, addresses=[]):

83

"""

84

Add email addresses to the authenticated user's account.

85

86

Args:

87

addresses (list): List of email addresses to add

88

89

Returns:

90

list: List of Email objects

91

"""

92

93

def delete_email_addresses(self, addresses=[]):

94

"""

95

Delete email addresses from the authenticated user's account.

96

97

Args:

98

addresses (list): List of email addresses to delete

99

100

Returns:

101

bool: True if deletion successful

102

"""

103

104

def emails(self):

105

"""

106

List the authenticated user's email addresses.

107

108

Returns:

109

iterator: Iterator of Email objects

110

"""

111

```

112

113

**Usage Examples:**

114

115

```python

116

# Add email addresses

117

emails = gh.add_email_addresses(['user@example.com', 'user@company.com'])

118

for email in emails:

119

print(f"Added: {email.email} (verified: {email.verified})")

120

121

# List all emails

122

for email in gh.emails():

123

print(f"{email.email} - Primary: {email.primary}, Verified: {email.verified}")

124

125

# Delete email addresses

126

gh.delete_email_addresses(['user@example.com'])

127

```

128

129

### SSH Key Management

130

131

Management of SSH public keys for the authenticated user.

132

133

```python { .api }

134

class GitHub:

135

def keys(self):

136

"""

137

List the authenticated user's SSH keys.

138

139

Returns:

140

iterator: Iterator of Key objects

141

"""

142

143

def key(self, id):

144

"""

145

Get a specific SSH key by ID.

146

147

Args:

148

id (int): SSH key ID

149

150

Returns:

151

Key: SSH key object or None

152

"""

153

154

def create_key(self, title, key, read_only=False):

155

"""

156

Create a new SSH key for the authenticated user.

157

158

Args:

159

title (str): Key title/description

160

key (str): SSH public key content

161

read_only (bool): Whether key is read-only

162

163

Returns:

164

Key: Created SSH key object

165

"""

166

167

def delete_key(self, id):

168

"""

169

Delete an SSH key.

170

171

Args:

172

id (int): SSH key ID

173

174

Returns:

175

bool: True if deletion successful

176

"""

177

```

178

179

### GPG Key Management

180

181

Management of GPG keys for commit signing.

182

183

```python { .api }

184

class GitHub:

185

def gpg_keys(self):

186

"""

187

List the authenticated user's GPG keys.

188

189

Returns:

190

iterator: Iterator of GPGKey objects

191

"""

192

193

def gpg_key(self, id):

194

"""

195

Get a specific GPG key by ID.

196

197

Args:

198

id (int): GPG key ID

199

200

Returns:

201

GPGKey: GPG key object or None

202

"""

203

204

def create_gpg_key(self, armored_public_key):

205

"""

206

Create a new GPG key for the authenticated user.

207

208

Args:

209

armored_public_key (str): ASCII-armored public key

210

211

Returns:

212

GPGKey: Created GPG key object

213

"""

214

215

def delete_gpg_key(self, id):

216

"""

217

Delete a GPG key.

218

219

Args:

220

id (int): GPG key ID

221

222

Returns:

223

bool: True if deletion successful

224

"""

225

```

226

227

### User Relationships

228

229

Managing user relationships including followers and following.

230

231

```python { .api }

232

class GitHub:

233

def followers_of(self, username):

234

"""

235

List followers of a user.

236

237

Args:

238

username (str): GitHub username

239

240

Returns:

241

iterator: Iterator of User objects

242

"""

243

244

def followed_by(self, username):

245

"""

246

List users followed by a user.

247

248

Args:

249

username (str): GitHub username

250

251

Returns:

252

iterator: Iterator of User objects

253

"""

254

255

def follow(self, username):

256

"""

257

Follow a user.

258

259

Args:

260

username (str): Username to follow

261

262

Returns:

263

bool: True if successful

264

"""

265

266

def unfollow(self, username):

267

"""

268

Unfollow a user.

269

270

Args:

271

username (str): Username to unfollow

272

273

Returns:

274

bool: True if successful

275

"""

276

277

def is_following(self, username):

278

"""

279

Check if authenticated user is following a user.

280

281

Args:

282

username (str): Username to check

283

284

Returns:

285

bool: True if following

286

"""

287

```

288

289

**Usage Examples:**

290

291

```python

292

# List followers

293

for follower in gh.followers_of('octocat'):

294

print(f"Follower: {follower.login}")

295

296

# List following

297

for following in gh.followed_by('octocat'):

298

print(f"Following: {following.login}")

299

300

# Follow/unfollow users

301

gh.follow('octocat')

302

gh.unfollow('someuser')

303

304

# Check if following

305

if gh.is_following('octocat'):

306

print("Following octocat")

307

```

308

309

### Organization Membership

310

311

Managing organization memberships for the authenticated user.

312

313

```python { .api }

314

class GitHub:

315

def activate_membership(self, organization):

316

"""

317

Activate membership to an organization.

318

319

Args:

320

organization (str or Organization): Organization name or object

321

322

Returns:

323

Membership: Activated membership object

324

"""

325

326

def organizations(self):

327

"""

328

List the authenticated user's organizations.

329

330

Returns:

331

iterator: Iterator of Organization objects

332

"""

333

334

def organizations_with(self, username):

335

"""

336

List organizations for a user.

337

338

Args:

339

username (str): GitHub username

340

341

Returns:

342

iterator: Iterator of Organization objects

343

"""

344

```

345

346

## User Model Classes

347

348

```python { .api }

349

class User:

350

"""Full user object with all user data and methods."""

351

login: str

352

id: int

353

name: str

354

email: str

355

bio: str

356

company: str

357

location: str

358

blog: str

359

followers: int

360

following: int

361

public_repos: int

362

public_gists: int

363

created_at: str

364

updated_at: str

365

366

class AuthenticatedUser(User):

367

"""Current authenticated user with extra methods."""

368

private_repos: int

369

total_private_repos: int

370

owned_private_repos: int

371

disk_usage: int

372

collaborators: int

373

plan: 'Plan'

374

375

def update(self, **kwargs): ...

376

def create_repository(self, name, **kwargs): ...

377

378

class ShortUser:

379

"""Abbreviated user object for listings."""

380

login: str

381

id: int

382

383

class Email:

384

"""User's email address with verification status."""

385

email: str

386

verified: bool

387

primary: bool

388

389

class Key:

390

"""User's SSH public key."""

391

id: int

392

title: str

393

key: str

394

url: str

395

verified: bool

396

created_at: str

397

read_only: bool

398

399

class GPGKey:

400

"""User's GPG key for commit signing."""

401

id: int

402

primary_key_id: int

403

key_id: str

404

public_key: str

405

emails: list

406

subkeys: list

407

can_sign: bool

408

can_encrypt_comms: bool

409

can_encrypt_storage: bool

410

can_certify: bool

411

created_at: str

412

expires_at: str

413

414

class Plan:

415

"""User's GitHub plan information."""

416

name: str

417

space: int

418

private_repos: int

419

collaborators: int

420

421

UserLike = Union[User, ShortUser, AuthenticatedUser, str]

422

```