Пример #1
0
        public static void      RequestSetKeyImage(this Version version, IPublisherAPI api, VersionDetailed.Package.Version.Language language, string path, string type, Action <RequestResponse <string> > onCompleted = null)
        {
            api.SetKeyImage(version.id, language.languageCode, path, type,
                            (r, result) =>
            {
                RequestResponse <string> requestResponse = new RequestResponse <string>()
                {
                    context = version,
                    ok      = false,
                    error   = null,
                    result  = null
                };

                if (DataStructureExtension.CheckRequest(r, result, requestResponse) == true)
                {
                    Response response = DataStructureExtension.CheckResponse(result, requestResponse);

                    if (Conf.DebugMode == Conf.DebugState.Verbose)
                    {
                        InternalNGDebug.Snapshot(response);
                    }

                    if (response != null && response.Succeeded == true)
                    {
                        requestResponse.ok     = true;
                        requestResponse.result = response.url;
                    }
                }

                if (onCompleted != null)
                {
                    onCompleted(requestResponse);
                }
            });
        }
Пример #2
0
        public static void      RequestSetPackageMetadata(this Version version, IPublisherAPI api, VersionDetailed.Package.Version.Language language, string name, string description, string keywords, Action <RequestResponse <bool> > onCompleted = null)
        {
            api.SetPackageMetadata(version.id, language.languageCode,
                                   name,
                                   description,
                                   keywords,
                                   (r, result) =>
            {
                RequestResponse <bool> requestResponse = new RequestResponse <bool>()
                {
                    context = version,
                    ok      = false,
                    error   = null,
                    result  = false
                };

                if (DataStructureExtension.CheckRequest(r, result, requestResponse) == true)
                {
                    Response response = DataStructureExtension.CheckResponse(result, requestResponse);

                    if (Conf.DebugMode == Conf.DebugState.Verbose)
                    {
                        InternalNGDebug.Snapshot(response);
                    }

                    if (response != null && response.Succeeded == true)
                    {
                        requestResponse.ok     = true;
                        requestResponse.result = true;
                    }
                }

                if (onCompleted != null)
                {
                    onCompleted(requestResponse);
                }
            });
        }