Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ Get all package versions from repository:
```erlang
> hex_repo:get_versions(Config).
{ok, {200, ...,
#{packages => [
Copy link
Member

Choose a reason for hiding this comment

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

@ericmj to recap, previously we had:

> hex_repo:get_versions(Config)
{ok, {200, _, #{packages => Packages}}}

now we have:

> hex_repo:get_versions(Config)
{ok, {200, _, Packages}}

which means we'd no longer be able to associate any "metadata" with the versions resource in a backwards compatible way (adding new keys to the return map). I think that's OK, I can't think of anything we'd use it for, but just mentioning it. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's better this way, the other "metadata" wasn't really documented in the first place, right?

Copy link
Member

Choose a reason for hiding this comment

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

Yup

[
#{name => <<"package1">>, retired => [], versions => [<<"1.0.0">>]},
#{name => <<"package2">>, retired => [], versions => [<<"0.5.0">>]},
]}}}
]}}
```

Get package releases from repository:

```erlang
> hex_repo:get_package(Config, <<"package1">>).
{ok, {200, ...,
#{releases => [
[
#{checksum => ..., version => <<"0.5.0">>, dependencies => []}],
#{checksum => ..., version => <<"1.0.0">>, dependencies => []}],
]}}}
]}}
```

### API
Expand Down
3 changes: 2 additions & 1 deletion proto/hex_pb_names.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ message Names {
message Package {
// Package name
required string name = 1;

// If set, the name of the package repository (NEVER USED, DEPRECATED)
optional string repository = 2;
// string repository = 2;
}
2 changes: 1 addition & 1 deletion proto/hex_pb_versions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ message Package {
// Zero-based indexes of retired versions in the versions field, see package.proto
repeated int32 retired = 3 [packed=true];
// If set, the name of the package repository (NEVER USED, DEPRECATED)
optional string repository = 4;
// string repository = 4;
}
2 changes: 2 additions & 0 deletions src/hex_core.erl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ J1i2xWFndWa6nfFnRxZmCStCOZWYYPlaxr+FZceFbpMwzTNs4g3d4tLNUcbKAIH4
http_adapter => module(),
http_etag => binary(),
http_user_agent_fragment => binary(),
repo_name => binary(),
repo_key => binary(),
repo_url => binary(),
repo_public_key => binary(),
Expand All @@ -35,6 +36,7 @@ default_config() ->
http_adapter => hex_http_httpc,
http_adapter_config => #{profile => default},
http_user_agent_fragment => <<"(httpc)">>,
repo_name => <<"hexpm">>,
repo_url => <<"https://repo.hex.pm">>,
repo_public_key => ?HEXPM_PUBLIC_KEY,
repo_verify => true
Expand Down
Loading