Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Develop branch #27

Merged
merged 6 commits into from
Oct 26, 2017
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
132 changes: 132 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,135 @@ src/main/resources/
bintray.gradle
/src/test/java/me/xhsun/guildwars2wrapper/GuildWars2Test.java
/src/test/resources/

### Eclipse ###

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

### Eclipse Patch ###
# Eclipse Core
.project

# JDT-specific (Eclipse Java Development Tools)
.classpath

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ First of all, you need to get GuildWars2 object by calling:
GuildWars2.getInstance();
```

If you would like to get the information in different language (only for APIs which are locale aware),
use ```GuildWars2.setLanguage(LanguageSelect)```. For instance, to get information in Spanish:

```java
GuildWars2.setLanguage(LanguageSelect.Spanish);
```

<sub>*Note: Possible languages are English (Default), German, Spanish, French, and Chinese. If you do not set
a language, it will default to English.*</sub>

#### API Wrapper Methods

Use methods in ```SynchronousRequest``` class to get the content synchronously, which can be accessed by calling ```getSynchronous()``` function in ```GuildWars2``` class.
Expand Down Expand Up @@ -58,7 +68,9 @@ response for that endpoint.
For example, the response for [/v2/tokeninfo](https://wiki.guildwars2.com/wiki/API:2/tokeninfo):

> id (string) - The API key that was requested.
>
> name (string) - The name given to the API key by the account owner. <strong>Warning</strong>: The value of this field is not escaped and may contain valid HTML, JavaScript, other code. Handle with care.
>
> permissions (array) - Array of strings describing which permissions the API key has. The array can contain any of:
> + account - Grants access to the /v2/account endpoint (This permission is required for all API keys).
> + builds - Grants access to view each character's equipped specializations and gear.
Expand Down Expand Up @@ -107,6 +119,19 @@ new endpoints as they come out.
API:1 endpoints because there probably is an API:2 endpoint that does the same thing or the endpoint is
currently disabled.*</sub>

## Extra Utility Methods

```GuildWars2Utility``` class contains a few utility methods, such as extract id from chat link, get root id, and parse coins,
which should hopefully help you out.

For example, ```GuildWars2Utility.parseCoins(long)``` will parse the given coin value into gold, sliver, and copper:

```java
long coins = 199;
long[] result = GuildWars2Utility.parseCoins(coins);
//result will be [0, 1, 99], whilch means 0 gold, 1 sliver and 99 coppers
```

## Download

Download latest [release](https://github.com/xhsun/gw2wrapper/releases) in Maven:
Expand All @@ -115,7 +140,7 @@ Download latest [release](https://github.com/xhsun/gw2wrapper/releases) in Maven
<dependency>
<groupId>me.xhsun.gw2wrapper</groupId>
<artifactId>gw2wrapper</artifactId>
<version>1.2.3</version>
<version>1.3.0</version>
</dependency>
```

Expand All @@ -124,7 +149,7 @@ Or Gradle:
```groovy
dependencies {
...
compile 'me.xhsun.gw2wrapper:gw2wrapper:1.2.3'
compile 'me.xhsun.gw2wrapper:gw2wrapper:1.3.0'
...
}
```
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ allprojects {
jcenter()
}
apply plugin: 'java'
apply plugin: 'eclipse'
}

Properties properties = new Properties()
Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sun Jun 04 22:50:06 MDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip
6 changes: 3 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -155,7 +155,7 @@ if $cygwin ; then
fi

# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
Expand Down
47 changes: 14 additions & 33 deletions src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,25 @@
package me.xhsun.guildwars2wrapper;

import me.xhsun.guildwars2wrapper.model.v1.AllWvWMatchOverview;
import me.xhsun.guildwars2wrapper.model.v1.EventDetail;
import me.xhsun.guildwars2wrapper.model.v1.SimpleName;
import java.util.*;

import me.xhsun.guildwars2wrapper.model.v1.*;
import me.xhsun.guildwars2wrapper.model.v2.*;
import me.xhsun.guildwars2wrapper.model.v2.Currency;
import me.xhsun.guildwars2wrapper.model.v2.account.*;
import me.xhsun.guildwars2wrapper.model.v2.achievement.Achievement;
import me.xhsun.guildwars2wrapper.model.v2.achievement.AchievementCategory;
import me.xhsun.guildwars2wrapper.model.v2.achievement.AchievementGroup;
import me.xhsun.guildwars2wrapper.model.v2.achievement.DailyAchievement;
import me.xhsun.guildwars2wrapper.model.v2.backstory.BackStoryAnswer;
import me.xhsun.guildwars2wrapper.model.v2.backstory.BackStoryQuestion;
import me.xhsun.guildwars2wrapper.model.v2.character.Character;
import me.xhsun.guildwars2wrapper.model.v2.achievement.*;
import me.xhsun.guildwars2wrapper.model.v2.backstory.*;
import me.xhsun.guildwars2wrapper.model.v2.character.*;
import me.xhsun.guildwars2wrapper.model.v2.character.Character;
import me.xhsun.guildwars2wrapper.model.v2.commerce.*;
import me.xhsun.guildwars2wrapper.model.v2.continent.Continent;
import me.xhsun.guildwars2wrapper.model.v2.continent.ContinentFloor;
import me.xhsun.guildwars2wrapper.model.v2.continent.ContinentMap;
import me.xhsun.guildwars2wrapper.model.v2.continent.ContinentRegion;
import me.xhsun.guildwars2wrapper.model.v2.continent.*;
import me.xhsun.guildwars2wrapper.model.v2.guild.*;
import me.xhsun.guildwars2wrapper.model.v2.pvp.*;
import me.xhsun.guildwars2wrapper.model.v2.story.Story;
import me.xhsun.guildwars2wrapper.model.v2.story.StorySeason;
import me.xhsun.guildwars2wrapper.model.v2.story.*;
import me.xhsun.guildwars2wrapper.model.v2.util.Inventory;
import me.xhsun.guildwars2wrapper.model.v2.wvw.WvWAbility;
import me.xhsun.guildwars2wrapper.model.v2.wvw.WvWObjective;
import me.xhsun.guildwars2wrapper.model.v2.wvw.WvWRank;
import me.xhsun.guildwars2wrapper.model.v2.wvw.WvWUpgrade;
import me.xhsun.guildwars2wrapper.model.v2.wvw.matches.WvWMatchDetail;
import me.xhsun.guildwars2wrapper.model.v2.wvw.matches.WvWMatchOverview;
import me.xhsun.guildwars2wrapper.model.v2.wvw.matches.WvWMatchScore;
import me.xhsun.guildwars2wrapper.model.v2.wvw.matches.WvWMatchStat;
import me.xhsun.guildwars2wrapper.model.v2.wvw.*;
import me.xhsun.guildwars2wrapper.model.v2.wvw.matches.*;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

import java.util.List;
import java.util.Map;
import retrofit2.http.*;

/**
* API interface for different calls
Expand Down Expand Up @@ -426,8 +407,8 @@ interface GuildWars2API {
@GET("/v2/items")
Call<List<Integer>> getAllItemIDs();

@POST("/v2/items")
//TODO see if this works
// item info
@GET("/v2/items")
Call<List<Item>> getItemInfo(@Query("ids") String ids, @Query("lang") String lang);

//item stat (lang)
Expand Down