Coder Social home page Coder Social logo

codewars-api-client's Introduction

Codewars API Client

Test coverage Mutation testing badge GitHub license GitHub contributors GitHub issues GitHub pull requests

A library built to interact with the Codewars API and platform.

Installation

Use the package manager composer to install the library using the following command.

composer require jamesrweb/codewars-api-client

Basic Usage

Once the package has been installed, we can create the required clients like.

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use CodewarsApiClient\Client;

$client = new Client("your-api-key");

The Client

A Client instance allows us to interact with the codewars API in a consistent manner.

Methods

Get information about the user

To get information regarding the user, you can run:

$client->user(string $username);

Get challenges created by the user

To get a list of challenges the user created, you can run:

$client->authored(string $username);

Get challenges completed by the user

To get a list of challenges the user completed, you can run:

$client->completed(string $username);

Get information about a specific challenge

To get an overview regarding a specific challenge, you can run:

$client->challenge(string $id);

Get information about multiple challenges

To get an overview of multiple challenges at once, you can run:

$client->challenges(array<string> $ids);

Interfaces

There are a number of interfaces exposed for you to use if required. These are namespaced under the CodewarsApiClient\Interfaces namespace.

The ChallengeInterface

This interface is for the methods that access challenge specific data.

The UserInterface

This interface is for the methods that access user specific data.

The ClientInterface

This interface is for the methods that are accessible to use via a Client instance and is contains all methods defined in the ChallengeInterface and UserInterface interfaces.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

This project uses an MIT license. If you wish to view the license, it can be found in the project root.

codewars-api-client's People

Contributors

jamesrweb avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

codewars-api-client's Issues

How Do I Find My API Key

HI there James,

Can you help me know how to locate my API key from Codewars? I remember it being in the account settings but I don't see it there now.

Thanks!

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.