Swiftgram/submodules/TelegramUI/TelegramUI/STPAPIResponseDecodable.h
Peter b317aab568 Add 'submodules/TelegramUI/' from commit 'fa3ac0b61a27c8dd3296518a15891a6f9750cbf2'
git-subtree-dir: submodules/TelegramUI
git-subtree-mainline: 5c1613d1048026b9e00a6ce753775cef87eb53fa
git-subtree-split: fa3ac0b61a27c8dd3296518a15891a6f9750cbf2
2019-06-11 19:00:46 +01:00

29 lines
979 B
Objective-C
Executable File

//
// STPAPIResponseDecodable.h
// Stripe
//
// Created by Jack Flintermann on 10/14/15.
// Copyright © 2015 Stripe, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol STPAPIResponseDecodable <NSObject>
/**
* These fields are required to be present in the API response. If any of them are nil, `decodedObjectFromAPIResponse` should also return nil.
*/
+ (nonnull NSArray *)requiredFields;
/**
* Parses an response from the Stripe API (in JSON format; represented as an `NSDictionary`) into an instance of the class. Returns nil if the object could not be decoded (i.e. if one of its `requiredFields` is nil).
*/
+ (nullable instancetype)decodedObjectFromAPIResponse:(nullable NSDictionary *)response;
/**
* The raw JSON response used to create the object. This can be useful for using beta features that haven't yet been made into properties in the SDK.
*/
@property(nonatomic, readonly, nonnull, copy)NSDictionary *allResponseFields;
@end