<commit_before>import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError

class Subscription(Model):
    class Addon(Model):
      fields = ["id", "quantity"]
      pass
    class Coupon(Model):
      fields = ["coupon_id", "apply_till", "applied_count"]
      pass

    fields = ["id", "plan_id", "plan_quantity", "status", "trial_start", "trial_end", "current_term_start", \
    "current_term_end", "remaining_billing_cycles", "created_at", "activated_at", "cancelled_at", \
    "cancel_reason", "due_invoices_count", "due_since", "total_dues", "addons", "coupon", "coupons" ]


    @staticmethod
    def create(params, env=None):
        return request.send('post', '/subscriptions', params, env)

    @staticmethod
    def create_for_customer(id, params, env=None):
        return request.send('post', '/customers/%s/subscriptions' % id, params, env)

    @staticmethod
    def list(params=None, env=None):
        return request.send('get', '/subscriptions', params, env)

    @staticmethod
    def retrieve(id, env=None):
        return request.send('get', '/subscriptions/%s' % id, None, env)

    @staticmethod
    def update(id, params=None, env=None):
        return request.send('post', '/subscriptions/%s' % id, params, env)

    @staticmethod
    def change_term_end(id, params, env=None):
        return request.send('post', '/subscriptions/%s/change_term_end' % id, params, env)

    @staticmethod
    def cancel(id, params=None, env=None):
        return request.send('post', '/subscriptions/%s/cancel' % id, params, env)

    @staticmethod
    def reactivate(id, params=None, env=None):
        return request.send('post', '/subscriptions/%s/reactivate' % id, params, env)<commit_msg>Add credit API support added<commit_after>import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError

class Subscription(Model):
    class Addon(Model):
      fields = ["id", "quantity"]
      pass
    class Coupon(Model):
      fields = ["coupon_id", "apply_till", "applied_count"]
      pass

    fields = ["id", "plan_id", "plan_quantity", "status", "trial_start", "trial_end", "current_term_start", \
    "current_term_end", "remaining_billing_cycles", "created_at", "activated_at", "cancelled_at", \
    "cancel_reason", "due_invoices_count", "due_since", "total_dues", "addons", "coupon", "coupons" ]


    @staticmethod
    def create(params, env=None):
        return request.send('post', '/subscriptions', params, env)

    @staticmethod
    def create_for_customer(id, params, env=None):
        return request.send('post', '/customers/%s/subscriptions' % id, params, env)

    @staticmethod
    def list(params=None, env=None):
        return request.send('get', '/subscriptions', params, env)

    @staticmethod
    def retrieve(id, env=None):
        return request.send('get', '/subscriptions/%s' % id, None, env)

    @staticmethod
    def update(id, params=None, env=None):
        return request.send('post', '/subscriptions/%s' % id, params, env)

    @staticmethod
    def change_term_end(id, params, env=None):
        return request.send('post', '/subscriptions/%s/change_term_end' % id, params, env)

    @staticmethod
    def cancel(id, params=None, env=None):
        return request.send('post', '/subscriptions/%s/cancel' % id, params, env)

    @staticmethod
    def reactivate(id, params=None, env=None):
        return request.send('post', '/subscriptions/%s/reactivate' % id, params, env)

    @staticmethod
    def add_credit(id, params, env=None):
        return request.send('post', '/subscriptions/%s/add_credit' % id, params, env)
{'fraction_non_alphanumeric': 0.14800655379574004, 'fraction_numerical': 0.0, 'mean_word_length': 3.8970588235294117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3495469', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1141, 'n_words': 278}