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

Update docs #5

Merged
merged 5 commits into from
Feb 12, 2024
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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 Hostari Philippines, Inc. <[email protected]>
Copyright (c) 2022-2024 Hostari Philippines, Inc. <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The Thunderstore API Crystal wrapper. Fetch game modification info from your
Crystal code.

Copyright 2022 Hostari Philippines, Inc. See LICENSE for copying information.
Copyright 2022-2024 Hostari Philippines, Inc. See LICENSE for copying information.

📝 Implements: [REST API Reference (V1)](https://valheim.thunderstore.io/api/docs/)
😘 Maintainer(s): @xaviablaza
Expand Down
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: thunderstore_client
version: 1.0.2
version: 1.0.3

authors:
- Xavi Ablaza <[email protected]>

crystal: 1.2.2
crystal: ~> 1.6.2

development_dependencies:
webmock:
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "spec"
require "webmock"
Spec.before_each &->WebMock.reset
require "json"
require "../src/thunderstore/**"
9 changes: 7 additions & 2 deletions src/thunderstore/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ module Thunderstore
def initialize(@community : String = "")
end

# Sets the `@community` instance variable.
# You can find a list of communities by going to https://thunderstore.io
# and looking at the the subdomains that each mod community is listed under.
def set_community(community : String)
@community = community
end

# Returns the base url for which this client will make API requests to
# Returns the base url for which this client will make API requests to.
def base_url : URI
return URI.parse("https://thunderstore.io") if community.empty?

URI.parse("https://#{community}.thunderstore.io")
end

def get(path : String)
# Initializes an `HTTP::Client` for the configured `base_url`, and executes a GET request on the specified `path`.
# The response will have its body as a String, accessed via `HTTP::Client::Response#body`.
def get(path : String) : HTTP::Client::Response
HTTP::Client.new(base_url).get(path)
end
end
Expand Down
1 change: 1 addition & 0 deletions src/thunderstore/error.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module Thunderstore
# Error class to catch if operations in this library are thrown.
class Error < Exception
property message : String?

Expand Down
3 changes: 2 additions & 1 deletion src/thunderstore_client.cr
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
require "json"
require "http/client"

# Specifies information related to this shard, like the `ThunderstoreClient::VERSION`
class ThunderstoreClient
VERSION = "1.0.2"
VERSION = "1.0.3"
end

require "./thunderstore/**"
Loading