Skip to content
This repository was archived by the owner on May 5, 2026. It is now read-only.
This repository was archived by the owner on May 5, 2026. It is now read-only.

how to get items name #5

Closed
Closed

Description

@Cansiny0320

i have got item id '167481de-4732-b44a-06ad-938625015abe' ,so how can i get this item name?

Activity

  1. Cansiny0320 commented on Jan 16, 2023

    @Cansiny0320
    Author

    sorry, it's not a bug,please remove bug label

  2. removed
    bugSomething isn't working
    on Jan 16, 2023
  3. KTNG-3 commented on Jan 16, 2023

    @KTNG-3
    Member

    how did you get that item id? that is difficult to find.

  4. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    there is my code

    import { AuthClient } from '@valapi/auth'
    import { Client as WebClient } from '@valapi/web-client'
    
    import { Region } from '@valapi/lib'
    
    const config = {
      region: Region.Default.Asia_Pacific,
      throwOnError: true,
    }
    
    const authClient = new AuthClient(config)
    
    const login = async () => {
      await authClient.login('xxx', 'xxx')
    }
    
    const main = async () => {
      await login()
      const subject = authClient.getSubject()
      const json = authClient.toJSON()
      const webClient = new WebClient(config)
      webClient.fromJSON(json)
      const data = await webClient.Store.getStorefront(subject)
    
      console.log(data.data.SkinsPanelLayout.SingleItemOffers[0])
    }
    
    main()
  5. KTNG-3 commented on Jan 17, 2023

    @KTNG-3
    Member

    here you are, try it first maybe it doesn't work.

    const getOffers = await WebClient.Store.getOffers();
    
    async function getOffersOf(ItemsId: string) {
        let Store_Display_Name = "";
        let Store_Display_Icon = "";
        const GetWeaponSkinLevel = await ValorantApiCom.Weapons.getSkinLevels();
        for (const _SkinLevel of GetWeaponSkinLevel.data.data) {
                if (_SkinLevel.uuid === ItemsId) {
                    Store_Display_Name = _SkinLevel.displayName;
                    Store_Display_Icon = _SkinLevel.displayIcon;
    
                    break;
                }
            }
    
        return {
            Name: Store_Display_Name,
            Icon: Store_Display_Icon
        };
    }
    
    const AllOffers = (await WebClient.Store.getStorefront("subject")).data.SkinsPanelLayout.SingleItemOffers;
    
    for (const ofItemID in AllOffers) {
        const ItemID = AllOffers[ofItemID];
        const _Offer = await getOffersOf(ItemID);
    }
  6. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    here you are, try it first maybe it doesn't work.

    const getOffers = await WebClient.Store.getOffers();
    
    async function getOffersOf(ItemsId: string) {
        let Store_Display_Name = "";
        let Store_Display_Icon = "";
        const GetWeaponSkinLevel = await ValorantApiCom.Weapons.getSkinLevels();
        for (const _SkinLevel of GetWeaponSkinLevel.data.data) {
                if (_SkinLevel.uuid === ItemsId) {
                    Store_Display_Name = _SkinLevel.displayName;
                    Store_Display_Icon = _SkinLevel.displayIcon;
    
                    break;
                }
            }
    
        return {
            Name: Store_Display_Name,
            Icon: Store_Display_Icon
        };
    }
    
    const AllOffers = (await WebClient.Store.getStorefront("subject")).data.SkinsPanelLayout.SingleItemOffers;
    
    for (const ofItemID in AllOffers) {
        const ItemID = AllOffers[ofItemID];
        const _Offer = await getOffersOf(ItemID);
    }

    it's not work, this request https://pd.ap.a.pvp.net/store/v2/storefront/subject 400 status

  7. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    maybe it need auth?

  8. KTNG-3 commented on Jan 17, 2023

    @KTNG-3
    Member

    yeah

  9. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    but there is not ApiClient.fromJSON, any way else?

  10. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    there is my code now

    import { AuthClient } from '@valapi/auth'
    import { Client as WebClient } from '@valapi/web-client'
    import { Client as ValorantApi } from '@valapi/valorant-api.com'
    
    import { Region } from '@valapi/lib'
    
    const config = {
      region: Region.Default.Asia_Pacific,
      throwOnError: true,
    }
    
    const authClient = new AuthClient(config)
    
    const login = async () => {
      await authClient.login('xxx', 'xxx')
    }
    
    const main = async () => {
      await login()
      const subject = authClient.getSubject()
      const json = authClient.toJSON()
      const webClient = new WebClient(config)
      const ApiClient = new ValorantApi({
        language: 'zh-CN',
      })
      webClient.fromJSON(json)
      // ApiClient.fromJSON(json)
      const data = await webClient.Store.getStorefront(subject)
    
      const getOffers = await webClient.Store.getOffers()
    
      async function getOffersOf(ItemsId: string) {
        let Store_Display_Name = ''
        let Store_Display_Icon = ''
        const GetWeaponSkinLevel = await ApiClient.Weapons.getSkinLevels()
        for (const _SkinLevel of GetWeaponSkinLevel.data.data!) {
          if (_SkinLevel.uuid === ItemsId) {
            Store_Display_Name = _SkinLevel.displayName as string
            Store_Display_Icon = _SkinLevel.displayIcon
    
            break
          }
        }
    
        return {
          Name: Store_Display_Name,
          Icon: Store_Display_Icon,
        }
      }
    
      const AllOffers = (await webClient.Store.getStorefront('subject')).data.SkinsPanelLayout
        .SingleItemOffers
    
      for (const ofItemID in AllOffers) {
        const ItemID = AllOffers[ofItemID]
        const _Offer = await getOffersOf(ItemID)
        console.log(_Offer)
      }
    }
    
    main()
  11. KTNG-3 commented on Jan 17, 2023

    @KTNG-3
    Member

    yes like that,
    put my code after your code

  12. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    @KTNG-3 like this? but it still not working now

  13. KTNG-3 commented on Jan 17, 2023

    @KTNG-3
    Member
    import { AuthClient } from "@valapi/auth";
    import { Client as WebClient } from "@valapi/web-client";
    import { Client as ValorantApi } from "@valapi/valorant-api.com";
    
    import { Region } from "@valapi/lib";
    
    const config = {
        region: Region.Default.Asia_Pacific,
        throwOnError: true
    };
    
    const authClient = new AuthClient(config);
    
    const login = async () => {
        await authClient.login("Username", "Password");
    };
    
    const main = async () => {
        await login();
        const subject = authClient.getSubject();
        const webClient = WebClient.fromJSON(authClient.toJSON());
        const ApiClient = new ValorantApi({
            language: "zh-CN"
        });
    
        const data = await webClient.Store.getStorefront(subject);
    
        // const getOffers = await webClient.Store.getOffers();
    
        async function getOffersOf(ItemsId: string) {
            let Store_Display_Name = "";
            let Store_Display_Icon = "";
            const GetWeaponSkinLevel = await ApiClient.Weapons.getSkinLevels();
            if (GetWeaponSkinLevel.data.data) {
                for (const _SkinLevel of GetWeaponSkinLevel.data.data) {
                    if (_SkinLevel.uuid === ItemsId) {
                        Store_Display_Name = _SkinLevel.displayName as string;
                        Store_Display_Icon = _SkinLevel.displayIcon;
        
                        break;
                    }
                }
            }
    
            return {
                Name: Store_Display_Name,
                Icon: Store_Display_Icon
            };
        }
    
        const AllOffers = data.data.SkinsPanelLayout
            .SingleItemOffers;
    
        for (const ofItemID in AllOffers) {
            const ItemID = AllOffers[ofItemID];
            const _Offer = await getOffersOf(ItemID);
    
            console.log(_Offer);
        }
    };
    
    main();
  14. KTNG-3 commented on Jan 17, 2023

    @KTNG-3
    Member

    is it work?

  15. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    The code works fine, but the information is not the same as my store information

  16. KTNG-3 commented on Jan 17, 2023

    @KTNG-3
    Member

    hmm, its seem a problem

  17. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    I can't tell whether I got the wrong id or the id is wrongly mapped to the displayname

  18. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    there is my log

    89b68205-4fe5-2434-a731-e5a734bd4a7a Undercity Bulldog
    5f059d7e-413c-445c-e36f-9a9791fba5b0 Origin Crescent Blade
    33d3c906-4305-19cf-8770-1eb5207482cc Rush Judge
    1b94d997-4db6-014f-4cb8-c1b4df7d7ebc Smite Judge
  19. KTNG-3 commented on Jan 17, 2023

    @KTNG-3
    Member

    so you need "displayname" in your language
    or
    the item is wrong

  20. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    i find it

     const webClient = new WebClient(config)
     webClient.fromJSON(authClient.toJSON())

    This needs to be written in order to correctly set the region in config

     const webClient = WebClient.fromJSON(authClient.toJSON());

    Writing config like this doesn't work

  21. Cansiny0320 commented on Jan 17, 2023

    @Cansiny0320
    Author

    it is ok now, thx

  22. removed
    bugSomething isn't working
    on Jan 17, 2023
  23. locked and limited conversation to collaborators on Jan 17, 2023
  24. converted this issue into a discussion #6 on Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions