Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Custom Collection Name Option & Refactor Authentication Logic #116

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Thiago-Rizzo
Copy link

This PR introduces two key improvements:

Custom Collection Name

Added an option to specify a custom collection name (collection_name) instead of using the filename by default.

Authentication Logic Refactor

Separated authentication logic from the main code to improve maintainability and readability.

@andreaselia
Copy link
Owner

Oh dang, awesome PR, thank you @Thiago-Rizzo!

I'll try and get round to testing this as soon as I can!

@andreaselia
Copy link
Owner

@Thiago-Rizzo looks like we may have a test failing due to this? Would you mind adding a test to cover the new change too please? 🙏

config()->set('api-postman.authentication', [
'method' => $this->option('bearer') ? 'bearer' : ($this->option('basic') ? 'basic' : null),
'token' => $this->option('bearer') ?? $this->option('basic') ?? null,
$this->resolveAuth();
Copy link
Collaborator

@tomirons tomirons Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of breaking this out. I would like to keep it fluent.

$exporter
    ->to($filename)
    ->collectionName($collectionName)
    ->setAuthentication($this->resolveAuth())
    ->export();

What gets returned from resolveAuth is the instance of the class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants