alpha
Login
or
Join now
folospior.dev
/
grom
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
A Discord API Library for Gleam! 💫
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
get invite target users ids endpoint
author
Filip Hoffmann
date
5 months ago
(Feb 17, 2026, 10:00 PM +0100)
commit
5ab62ae3
5ab62ae3e25c2d3e0190486a0836c1133abaa259
parent
400d6adc
400d6adcc7b1f7d1b3310a5110205dd510ab3f87
+37
3 changed files
Expand all
Collapse all
Unified
Split
gleam.toml
manifest.toml
src
grom
invite.gleam
+1
gleam.toml
View file
Reviewed
···
28
28
operating_system = ">= 1.0.1 and < 2.0.0"
29
29
status_code = ">= 1.0.0 and < 2.0.0"
30
30
stratus = ">= 2.0.0 and < 3.0.0"
31
31
+
splitter = ">= 1.2.0 and < 2.0.0"
31
32
32
33
[dev-dependencies]
33
34
gleeunit = ">= 1.0.0 and < 2.0.0"
+2
manifest.toml
View file
Reviewed
···
16
16
{ name = "logging", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "1098FBF10B54B44C2C7FDF0B01C1253CAFACDACABEFB4B0D027803246753E06D" },
17
17
{ name = "multipart_form", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_stdlib"], otp_app = "multipart_form", source = "hex", outer_checksum = "082C77A0C3BB1128FCD55491665E9B72BC943E849B67D02B08CFA6808AD8E47C" },
18
18
{ name = "operating_system", version = "1.0.1", build_tools = ["gleam"], requirements = [], otp_app = "operating_system", source = "hex", outer_checksum = "682D4D19496E607A6E6229AA51A38A1400ED5067C2C54D56843DBCB0C61FFA6D" },
19
19
+
{ name = "splitter", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "3DFD6B6C49E61EDAF6F7B27A42054A17CFF6CA2135FF553D0CB61C234D281DD0" },
19
20
{ name = "status_code", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "status_code", source = "hex", outer_checksum = "F6EC765345A634602AD030EB1B4D34A425873CBC223CEC595EBF062073CD70BC" },
20
21
{ name = "stratus", version = "2.0.0", build_tools = ["gleam"], requirements = ["exception", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "gramps", "logging"], otp_app = "stratus", source = "hex", outer_checksum = "DB81236C1E00C29C01FBED9D3B0946E7A74AEE7D515036C7BF152D22430ADE9E" },
21
22
]
···
31
32
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
32
33
multipart_form = { version = ">= 1.1.0 and < 2.0.0" }
33
34
operating_system = { version = ">= 1.0.1 and < 2.0.0" }
35
35
+
splitter = { version = ">= 1.2.0 and < 2.0.0" }
34
36
status_code = { version = ">= 1.0.0 and < 2.0.0" }
35
37
stratus = { version = ">= 2.0.0 and < 3.0.0" }
+34
src/grom/invite.gleam
View file
Reviewed
···
19
19
import grom/internal/time_duration
20
20
import grom/internal/time_rfc3339
21
21
import grom/user.{type User, User}
22
22
+
import splitter.{type Splitter}
22
23
23
24
// TYPES -----------------------------------------------------------------------
24
25
···
461
462
pub fn new_create() -> Create {
462
463
Create(None, None, False, False, None, None, None)
463
464
}
465
465
+
466
466
+
pub fn get_target_users_ids(
467
467
+
client: grom.Client,
468
468
+
for_code code: String,
469
469
+
) -> Result(List(String), grom.Error) {
470
470
+
use response <- result.try(
471
471
+
client
472
472
+
|> rest.new_request(http.Get, "/invites/" <> code <> "/target-users")
473
473
+
|> rest.execute,
474
474
+
)
475
475
+
476
476
+
Ok(split_endlines(response.body))
477
477
+
}
478
478
+
479
479
+
// Cursed CSV handling, because this is a cursed CSV.
480
480
+
fn split_endlines(string: String) -> List(String) {
481
481
+
let splitter = splitter.new(["\r\n", "\n"])
482
482
+
split_endlines_loop(string, splitter, [])
483
483
+
}
484
484
+
485
485
+
fn split_endlines_loop(
486
486
+
string: String,
487
487
+
splitter: Splitter,
488
488
+
acc: List(String),
489
489
+
) -> List(String) {
490
490
+
case splitter.split(splitter, string) {
491
491
+
#(last, "", "") ->
492
492
+
[last, ..acc]
493
493
+
|> list.reverse
494
494
+
|> list.drop(1)
495
495
+
#(id, _, rest) -> split_endlines_loop(rest, splitter, [id, ..acc])
496
496
+
}
497
497
+
}