├── 4F7A7F4B-EB35-478F-A9F0-1192A64BA8E2.png ├── README.md ├── composer.json ├── composer.lock ├── favicon.png ├── icon.png ├── info.plist ├── leetcode.php ├── screenshot.png └── src ├── Application.php ├── Entities ├── LeetCodeItem.php └── LeetCodeType.php ├── Repositories ├── DailyProblem │ ├── DailyProblemRepository.php │ └── DailyProblemRepositoryInterface.php ├── DataStructures │ ├── DataStructureRepositoryInterface.php │ ├── DataStructuresCacheRepository.php │ └── DataStructuresRepository.php ├── Problems │ ├── ProblemCacheRepository.php │ ├── ProblemRepository.php │ └── ProblemRepositoryInterface.php └── RepositoryInterface.php └── Services ├── ChallengesService.php ├── DailyProblemsService.php ├── DataStructureService.php ├── ProblemsService.php └── ServiceInterface.php /4F7A7F4B-EB35-478F-A9F0-1192A64BA8E2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmedash95/leetcode-alfred-plugin/a133be51c4bd7dd8bc52c6471caf3d6201ffb2eb/4F7A7F4B-EB35-478F-A9F0-1192A64BA8E2.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Leetcode Alfred plugin 2 | An ultra-fast Leetcode search workflow for [Alfred 3+](https://www.alfredapp.com/). 3 | 4 | ![screenshot](screenshot.png) 5 | 6 | 7 | ## Installation 8 | 9 | 1. [Download the latest version](https://github.com/ahmedash95/leetcode-alfred-plugin/releases) 10 | 2. Install the workflow by double-clicking the `.alfredworkflow` file 11 | 3. You can add the workflow to a category, then click "Import" to finish importing. You'll now see the workflow listed in the left sidebar of your Workflows preferences pane. 12 | 13 | ## Usage 14 | 15 | #### Getting the daily problem 16 | the daily problem from leetcode monthly challenge always appear at the top of the list. 17 | 18 | #### Search for problems or categories 19 | Just type `lc` followed by your search query. 20 | 21 | ``` 22 | lc 23 | lc stack 24 | lc two sum 25 | ``` -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "joetannenbaum/alfred-workflow": "^0.1.2", 4 | "tightenco/collect": "^8.19", 5 | "symfony/http-client": "^5.2", 6 | "symfony/cache": "^5.2" 7 | }, 8 | "autoload": { 9 | "psr-4": { 10 | "App\\": "src/" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "5f199fc47de0cccc85d500c38e0b5edf", 8 | "packages": [ 9 | { 10 | "name": "joetannenbaum/alfred-workflow", 11 | "version": "0.1.2", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/joetannenbaum/alfred-workflow.git", 15 | "reference": "88e042db9cad0c95ab80e87c69d7f1e15340e7ac" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/joetannenbaum/alfred-workflow/zipball/88e042db9cad0c95ab80e87c69d7f1e15340e7ac", 20 | "reference": "88e042db9cad0c95ab80e87c69d7f1e15340e7ac", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">=5.4.0" 25 | }, 26 | "require-dev": { 27 | "phpunit/phpunit": "^5.3|~4.8" 28 | }, 29 | "type": "library", 30 | "autoload": { 31 | "psr-4": { 32 | "Alfred\\Workflows\\": "src/" 33 | } 34 | }, 35 | "notification-url": "https://packagist.org/downloads/", 36 | "license": [ 37 | "MIT" 38 | ], 39 | "authors": [ 40 | { 41 | "name": "Joe Tannenbaum", 42 | "email": "joe@joe.codes" 43 | } 44 | ], 45 | "description": "PHP helper for creating Alfred Workflows.", 46 | "time": "2018-08-14T14:25:53+00:00" 47 | }, 48 | { 49 | "name": "psr/cache", 50 | "version": "1.0.1", 51 | "source": { 52 | "type": "git", 53 | "url": "https://github.com/php-fig/cache.git", 54 | "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" 55 | }, 56 | "dist": { 57 | "type": "zip", 58 | "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", 59 | "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", 60 | "shasum": "" 61 | }, 62 | "require": { 63 | "php": ">=5.3.0" 64 | }, 65 | "type": "library", 66 | "extra": { 67 | "branch-alias": { 68 | "dev-master": "1.0.x-dev" 69 | } 70 | }, 71 | "autoload": { 72 | "psr-4": { 73 | "Psr\\Cache\\": "src/" 74 | } 75 | }, 76 | "notification-url": "https://packagist.org/downloads/", 77 | "license": [ 78 | "MIT" 79 | ], 80 | "authors": [ 81 | { 82 | "name": "PHP-FIG", 83 | "homepage": "http://www.php-fig.org/" 84 | } 85 | ], 86 | "description": "Common interface for caching libraries", 87 | "keywords": [ 88 | "cache", 89 | "psr", 90 | "psr-6" 91 | ], 92 | "time": "2016-08-06T20:24:11+00:00" 93 | }, 94 | { 95 | "name": "psr/container", 96 | "version": "1.0.0", 97 | "source": { 98 | "type": "git", 99 | "url": "https://github.com/php-fig/container.git", 100 | "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" 101 | }, 102 | "dist": { 103 | "type": "zip", 104 | "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", 105 | "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", 106 | "shasum": "" 107 | }, 108 | "require": { 109 | "php": ">=5.3.0" 110 | }, 111 | "type": "library", 112 | "extra": { 113 | "branch-alias": { 114 | "dev-master": "1.0.x-dev" 115 | } 116 | }, 117 | "autoload": { 118 | "psr-4": { 119 | "Psr\\Container\\": "src/" 120 | } 121 | }, 122 | "notification-url": "https://packagist.org/downloads/", 123 | "license": [ 124 | "MIT" 125 | ], 126 | "authors": [ 127 | { 128 | "name": "PHP-FIG", 129 | "homepage": "http://www.php-fig.org/" 130 | } 131 | ], 132 | "description": "Common Container Interface (PHP FIG PSR-11)", 133 | "homepage": "https://github.com/php-fig/container", 134 | "keywords": [ 135 | "PSR-11", 136 | "container", 137 | "container-interface", 138 | "container-interop", 139 | "psr" 140 | ], 141 | "time": "2017-02-14T16:28:37+00:00" 142 | }, 143 | { 144 | "name": "psr/log", 145 | "version": "1.1.3", 146 | "source": { 147 | "type": "git", 148 | "url": "https://github.com/php-fig/log.git", 149 | "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" 150 | }, 151 | "dist": { 152 | "type": "zip", 153 | "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", 154 | "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", 155 | "shasum": "" 156 | }, 157 | "require": { 158 | "php": ">=5.3.0" 159 | }, 160 | "type": "library", 161 | "extra": { 162 | "branch-alias": { 163 | "dev-master": "1.1.x-dev" 164 | } 165 | }, 166 | "autoload": { 167 | "psr-4": { 168 | "Psr\\Log\\": "Psr/Log/" 169 | } 170 | }, 171 | "notification-url": "https://packagist.org/downloads/", 172 | "license": [ 173 | "MIT" 174 | ], 175 | "authors": [ 176 | { 177 | "name": "PHP-FIG", 178 | "homepage": "http://www.php-fig.org/" 179 | } 180 | ], 181 | "description": "Common interface for logging libraries", 182 | "homepage": "https://github.com/php-fig/log", 183 | "keywords": [ 184 | "log", 185 | "psr", 186 | "psr-3" 187 | ], 188 | "time": "2020-03-23T09:12:05+00:00" 189 | }, 190 | { 191 | "name": "symfony/cache", 192 | "version": "v5.2.3", 193 | "source": { 194 | "type": "git", 195 | "url": "https://github.com/symfony/cache.git", 196 | "reference": "d6aed6c1bbf6f59e521f46437475a0ff4878d388" 197 | }, 198 | "dist": { 199 | "type": "zip", 200 | "url": "https://api.github.com/repos/symfony/cache/zipball/d6aed6c1bbf6f59e521f46437475a0ff4878d388", 201 | "reference": "d6aed6c1bbf6f59e521f46437475a0ff4878d388", 202 | "shasum": "" 203 | }, 204 | "require": { 205 | "php": ">=7.2.5", 206 | "psr/cache": "~1.0", 207 | "psr/log": "^1.1", 208 | "symfony/cache-contracts": "^1.1.7|^2", 209 | "symfony/polyfill-php80": "^1.15", 210 | "symfony/service-contracts": "^1.1|^2", 211 | "symfony/var-exporter": "^4.4|^5.0" 212 | }, 213 | "conflict": { 214 | "doctrine/dbal": "<2.10", 215 | "symfony/dependency-injection": "<4.4", 216 | "symfony/http-kernel": "<4.4", 217 | "symfony/var-dumper": "<4.4" 218 | }, 219 | "provide": { 220 | "psr/cache-implementation": "1.0", 221 | "psr/simple-cache-implementation": "1.0", 222 | "symfony/cache-implementation": "1.0" 223 | }, 224 | "require-dev": { 225 | "cache/integration-tests": "dev-master", 226 | "doctrine/cache": "^1.6", 227 | "doctrine/dbal": "^2.10|^3.0", 228 | "predis/predis": "^1.1", 229 | "psr/simple-cache": "^1.0", 230 | "symfony/config": "^4.4|^5.0", 231 | "symfony/dependency-injection": "^4.4|^5.0", 232 | "symfony/filesystem": "^4.4|^5.0", 233 | "symfony/http-kernel": "^4.4|^5.0", 234 | "symfony/messenger": "^4.4|^5.0", 235 | "symfony/var-dumper": "^4.4|^5.0" 236 | }, 237 | "type": "library", 238 | "autoload": { 239 | "psr-4": { 240 | "Symfony\\Component\\Cache\\": "" 241 | }, 242 | "exclude-from-classmap": [ 243 | "/Tests/" 244 | ] 245 | }, 246 | "notification-url": "https://packagist.org/downloads/", 247 | "license": [ 248 | "MIT" 249 | ], 250 | "authors": [ 251 | { 252 | "name": "Nicolas Grekas", 253 | "email": "p@tchwork.com" 254 | }, 255 | { 256 | "name": "Symfony Community", 257 | "homepage": "https://symfony.com/contributors" 258 | } 259 | ], 260 | "description": "Provides an extended PSR-6, PSR-16 (and tags) implementation", 261 | "homepage": "https://symfony.com", 262 | "keywords": [ 263 | "caching", 264 | "psr6" 265 | ], 266 | "funding": [ 267 | { 268 | "url": "https://symfony.com/sponsor", 269 | "type": "custom" 270 | }, 271 | { 272 | "url": "https://github.com/fabpot", 273 | "type": "github" 274 | }, 275 | { 276 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 277 | "type": "tidelift" 278 | } 279 | ], 280 | "time": "2021-01-27T11:24:50+00:00" 281 | }, 282 | { 283 | "name": "symfony/cache-contracts", 284 | "version": "v2.2.0", 285 | "source": { 286 | "type": "git", 287 | "url": "https://github.com/symfony/cache-contracts.git", 288 | "reference": "8034ca0b61d4dd967f3698aaa1da2507b631d0cb" 289 | }, 290 | "dist": { 291 | "type": "zip", 292 | "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/8034ca0b61d4dd967f3698aaa1da2507b631d0cb", 293 | "reference": "8034ca0b61d4dd967f3698aaa1da2507b631d0cb", 294 | "shasum": "" 295 | }, 296 | "require": { 297 | "php": ">=7.2.5", 298 | "psr/cache": "^1.0" 299 | }, 300 | "suggest": { 301 | "symfony/cache-implementation": "" 302 | }, 303 | "type": "library", 304 | "extra": { 305 | "branch-alias": { 306 | "dev-master": "2.2-dev" 307 | }, 308 | "thanks": { 309 | "name": "symfony/contracts", 310 | "url": "https://github.com/symfony/contracts" 311 | } 312 | }, 313 | "autoload": { 314 | "psr-4": { 315 | "Symfony\\Contracts\\Cache\\": "" 316 | } 317 | }, 318 | "notification-url": "https://packagist.org/downloads/", 319 | "license": [ 320 | "MIT" 321 | ], 322 | "authors": [ 323 | { 324 | "name": "Nicolas Grekas", 325 | "email": "p@tchwork.com" 326 | }, 327 | { 328 | "name": "Symfony Community", 329 | "homepage": "https://symfony.com/contributors" 330 | } 331 | ], 332 | "description": "Generic abstractions related to caching", 333 | "homepage": "https://symfony.com", 334 | "keywords": [ 335 | "abstractions", 336 | "contracts", 337 | "decoupling", 338 | "interfaces", 339 | "interoperability", 340 | "standards" 341 | ], 342 | "funding": [ 343 | { 344 | "url": "https://symfony.com/sponsor", 345 | "type": "custom" 346 | }, 347 | { 348 | "url": "https://github.com/fabpot", 349 | "type": "github" 350 | }, 351 | { 352 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 353 | "type": "tidelift" 354 | } 355 | ], 356 | "time": "2020-09-07T11:33:47+00:00" 357 | }, 358 | { 359 | "name": "symfony/http-client", 360 | "version": "v5.2.3", 361 | "source": { 362 | "type": "git", 363 | "url": "https://github.com/symfony/http-client.git", 364 | "reference": "22cb1a7844fff206cc5186409776e78865405ea5" 365 | }, 366 | "dist": { 367 | "type": "zip", 368 | "url": "https://api.github.com/repos/symfony/http-client/zipball/22cb1a7844fff206cc5186409776e78865405ea5", 369 | "reference": "22cb1a7844fff206cc5186409776e78865405ea5", 370 | "shasum": "" 371 | }, 372 | "require": { 373 | "php": ">=7.2.5", 374 | "psr/log": "^1.0", 375 | "symfony/http-client-contracts": "^2.2", 376 | "symfony/polyfill-php73": "^1.11", 377 | "symfony/polyfill-php80": "^1.15", 378 | "symfony/service-contracts": "^1.0|^2" 379 | }, 380 | "provide": { 381 | "php-http/async-client-implementation": "*", 382 | "php-http/client-implementation": "*", 383 | "psr/http-client-implementation": "1.0", 384 | "symfony/http-client-implementation": "1.1" 385 | }, 386 | "require-dev": { 387 | "amphp/amp": "^2.5", 388 | "amphp/http-client": "^4.2.1", 389 | "amphp/http-tunnel": "^1.0", 390 | "amphp/socket": "^1.1", 391 | "guzzlehttp/promises": "^1.4", 392 | "nyholm/psr7": "^1.0", 393 | "php-http/httplug": "^1.0|^2.0", 394 | "psr/http-client": "^1.0", 395 | "symfony/dependency-injection": "^4.4|^5.0", 396 | "symfony/http-kernel": "^4.4.13|^5.1.5", 397 | "symfony/process": "^4.4|^5.0", 398 | "symfony/stopwatch": "^4.4|^5.0" 399 | }, 400 | "type": "library", 401 | "autoload": { 402 | "psr-4": { 403 | "Symfony\\Component\\HttpClient\\": "" 404 | }, 405 | "exclude-from-classmap": [ 406 | "/Tests/" 407 | ] 408 | }, 409 | "notification-url": "https://packagist.org/downloads/", 410 | "license": [ 411 | "MIT" 412 | ], 413 | "authors": [ 414 | { 415 | "name": "Nicolas Grekas", 416 | "email": "p@tchwork.com" 417 | }, 418 | { 419 | "name": "Symfony Community", 420 | "homepage": "https://symfony.com/contributors" 421 | } 422 | ], 423 | "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", 424 | "homepage": "https://symfony.com", 425 | "funding": [ 426 | { 427 | "url": "https://symfony.com/sponsor", 428 | "type": "custom" 429 | }, 430 | { 431 | "url": "https://github.com/fabpot", 432 | "type": "github" 433 | }, 434 | { 435 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 436 | "type": "tidelift" 437 | } 438 | ], 439 | "time": "2021-01-27T10:15:41+00:00" 440 | }, 441 | { 442 | "name": "symfony/http-client-contracts", 443 | "version": "v2.3.1", 444 | "source": { 445 | "type": "git", 446 | "url": "https://github.com/symfony/http-client-contracts.git", 447 | "reference": "41db680a15018f9c1d4b23516059633ce280ca33" 448 | }, 449 | "dist": { 450 | "type": "zip", 451 | "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/41db680a15018f9c1d4b23516059633ce280ca33", 452 | "reference": "41db680a15018f9c1d4b23516059633ce280ca33", 453 | "shasum": "" 454 | }, 455 | "require": { 456 | "php": ">=7.2.5" 457 | }, 458 | "suggest": { 459 | "symfony/http-client-implementation": "" 460 | }, 461 | "type": "library", 462 | "extra": { 463 | "branch-version": "2.3", 464 | "branch-alias": { 465 | "dev-main": "2.3-dev" 466 | }, 467 | "thanks": { 468 | "name": "symfony/contracts", 469 | "url": "https://github.com/symfony/contracts" 470 | } 471 | }, 472 | "autoload": { 473 | "psr-4": { 474 | "Symfony\\Contracts\\HttpClient\\": "" 475 | } 476 | }, 477 | "notification-url": "https://packagist.org/downloads/", 478 | "license": [ 479 | "MIT" 480 | ], 481 | "authors": [ 482 | { 483 | "name": "Nicolas Grekas", 484 | "email": "p@tchwork.com" 485 | }, 486 | { 487 | "name": "Symfony Community", 488 | "homepage": "https://symfony.com/contributors" 489 | } 490 | ], 491 | "description": "Generic abstractions related to HTTP clients", 492 | "homepage": "https://symfony.com", 493 | "keywords": [ 494 | "abstractions", 495 | "contracts", 496 | "decoupling", 497 | "interfaces", 498 | "interoperability", 499 | "standards" 500 | ], 501 | "funding": [ 502 | { 503 | "url": "https://symfony.com/sponsor", 504 | "type": "custom" 505 | }, 506 | { 507 | "url": "https://github.com/fabpot", 508 | "type": "github" 509 | }, 510 | { 511 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 512 | "type": "tidelift" 513 | } 514 | ], 515 | "time": "2020-10-14T17:08:19+00:00" 516 | }, 517 | { 518 | "name": "symfony/polyfill-mbstring", 519 | "version": "v1.22.0", 520 | "source": { 521 | "type": "git", 522 | "url": "https://github.com/symfony/polyfill-mbstring.git", 523 | "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" 524 | }, 525 | "dist": { 526 | "type": "zip", 527 | "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", 528 | "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", 529 | "shasum": "" 530 | }, 531 | "require": { 532 | "php": ">=7.1" 533 | }, 534 | "suggest": { 535 | "ext-mbstring": "For best performance" 536 | }, 537 | "type": "library", 538 | "extra": { 539 | "branch-alias": { 540 | "dev-main": "1.22-dev" 541 | }, 542 | "thanks": { 543 | "name": "symfony/polyfill", 544 | "url": "https://github.com/symfony/polyfill" 545 | } 546 | }, 547 | "autoload": { 548 | "psr-4": { 549 | "Symfony\\Polyfill\\Mbstring\\": "" 550 | }, 551 | "files": [ 552 | "bootstrap.php" 553 | ] 554 | }, 555 | "notification-url": "https://packagist.org/downloads/", 556 | "license": [ 557 | "MIT" 558 | ], 559 | "authors": [ 560 | { 561 | "name": "Nicolas Grekas", 562 | "email": "p@tchwork.com" 563 | }, 564 | { 565 | "name": "Symfony Community", 566 | "homepage": "https://symfony.com/contributors" 567 | } 568 | ], 569 | "description": "Symfony polyfill for the Mbstring extension", 570 | "homepage": "https://symfony.com", 571 | "keywords": [ 572 | "compatibility", 573 | "mbstring", 574 | "polyfill", 575 | "portable", 576 | "shim" 577 | ], 578 | "funding": [ 579 | { 580 | "url": "https://symfony.com/sponsor", 581 | "type": "custom" 582 | }, 583 | { 584 | "url": "https://github.com/fabpot", 585 | "type": "github" 586 | }, 587 | { 588 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 589 | "type": "tidelift" 590 | } 591 | ], 592 | "time": "2021-01-07T16:49:33+00:00" 593 | }, 594 | { 595 | "name": "symfony/polyfill-php73", 596 | "version": "v1.22.1", 597 | "source": { 598 | "type": "git", 599 | "url": "https://github.com/symfony/polyfill-php73.git", 600 | "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" 601 | }, 602 | "dist": { 603 | "type": "zip", 604 | "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", 605 | "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", 606 | "shasum": "" 607 | }, 608 | "require": { 609 | "php": ">=7.1" 610 | }, 611 | "type": "library", 612 | "extra": { 613 | "branch-alias": { 614 | "dev-main": "1.22-dev" 615 | }, 616 | "thanks": { 617 | "name": "symfony/polyfill", 618 | "url": "https://github.com/symfony/polyfill" 619 | } 620 | }, 621 | "autoload": { 622 | "psr-4": { 623 | "Symfony\\Polyfill\\Php73\\": "" 624 | }, 625 | "files": [ 626 | "bootstrap.php" 627 | ], 628 | "classmap": [ 629 | "Resources/stubs" 630 | ] 631 | }, 632 | "notification-url": "https://packagist.org/downloads/", 633 | "license": [ 634 | "MIT" 635 | ], 636 | "authors": [ 637 | { 638 | "name": "Nicolas Grekas", 639 | "email": "p@tchwork.com" 640 | }, 641 | { 642 | "name": "Symfony Community", 643 | "homepage": "https://symfony.com/contributors" 644 | } 645 | ], 646 | "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", 647 | "homepage": "https://symfony.com", 648 | "keywords": [ 649 | "compatibility", 650 | "polyfill", 651 | "portable", 652 | "shim" 653 | ], 654 | "funding": [ 655 | { 656 | "url": "https://symfony.com/sponsor", 657 | "type": "custom" 658 | }, 659 | { 660 | "url": "https://github.com/fabpot", 661 | "type": "github" 662 | }, 663 | { 664 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 665 | "type": "tidelift" 666 | } 667 | ], 668 | "time": "2021-01-07T16:49:33+00:00" 669 | }, 670 | { 671 | "name": "symfony/polyfill-php80", 672 | "version": "v1.22.0", 673 | "source": { 674 | "type": "git", 675 | "url": "https://github.com/symfony/polyfill-php80.git", 676 | "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" 677 | }, 678 | "dist": { 679 | "type": "zip", 680 | "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", 681 | "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", 682 | "shasum": "" 683 | }, 684 | "require": { 685 | "php": ">=7.1" 686 | }, 687 | "type": "library", 688 | "extra": { 689 | "branch-alias": { 690 | "dev-main": "1.22-dev" 691 | }, 692 | "thanks": { 693 | "name": "symfony/polyfill", 694 | "url": "https://github.com/symfony/polyfill" 695 | } 696 | }, 697 | "autoload": { 698 | "psr-4": { 699 | "Symfony\\Polyfill\\Php80\\": "" 700 | }, 701 | "files": [ 702 | "bootstrap.php" 703 | ], 704 | "classmap": [ 705 | "Resources/stubs" 706 | ] 707 | }, 708 | "notification-url": "https://packagist.org/downloads/", 709 | "license": [ 710 | "MIT" 711 | ], 712 | "authors": [ 713 | { 714 | "name": "Ion Bazan", 715 | "email": "ion.bazan@gmail.com" 716 | }, 717 | { 718 | "name": "Nicolas Grekas", 719 | "email": "p@tchwork.com" 720 | }, 721 | { 722 | "name": "Symfony Community", 723 | "homepage": "https://symfony.com/contributors" 724 | } 725 | ], 726 | "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", 727 | "homepage": "https://symfony.com", 728 | "keywords": [ 729 | "compatibility", 730 | "polyfill", 731 | "portable", 732 | "shim" 733 | ], 734 | "funding": [ 735 | { 736 | "url": "https://symfony.com/sponsor", 737 | "type": "custom" 738 | }, 739 | { 740 | "url": "https://github.com/fabpot", 741 | "type": "github" 742 | }, 743 | { 744 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 745 | "type": "tidelift" 746 | } 747 | ], 748 | "time": "2021-01-07T16:49:33+00:00" 749 | }, 750 | { 751 | "name": "symfony/service-contracts", 752 | "version": "v2.2.0", 753 | "source": { 754 | "type": "git", 755 | "url": "https://github.com/symfony/service-contracts.git", 756 | "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" 757 | }, 758 | "dist": { 759 | "type": "zip", 760 | "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", 761 | "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", 762 | "shasum": "" 763 | }, 764 | "require": { 765 | "php": ">=7.2.5", 766 | "psr/container": "^1.0" 767 | }, 768 | "suggest": { 769 | "symfony/service-implementation": "" 770 | }, 771 | "type": "library", 772 | "extra": { 773 | "branch-alias": { 774 | "dev-master": "2.2-dev" 775 | }, 776 | "thanks": { 777 | "name": "symfony/contracts", 778 | "url": "https://github.com/symfony/contracts" 779 | } 780 | }, 781 | "autoload": { 782 | "psr-4": { 783 | "Symfony\\Contracts\\Service\\": "" 784 | } 785 | }, 786 | "notification-url": "https://packagist.org/downloads/", 787 | "license": [ 788 | "MIT" 789 | ], 790 | "authors": [ 791 | { 792 | "name": "Nicolas Grekas", 793 | "email": "p@tchwork.com" 794 | }, 795 | { 796 | "name": "Symfony Community", 797 | "homepage": "https://symfony.com/contributors" 798 | } 799 | ], 800 | "description": "Generic abstractions related to writing services", 801 | "homepage": "https://symfony.com", 802 | "keywords": [ 803 | "abstractions", 804 | "contracts", 805 | "decoupling", 806 | "interfaces", 807 | "interoperability", 808 | "standards" 809 | ], 810 | "funding": [ 811 | { 812 | "url": "https://symfony.com/sponsor", 813 | "type": "custom" 814 | }, 815 | { 816 | "url": "https://github.com/fabpot", 817 | "type": "github" 818 | }, 819 | { 820 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 821 | "type": "tidelift" 822 | } 823 | ], 824 | "time": "2020-09-07T11:33:47+00:00" 825 | }, 826 | { 827 | "name": "symfony/var-dumper", 828 | "version": "v5.2.3", 829 | "source": { 830 | "type": "git", 831 | "url": "https://github.com/symfony/var-dumper.git", 832 | "reference": "72ca213014a92223a5d18651ce79ef441c12b694" 833 | }, 834 | "dist": { 835 | "type": "zip", 836 | "url": "https://api.github.com/repos/symfony/var-dumper/zipball/72ca213014a92223a5d18651ce79ef441c12b694", 837 | "reference": "72ca213014a92223a5d18651ce79ef441c12b694", 838 | "shasum": "" 839 | }, 840 | "require": { 841 | "php": ">=7.2.5", 842 | "symfony/polyfill-mbstring": "~1.0", 843 | "symfony/polyfill-php80": "^1.15" 844 | }, 845 | "conflict": { 846 | "phpunit/phpunit": "<5.4.3", 847 | "symfony/console": "<4.4" 848 | }, 849 | "require-dev": { 850 | "ext-iconv": "*", 851 | "symfony/console": "^4.4|^5.0", 852 | "symfony/process": "^4.4|^5.0", 853 | "twig/twig": "^2.13|^3.0.4" 854 | }, 855 | "suggest": { 856 | "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", 857 | "ext-intl": "To show region name in time zone dump", 858 | "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" 859 | }, 860 | "bin": [ 861 | "Resources/bin/var-dump-server" 862 | ], 863 | "type": "library", 864 | "autoload": { 865 | "files": [ 866 | "Resources/functions/dump.php" 867 | ], 868 | "psr-4": { 869 | "Symfony\\Component\\VarDumper\\": "" 870 | }, 871 | "exclude-from-classmap": [ 872 | "/Tests/" 873 | ] 874 | }, 875 | "notification-url": "https://packagist.org/downloads/", 876 | "license": [ 877 | "MIT" 878 | ], 879 | "authors": [ 880 | { 881 | "name": "Nicolas Grekas", 882 | "email": "p@tchwork.com" 883 | }, 884 | { 885 | "name": "Symfony Community", 886 | "homepage": "https://symfony.com/contributors" 887 | } 888 | ], 889 | "description": "Provides mechanisms for walking through any arbitrary PHP variable", 890 | "homepage": "https://symfony.com", 891 | "keywords": [ 892 | "debug", 893 | "dump" 894 | ], 895 | "funding": [ 896 | { 897 | "url": "https://symfony.com/sponsor", 898 | "type": "custom" 899 | }, 900 | { 901 | "url": "https://github.com/fabpot", 902 | "type": "github" 903 | }, 904 | { 905 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 906 | "type": "tidelift" 907 | } 908 | ], 909 | "time": "2021-01-27T10:15:41+00:00" 910 | }, 911 | { 912 | "name": "symfony/var-exporter", 913 | "version": "v5.2.3", 914 | "source": { 915 | "type": "git", 916 | "url": "https://github.com/symfony/var-exporter.git", 917 | "reference": "5aed4875ab514c8cb9b6ff4772baa25fa4c10307" 918 | }, 919 | "dist": { 920 | "type": "zip", 921 | "url": "https://api.github.com/repos/symfony/var-exporter/zipball/5aed4875ab514c8cb9b6ff4772baa25fa4c10307", 922 | "reference": "5aed4875ab514c8cb9b6ff4772baa25fa4c10307", 923 | "shasum": "" 924 | }, 925 | "require": { 926 | "php": ">=7.2.5", 927 | "symfony/polyfill-php80": "^1.15" 928 | }, 929 | "require-dev": { 930 | "symfony/var-dumper": "^4.4.9|^5.0.9" 931 | }, 932 | "type": "library", 933 | "autoload": { 934 | "psr-4": { 935 | "Symfony\\Component\\VarExporter\\": "" 936 | }, 937 | "exclude-from-classmap": [ 938 | "/Tests/" 939 | ] 940 | }, 941 | "notification-url": "https://packagist.org/downloads/", 942 | "license": [ 943 | "MIT" 944 | ], 945 | "authors": [ 946 | { 947 | "name": "Nicolas Grekas", 948 | "email": "p@tchwork.com" 949 | }, 950 | { 951 | "name": "Symfony Community", 952 | "homepage": "https://symfony.com/contributors" 953 | } 954 | ], 955 | "description": "Allows exporting any serializable PHP data structure to plain PHP code", 956 | "homepage": "https://symfony.com", 957 | "keywords": [ 958 | "clone", 959 | "construct", 960 | "export", 961 | "hydrate", 962 | "instantiate", 963 | "serialize" 964 | ], 965 | "funding": [ 966 | { 967 | "url": "https://symfony.com/sponsor", 968 | "type": "custom" 969 | }, 970 | { 971 | "url": "https://github.com/fabpot", 972 | "type": "github" 973 | }, 974 | { 975 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 976 | "type": "tidelift" 977 | } 978 | ], 979 | "time": "2021-01-27T10:01:46+00:00" 980 | }, 981 | { 982 | "name": "tightenco/collect", 983 | "version": "v8.19.0", 984 | "source": { 985 | "type": "git", 986 | "url": "https://github.com/tighten/collect.git", 987 | "reference": "0c0243a0dc0b66f54d0ec409f36cd9889665b132" 988 | }, 989 | "dist": { 990 | "type": "zip", 991 | "url": "https://api.github.com/repos/tighten/collect/zipball/0c0243a0dc0b66f54d0ec409f36cd9889665b132", 992 | "reference": "0c0243a0dc0b66f54d0ec409f36cd9889665b132", 993 | "shasum": "" 994 | }, 995 | "require": { 996 | "php": "^7.2|^8.0", 997 | "symfony/var-dumper": "^3.4 || ^4.0 || ^5.0" 998 | }, 999 | "require-dev": { 1000 | "mockery/mockery": "^1.0", 1001 | "nesbot/carbon": "^2.23.0", 1002 | "phpunit/phpunit": "^8.3" 1003 | }, 1004 | "type": "library", 1005 | "autoload": { 1006 | "files": [ 1007 | "src/Collect/Support/helpers.php", 1008 | "src/Collect/Support/alias.php" 1009 | ], 1010 | "psr-4": { 1011 | "Tightenco\\Collect\\": "src/Collect" 1012 | } 1013 | }, 1014 | "notification-url": "https://packagist.org/downloads/", 1015 | "license": [ 1016 | "MIT" 1017 | ], 1018 | "authors": [ 1019 | { 1020 | "name": "Taylor Otwell", 1021 | "email": "taylorotwell@gmail.com" 1022 | } 1023 | ], 1024 | "description": "Collect - Illuminate Collections as a separate package.", 1025 | "keywords": [ 1026 | "collection", 1027 | "laravel" 1028 | ], 1029 | "time": "2020-12-19T00:06:29+00:00" 1030 | } 1031 | ], 1032 | "packages-dev": [], 1033 | "aliases": [], 1034 | "minimum-stability": "stable", 1035 | "stability-flags": [], 1036 | "prefer-stable": false, 1037 | "prefer-lowest": false, 1038 | "platform": [], 1039 | "platform-dev": [], 1040 | "plugin-api-version": "1.1.0" 1041 | } 1042 | -------------------------------------------------------------------------------- /favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmedash95/leetcode-alfred-plugin/a133be51c4bd7dd8bc52c6471caf3d6201ffb2eb/favicon.png -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmedash95/leetcode-alfred-plugin/a133be51c4bd7dd8bc52c6471caf3d6201ffb2eb/icon.png -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.alfred.ahmedash95 7 | category 8 | Productivity 9 | connections 10 | 11 | 4F7A7F4B-EB35-478F-A9F0-1192A64BA8E2 12 | 13 | 14 | destinationuid 15 | 2C818D2B-7721-494E-BCC7-56C80ECCC636 16 | modifiers 17 | 0 18 | modifiersubtext 19 | 20 | vitoclose 21 | 22 | 23 | 24 | 25 | createdby 26 | Ahmed Ash 27 | description 28 | Leetcode alfred plugin 29 | disabled 30 | 31 | name 32 | Leetcode 33 | objects 34 | 35 | 36 | config 37 | 38 | alfredfiltersresults 39 | 40 | alfredfiltersresultsmatchmode 41 | 0 42 | argumenttreatemptyqueryasnil 43 | 44 | argumenttrimmode 45 | 0 46 | argumenttype 47 | 0 48 | escaping 49 | 4 50 | keyword 51 | lc 52 | queuedelaycustom 53 | 3 54 | queuedelayimmediatelyinitially 55 | 56 | queuedelaymode 57 | 0 58 | queuemode 59 | 1 60 | runningsubtext 61 | Searching for "{query}"... 62 | script 63 | php leetcode.php "{query}" 64 | scriptargtype 65 | 0 66 | scriptfile 67 | 68 | subtext 69 | Search the Leetcode.... 70 | title 71 | Leetcode 72 | type 73 | 0 74 | withspace 75 | 76 | 77 | type 78 | alfred.workflow.input.scriptfilter 79 | uid 80 | 4F7A7F4B-EB35-478F-A9F0-1192A64BA8E2 81 | version 82 | 3 83 | 84 | 85 | config 86 | 87 | browser 88 | 89 | spaces 90 | 91 | url 92 | {query} 93 | utf8 94 | 95 | 96 | type 97 | alfred.workflow.action.openurl 98 | uid 99 | 2C818D2B-7721-494E-BCC7-56C80ECCC636 100 | version 101 | 1 102 | 103 | 104 | readme 105 | Leetcode alfred plugin 106 | uidata 107 | 108 | 2C818D2B-7721-494E-BCC7-56C80ECCC636 109 | 110 | xpos 111 | 390 112 | ypos 113 | 135 114 | 115 | 4F7A7F4B-EB35-478F-A9F0-1192A64BA8E2 116 | 117 | xpos 118 | 130 119 | ypos 120 | 135 121 | 122 | 123 | variablesdontexport 124 | 125 | version 126 | 0.0.1 127 | webaddress 128 | https://twitter.com/ahmedash95 129 | 130 | 131 | -------------------------------------------------------------------------------- /leetcode.php: -------------------------------------------------------------------------------- 1 | 0) { 17 | array_shift($argv); 18 | } 19 | $query = strtolower(implode(' ', $argv)); 20 | 21 | $app = new Application($query, new Workflow()); 22 | $app->addService(new DailyProblemsService(new DailyProblemRepository(HttpClient::create()))); 23 | $app->addService(new DataStructureService(new DataStructuresCacheRepository(HttpClient::create(), new FilesystemAdapter()))); 24 | $app->addService(new ProblemsService(new ProblemCacheRepository(HttpClient::create(), new FilesystemAdapter()))); 25 | echo $app->run(); 26 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmedash95/leetcode-alfred-plugin/a133be51c4bd7dd8bc52c6471caf3d6201ffb2eb/screenshot.png -------------------------------------------------------------------------------- /src/Application.php: -------------------------------------------------------------------------------- 1 | query = $query; 19 | $this->workflow = $workflow; 20 | } 21 | 22 | public function addService(ServiceInterface $service) 23 | { 24 | $this->services[] = $service; 25 | } 26 | 27 | public function run() 28 | { 29 | foreach ($this->services as $service) { 30 | $service->run($this->query, $this->workflow); 31 | } 32 | 33 | return $this->workflow->output(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Entities/LeetCodeItem.php: -------------------------------------------------------------------------------- 1 | name; 28 | } 29 | 30 | /** 31 | * @param string $name 32 | */ 33 | public function setName(string $name): void 34 | { 35 | $this->name = $name; 36 | } 37 | 38 | /** 39 | * @return string 40 | */ 41 | public function getSlug(): string 42 | { 43 | return $this->slug; 44 | } 45 | 46 | /** 47 | * @param string $slug 48 | */ 49 | public function setSlug(string $slug): void 50 | { 51 | $this->slug = $slug; 52 | } 53 | 54 | /** 55 | * @return string 56 | */ 57 | public function getType(): string 58 | { 59 | return $this->type; 60 | } 61 | 62 | /** 63 | * @param string $type 64 | */ 65 | public function setType(string $type): void 66 | { 67 | $this->type = $type; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Entities/LeetCodeType.php: -------------------------------------------------------------------------------- 1 | client = $client; 20 | } 21 | 22 | public function get(): array 23 | { 24 | $response = $this->client->request('POST', 'https://leetcode.com/graphql', [ 25 | 'json' => [ 26 | 'query' => 'query questionOfToday {activeDailyCodingChallengeQuestion {link question { title }}}', 27 | ], 28 | ]); 29 | 30 | return $this->hydrate($response->toArray()['data']['activeDailyCodingChallengeQuestion'] ?? null); 31 | } 32 | 33 | /** 34 | * @param string $query 35 | * 36 | * @return array 37 | */ 38 | public function search($query): array 39 | { 40 | return $this->get(); 41 | } 42 | 43 | /** 44 | * @param array $data 45 | * 46 | * @return LeetCodeItem[] 47 | */ 48 | private function hydrate(array $data) 49 | { 50 | if ($data === null) { 51 | return []; 52 | } 53 | 54 | $leetcode = new LeetCodeItem(); 55 | $leetcode->setName($data['question']['title']); 56 | $leetcode->setType(LeetCodeType::PROBLEM_OF_THE_DAY); 57 | $leetcode->setSlug($data['link']); 58 | 59 | return [$leetcode]; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Repositories/DailyProblem/DailyProblemRepositoryInterface.php: -------------------------------------------------------------------------------- 1 | cache = $cache; 21 | } 22 | 23 | public function get(): array 24 | { 25 | return $this->cache->get('data_structures', function (ItemInterface $item) { 26 | $item->expiresAfter(172800); // 48 hours 27 | 28 | return parent::get(); 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Repositories/DataStructures/DataStructuresRepository.php: -------------------------------------------------------------------------------- 1 | client = $client; 20 | } 21 | 22 | public function get(): array 23 | { 24 | $response = $this->client->request( 25 | 'GET', 26 | 'https://leetcode.com/problems/api/tags/' 27 | ); 28 | 29 | return $this->hydrate($response->toArray()['topics'] ?? []); 30 | } 31 | 32 | public function search($query): array 33 | { 34 | $data = $this->get(); 35 | 36 | if (empty($query)) { 37 | return $data; 38 | } 39 | 40 | return array_filter($data, function (LeetCodeItem $item) use ($query) { 41 | return strpos(strtolower($item->getName()), trim($query)) !== false; 42 | }); 43 | } 44 | 45 | /** 46 | * @param array $data 47 | * 48 | * @return LeetCodeItem[] 49 | */ 50 | private function hydrate(array $data) 51 | { 52 | $items = []; 53 | foreach ($data as $row) { 54 | $leetcode = new LeetCodeItem(); 55 | $leetcode->setName($row['name']); 56 | $leetcode->setType(LeetCodeType::CATEGORY); 57 | $leetcode->setSlug(sprintf('/tag/%s/', $row['slug'])); 58 | 59 | $items[] = $leetcode; 60 | } 61 | 62 | return $items; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Repositories/Problems/ProblemCacheRepository.php: -------------------------------------------------------------------------------- 1 | cache = $cache; 21 | } 22 | 23 | public function get(): array 24 | { 25 | return $this->cache->get('problems', function (ItemInterface $item) { 26 | $item->expiresAfter(172800); // 48 hours 27 | 28 | return parent::get(); 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Repositories/Problems/ProblemRepository.php: -------------------------------------------------------------------------------- 1 | client = $client; 20 | } 21 | 22 | public function get(): array 23 | { 24 | $response = $this->client->request( 25 | 'GET', 26 | 'https://leetcode.com/api/problems/all/' 27 | ); 28 | 29 | return $this->hydrate($response->toArray()['stat_status_pairs'] ?? []); 30 | } 31 | 32 | /** 33 | * @param string $query 34 | * 35 | * @return array 36 | */ 37 | public function search($query): array 38 | { 39 | $data = $this->get(); 40 | 41 | if (empty($query)) { 42 | return $data; 43 | } 44 | 45 | return array_filter($data, function (LeetCodeItem $item) use ($query) { 46 | return strpos(strtolower($item->getName()), trim($query)) !== false; 47 | }); 48 | } 49 | 50 | /** 51 | * @param array $data 52 | * 53 | * @return LeetCodeItem[] 54 | */ 55 | private function hydrate(array $data) 56 | { 57 | $items = []; 58 | foreach ($data as $row) { 59 | $leetcode = new LeetCodeItem(); 60 | $leetcode->setName($row['stat']['question__title']); 61 | $leetcode->setType(LeetCodeType::PROBLEM); 62 | $leetcode->setSlug(sprintf('/problems/%s/', $row['stat']['question__title_slug'])); 63 | 64 | $items[] = $leetcode; 65 | } 66 | 67 | return $items; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Repositories/Problems/ProblemRepositoryInterface.php: -------------------------------------------------------------------------------- 1 | result() 14 | ->icon('favicon.png') 15 | ->title(sprintf('%s challenge %s', date('F'), date('Y'))) 16 | ->autocomplete('da') 17 | ->subtitle('Leetcode monthly challenge') 18 | ->arg($dailyChallengeLink) 19 | ->valid(true); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Services/DailyProblemsService.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 23 | } 24 | 25 | public function run(string $query, Workflow $workflow) 26 | { 27 | $data = $this->repository->search($query); 28 | 29 | foreach ($data as $item) { 30 | $workflow->result() 31 | ->icon('favicon.png') 32 | ->title($item->getName()) 33 | ->subtitle($item->getType()) 34 | ->arg(sprintf('https://leetcode.com%s', $item->getSlug())) 35 | ->valid(true); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Services/DataStructureService.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 23 | } 24 | 25 | public function run(string $query, Workflow $workflow) 26 | { 27 | $data = $this->repository->search($query); 28 | 29 | foreach ($data as $item) { 30 | $workflow->result() 31 | ->icon('favicon.png') 32 | ->title($item->getName()) 33 | ->subtitle($item->getType()) 34 | ->arg(sprintf('https://leetcode.com%s', $item->getSlug())) 35 | ->valid(true); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Services/ProblemsService.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 23 | } 24 | 25 | public function run(string $query, Workflow $workflow) 26 | { 27 | $data = $this->repository->search($query); 28 | 29 | foreach ($data as $item) { 30 | $workflow->result() 31 | ->icon('favicon.png') 32 | ->title($item->getName()) 33 | ->subtitle($item->getType()) 34 | ->arg(sprintf('https://leetcode.com%s', $item->getSlug())) 35 | ->valid(true); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Services/ServiceInterface.php: -------------------------------------------------------------------------------- 1 |