GithubHelp home page GithubHelp logo

lgdev07 / app_store Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linjunpop/app_store

0.0 0.0 0.0 79 KB

๐Ÿ‘ฉโ€๐Ÿ’ป An App Store Server API (StoreKit 2) client in Elixir.

License: MIT License

Elixir 100.00%

app_store's Introduction

App Store

App Store Server API client.

Installation

The package can be installed by adding app_store to your list of dependencies in mix.exs:

def deps do
  [
    {:app_store, "~> 0.2.1"}
  ]
end

Usage

Add the default HTTP client AppStore.HTTPClient.DefaultClient to the application's supervision tree:

# lib/your_app/application.ex
def start(_type, _args) do
  children = [
    ...
    {AppStore.HTTPClient.DefaultClient, []}
  ]

  ...
end

Build the client:

iex> app_store = AppStore.build()

%AppStore{
  api_config: %AppStore.API.Config{
    http_client: AppStore.HTTPClient.DefaultClient,
    json_coder: AppStore.JSON.DefaultCoder,
    server_url: "https://api.storekit.itunes.apple.com"
  },
  token_config: %AppStore.Token.Config{
    json_coder: AppStore.JSON.DefaultCoder
  }
}

Generate a token:

iex> token = AppStore.Token.generate_token(
  "57246542-96fe-1a63-e053-0824d011072a",
  "com.example.testbundleid2021",
  %{
    id: "2X9R4HXF34",
    pem: "-----BEGIN PRIVATE KEY----- ..."
  }
)

"eyJhbGciOiJFUzI1NiIsImtpZCI6IjJYOVI0SFhGMzQiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJhcHBzdG9yZWNvbm5lY3QtdjEiLCJiaWQiOiJjb20uZXhhbXBsZS50ZXN0YnVuZGxlaWQyMDIxIiwiZXhwIjoxNjI5NTA2MjQwLCJpYXQiOjE2Mjk1MDI3MDAsImlzcyI6IjU3MjQ2NTQyLTk2ZmUtMWE2My1lMDUzLTA4MjRkMDExMDcyYSIsIm5vbmNlIjoiMnFlaWc0a2wxOTQ0aHFhbmVzMDAwMGMxIn0.gYa_A7J6a6UAyBTAohf4gj28jT0k-OX1CW8cwsVGb4EewEm3owdsv6iWvzt7SutCndCBg5hPfNFWuZ0Au20HxA"

Get transactions history:

iex> {:ok, %AppStore.API.Response{body: body, status: status}} =
  AppStore.API.get_transaction_history(
    app_store.api_config,
    token,
    "the-transaction-id"
  )

Please check https://hexdocs.pm/app_store for a full documentation.

app_store's People

Contributors

linjunpop avatar lgdev07 avatar mrnovalles avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.