Skip to content

Commit

Permalink
[WoW] Add support for Character Soulbinds APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pewtro committed Aug 10, 2024
1 parent 38de1fd commit 6424b30
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-bats-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blizzard-api/wow': minor
---

Add support for Character Soulbinds APIs
20 changes: 20 additions & 0 deletions packages/wow/src/character-soulbinds/character-soulbinds.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest';
import { characterSoulbinds } from './character-soulbinds';

describe('characterSoulbinds', () => {
it('returns the correct ProtectedResource object', () => {
const realmSlug = 'example-realm';
const characterName = 'example-character';
const token = 'example-token';

const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/example-realm/example-character/soulbinds',
token: 'example-token',
};

const result = characterSoulbinds(realmSlug, characterName, token);

expect(result).toEqual(expectedResource);
});
});
14 changes: 14 additions & 0 deletions packages/wow/src/character-soulbinds/character-soulbinds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { ProtectedResource } from '@blizzard-api/core';
import type { CharacterSoulbindsResponse } from './types';

export function characterSoulbinds(
realmSlug: string,
characterName: string,
token: string,
): ProtectedResource<CharacterSoulbindsResponse> {
return {
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName.toLowerCase()}/soulbinds`,
token,
};
}
44 changes: 44 additions & 0 deletions packages/wow/src/character-soulbinds/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import type { NameIdKey, ResponseBase } from '../base';

export interface CharacterSoulbindsResponse extends ResponseBase {
character: Character;
chosen_covenant: NameIdKey;
renown_level: number;
soulbinds: Array<Soulbind>;
}

interface Realm extends NameIdKey {
slug: string;
}

interface Character extends NameIdKey {
realm: Realm;
}

interface Soulbind {
is_active?: boolean;
soulbind: NameIdKey;
traits: Array<Trait>;
}

interface Trait {
conduit_socket?: ConduitSocket;
display_order: number;
tier: number;
trait?: NameIdKey;
}

interface ConduitSocket {
socket: Socket;
type: TypeClass;
}

interface Socket {
conduit: NameIdKey;
rank: number;
}

interface TypeClass {
name: 'Endurance Conduit Slot' | 'Finesse Conduit Slot' | 'Potency Conduit Slot';
type: 'ENDURANCE' | 'FINESSE' | 'POTENCY';
}
6 changes: 6 additions & 0 deletions packages/wow/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { characterProfileStatus, characterProfileSummary } from './character-pro
import { characterPvpSummary } from './character-pvp/character-pvp';
import { characterCompletedQuests, characterQuests } from './character-quests/character-quests';
import { characterReputationsSummary } from './character-reputations/character-reputations';
import { characterSoulbinds } from './character-soulbinds/character-soulbinds';
import { connectedRealm, connectedRealmIndex, connectedRealmSearch } from './connected-realm/connected-realm';
import {
conduit,
Expand Down Expand Up @@ -244,6 +245,8 @@ export const wow = {
characterQuests,
//Character Reputations
characterReputationsSummary,
//Character Soulbinds
characterSoulbinds,
//Connected Realm
connectedRealm,
connectedRealmIndex,
Expand Down Expand Up @@ -458,6 +461,9 @@ export * from './character-quests/types';
//Character Reputations
export * from './character-reputations/character-reputations';
export * from './character-reputations/types';
//Character Soulbinds
export * from './character-soulbinds/character-soulbinds';
export * from './character-soulbinds/types';
//Connected Realm
export * from './connected-realm/connected-realm';
export * from './connected-realm/types';
Expand Down

0 comments on commit 6424b30

Please sign in to comment.