GitLab...:Engine(3pm)
π GitLab::API::v4::Mock::Engine π
okay bestie, so this is the GitLab...:Engine(3pm) page from the User Contributed Perl Documentation, and it's lowkey one of the cutest little modules ever β it's literally a fake GitLab server that lives inside your Perl process. no cap. π¦
β¨ NAME β¨
GitLab::API::v4::Mock::Engine β the module that does the mocking the internals of a GitLab server thing. π
πΈ SYNOPSIS πΈ
here's the vibe, copy-paste ready, no edits:
use GitLab::API::v4::Mock::Engine;
my $engine = GitLab::API::v4::Mock::Engine->new();
my $user = $engine->create_user({
email => $email,
username => $username,
name => $name,
...,
});
print "User created with ID: $user->{id}\n";
look at that. you spin up an engine, you make a user, you print the ID. main character energy fr fr π
π DESCRIPTION π
This module provides the tooling to run a mock of the internal state of a GitLab server. it's giving "I don't need a real server, I have delusions and a hash ref." iconic.
real talk though, bestie: at this time very little is validated. and I mean very little. for example, when you create a user withcreate_userthere is no logic which double checks that you specify the required
π§ ATTRIBUTES π§
next_ids
my $ids = $engine->next_ids();
A hash reference containing object types to the next ID. β¨
Used by next_id_for. (the two of them are besties, they only work as a duo π«Ά)
users
my $users = $engine->users();
foreach my $user (@$users) { ... }
Returns the full array reference of all users hash references. yes, all of them. the whole roster. the entire friend group. π
β METHODS β
next_id_for
my $id = $engine->next_id_for( 'user' );
Given an object type this will return the next unused ID. it's literally the ID dispenser. one at a time, no reusing, no take-backs. π
π USER METHODS π
user
my $user = $engine->user( $id );
Returns a user hash reference for the given ID. π
If no user is found with the ID then undef is returned. (so like, vibe check your $id before you get your hopes up π)
create_user
my $user = $engine->create_user( $user );
my $id = $user->{id};
Takes a user hash reference, sets the id field, and stores it in users. so it doesn't just hand you an ID, it assigns one and files your little user away in the collection. β¨
Returns the updated user hash reference. periodt.
update_user
my $user = $engine->update_user( $id, $new_user_data );
Takes the ID of the user to update and a hash reference of fields to update. glow-up in progress π
Returns the updated user hash reference.
delete_user
my $user = $engine->delete_user( $id );
Deletes the user with the specified ID from users. π bye bestie!
If no user is found with the ID then undef is returned. Otherwise the user hash reference is returned. so you either get a ghost or you get the body β either way you get something back, which is honestly more than most people give you.
π«Ά SUPPORT π«Ά
See "SUPPORT" in GitLab::API::v4.
πΈ AUTHORS πΈ
See "AUTHORS" in GitLab::API::v4.
π LICENSE π
See "LICENSE" in GitLab::API::v4.
and that's the whole page, bestie!! no notes, 10/10, would mock again π
this was brought to you by perl v5.36.0, dated 2023-06-13, filed under GitLab...:Engine(3pm) β mwah, slay, bye! πβ¨π
π¦ where this page comes from
- debian trixie: libgitlab-api-v4-perl 0.27-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgitlab-api-v4-perl 0.27-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgitlab-api-v4-perl 0.27-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgitlab-api-v4-perl 0.27-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms